+ public void testDcaeProcessor() throws ProcessException {
+ DCAEProcessor px = new DCAEProcessor() {
+ public String getName() {
+ return (null);
+ }
+
+ public String getVersion() {
+ return (null);
+ }
+
+ public String getComponentId() {
+ return (null);
+ }
+
+ public String getComponentUrl() {
+ return (null);
+ }
+
+ protected List<PropertyDescriptor> buildSupportedPropertyDescriptors() {
+ return (new LinkedList<>());
+ }
+
+ protected Set<Relationship> buildRelationships() {
+ return (new HashSet<>());
+ }
+
+ public DCAEProcessor xxx() {
+ getSupportedPropertyDescriptors();
+ getSupportedPropertyDescriptors();
+ return (this);
+ }
+ }.xxx();
+ px.ping();
+ px.onTrigger((ProcessContext)null, (ProcessSession)null);
+ px.getRelationships();
+ px.getRelationships();
+ }
+
+
+ @Test
+ public void testPaths() throws InterruptedException, IOException, URISyntaxException {
+ /* some trivial cases */
+ new OnboardingAPIClient();
+ try {
+ OnboardingAPIClient.getComponents("6:invalidURI");
+ } catch (OnboardingAPIClient.OnboardingAPIClientError oace) {
+ // expected case
+ }
+ try {
+ OnboardingAPIClient.getComponent(null);
+ } catch (OnboardingAPIClient.OnboardingAPIClientError oace) {
+ // expected case
+ }
+ /* background one shot failure cases */
+ evars.clear("GENPROC_SLEEP_SEC");
+ App.main(new String[0]);
+ evars.set("GENPROC_SLEEP_SEC", "0");
+ String wdir = tfolder.newFolder("work").getPath();
+ evars.set("GENPROC_WORKING_DIR", wdir);
+ String onboardingdir = tfolder.newFolder("onboarding").getPath();
+ evars.set("GENPROC_ONBOARDING_API_HOST", (new File(onboardingdir)).toURI().toURL().toString());
+ String compfile = onboardingdir + "/compone";
+ try (Writer w = new FileWriter(compfile)) {
+ w.write("{ \"id\": \"1\", \"spec\": { \"name\": \"one-collector\","
+ + " \"version\": \"1.0.0\", \"description\": \"desc\","
+ + " \"parameters\": [{\"name\": \"p1\", \"value\": \"v1\","
+ + " \"description\": \"d1\"}], \"streams\":"
+ + " {\"publishes\":[{\"format\": \"f1\", \"version\": \"v1\","
+ + " \"type\": \"t1\", \"config_key\": \"ck1\"}],"
+ + " \"subscribes\":[{\"format\": \"f2\", \"version\": \"v2\","
+ + " \"type\": \"t2\", \"config_key\": \"ck2\"}]}},"
+ + " \"selfUrl\": \"file:" + compfile + "\"}");
+ }
+ try (Writer w = new FileWriter(onboardingdir + "/components")) {
+ w.write("{\"components\": [{\"id\": \"1\", \"name\": \"one\","
+ + " \"version\": \"1.0.0\", \"description\": \"desc\","
+ + " \"componentType\": \"apple\", \"owner\": \"John Doe\","
+ + " \"componentUrl\": \"file:" + compfile + "\","
+ + " \"whenAdded\": \"never\" }]}");
+ }
+ String indexfile = tfolder.newFile("index").getPath();
+ try (Writer w = new FileWriter(indexfile)) {
+ w.write("[]");
+ }
+ evars.set("GENPROC_JAR_INDEX_URL", (new File(indexfile)).toURI().toURL().toString());
+ App.main(new String[0]);
+ /* help case */
+ App.main(new String[] { "-h" });
+ /* load case */
+ App.main(new String[] { "load" });
+ /* gen case */
+ App.main(new String[] { "gen" });