You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2021/06/18 18:47:59 UTC
[incubator-streampipes] branch STREAMPIPES-319 updated:
[STREAMPIPES-385] Remove connect-container module
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch STREAMPIPES-319
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/STREAMPIPES-319 by this push:
new 20de08b [STREAMPIPES-385] Remove connect-container module
20de08b is described below
commit 20de08b87bc85e79ba8f7e45a6dbf2d34a7c093e
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Fri Jun 18 20:46:54 2021 +0200
[STREAMPIPES-385] Remove connect-container module
---
pom.xml | 1 -
.../streampipes/config/backend/BackendConfig.java | 4 +
streampipes-connect-container-master/pom.xml | 2 +-
.../master/management/AdapterMasterManagement.java | 6 +-
.../master/rest/AbstractAdapterResource.java | 4 +-
.../container/master/rest/GuessResource.java | 6 +-
.../master/rest/WorkerAdministrationResource.java | 4 +-
streampipes-connect-container-worker/pom.xml | 40 ++++-
.../worker}/init/AdapterDeclarerSingleton.java | 2 +-
.../worker/init/AdapterWorkerContainer.java | 1 -
.../init/AdapterWorkerContainerResourceConfig.java | 4 +-
.../worker/management/AdapterWorkerManagement.java | 19 +-
.../worker/management/GuessManagement.java | 2 +-
.../worker}/management/RuntimeResovable.java | 4 +-
.../container/worker/rest/AdapterResource.java | 11 +-
.../container/worker/rest/GuessResource.java | 14 +-
.../container/worker/rest/ProtocolResource.java | 11 +-
.../worker/rest/RuntimeResolvableResource.java | 6 +-
.../container/worker/rest/WelcomePageWorker.java | 6 +-
.../container/worker/rest/WorkerResource.java | 4 +-
.../container/worker/utils}/AdapterUtils.java | 4 +-
.../connect/container/worker/management}/Mock.java | 2 +-
.../container/worker/utils}/AdapterUtilsTest.java | 17 +-
streampipes-connect-container/development/env | 20 ---
streampipes-connect-container/pom.xml | 82 ---------
.../streampipes/connect/config/ConfigKeys.java | 33 ----
.../connect/config/ConnectContainerConfig.java | 73 --------
.../connect/init/AdapterContainerConfig.java | 33 ----
.../connect/rest/AbstractContainerResource.java | 62 -------
.../streampipes/connect/rest/SpConnectUtils.java | 23 ---
.../src/test/SpConnectResourceTest.java | 146 ---------------
.../src/test/SpConnectTest.java | 188 --------------------
.../management/AdapterDeserializerTest.java | 195 ---------------------
.../connect/utils/TestAdapterSerializer.java | 73 --------
.../extensions/ExtensionsModelSubmitter.java | 2 +-
.../shared/impl/AbstractSharedRestInterface.java | 12 +-
36 files changed, 108 insertions(+), 1008 deletions(-)
diff --git a/pom.xml b/pom.xml
index fa87991..53f5b6d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -875,7 +875,6 @@
<module>streampipes-commons</module>
<module>streampipes-config</module>
<module>streampipes-connect</module>
- <module>streampipes-connect-container</module>
<module>streampipes-connect-container-master</module>
<module>streampipes-connect-container-worker</module>
<module>streampipes-container</module>
diff --git a/streampipes-config/src/main/java/org/apache/streampipes/config/backend/BackendConfig.java b/streampipes-config/src/main/java/org/apache/streampipes/config/backend/BackendConfig.java
index d7d2d95..6540c8e 100644
--- a/streampipes-config/src/main/java/org/apache/streampipes/config/backend/BackendConfig.java
+++ b/streampipes-config/src/main/java/org/apache/streampipes/config/backend/BackendConfig.java
@@ -102,6 +102,10 @@ public enum BackendConfig {
return "http://" + getBackendHost() + ":" + getBackendPort();
}
+ public String getBackendApiUrl() {
+ return getBackendUrl() + "/streampipes-backend/";
+ }
+
public String getJmsHost() {
return config.getString(BackendConfigKeys.JMS_HOST);
}
diff --git a/streampipes-connect-container-master/pom.xml b/streampipes-connect-container-master/pom.xml
index 91a8729..a83370b 100644
--- a/streampipes-connect-container-master/pom.xml
+++ b/streampipes-connect-container-master/pom.xml
@@ -31,7 +31,7 @@
<!-- StreamPipes dependencies -->
<dependency>
<groupId>org.apache.streampipes</groupId>
- <artifactId>streampipes-connect-container</artifactId>
+ <artifactId>streampipes-connect</artifactId>
<version>0.68.0-SNAPSHOT</version>
</dependency>
<dependency>
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/management/AdapterMasterManagement.java b/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/management/AdapterMasterManagement.java
index 1e7ddf0..c5f2a9d 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/management/AdapterMasterManagement.java
+++ b/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/management/AdapterMasterManagement.java
@@ -19,9 +19,9 @@
package org.apache.streampipes.connect.container.master.management;
import org.apache.streampipes.commons.exceptions.SepaParseException;
+import org.apache.streampipes.config.backend.BackendConfig;
import org.apache.streampipes.connect.adapter.GroundingService;
import org.apache.streampipes.connect.adapter.exception.AdapterException;
-import org.apache.streampipes.connect.config.ConnectContainerConfig;
import org.apache.streampipes.connect.container.master.util.AdapterEncryptionService;
import org.apache.streampipes.manager.storage.UserService;
import org.apache.streampipes.manager.verification.DataStreamVerifier;
@@ -92,7 +92,7 @@ public class AdapterMasterManagement {
String uuid = UUID.randomUUID().toString();
// String newId = ConnectContainerConfig.INSTANCE.getConnectContainerMasterUrl() + "api/v1/" + username + "/master/sources/" + uuid;
- String newId = ConnectContainerConfig.INSTANCE.getBackendApiUrl() + "api/v2/connect/" + username + "/master/sources/" + uuid;
+ String newId = BackendConfig.INSTANCE.getBackendApiUrl() + "api/v2/connect/" + username + "/master/sources/" + uuid;
ad.setElementId(newId);
ad.setCreatedAt(System.currentTimeMillis());
@@ -110,7 +110,7 @@ public class AdapterMasterManagement {
}
// backend url is used to install data source in streampipes
- String backendBaseUrl = ConnectContainerConfig.INSTANCE.getBackendApiUrl() + "api/v2/";
+ String backendBaseUrl = BackendConfig.INSTANCE.getBackendApiUrl() + "api/v2/";
String requestUrl = backendBaseUrl + "noauth/users/" + username + "/element";
LOG.info("Install source (source URL: " + newId + " in backend over URL: " + requestUrl);
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/AbstractAdapterResource.java b/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/AbstractAdapterResource.java
index ffe445a..f9a1045 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/AbstractAdapterResource.java
+++ b/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/AbstractAdapterResource.java
@@ -17,11 +17,11 @@
*/
package org.apache.streampipes.connect.container.master.rest;
-import org.apache.streampipes.connect.rest.AbstractContainerResource;
+import org.apache.streampipes.rest.shared.impl.AbstractSharedRestInterface;
import java.util.function.Supplier;
-public class AbstractAdapterResource<T> extends AbstractContainerResource {
+public class AbstractAdapterResource<T> extends AbstractSharedRestInterface {
protected T managementService;
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/GuessResource.java b/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/GuessResource.java
index 1fe92d6..3cd744e 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/GuessResource.java
+++ b/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/GuessResource.java
@@ -57,12 +57,12 @@ public class GuessResource extends AbstractAdapterResource<GuessManagement> {
return ok(result);
} catch (ParseException e) {
LOG.error("Error while parsing events: ", e);
- return error(Notifications.error(e.getMessage()));
+ return serverError(Notifications.error(e.getMessage()));
} catch (WorkerAdapterException e) {
- return error(e.getContent());
+ return serverError(e.getContent());
} catch (Exception e) {
LOG.error("Error while guess schema for AdapterDescription: ", e);
- return error(Notifications.error(e.getMessage()));
+ return serverError(Notifications.error(e.getMessage()));
}
}
}
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/WorkerAdministrationResource.java b/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/WorkerAdministrationResource.java
index 5703376..d421f4c 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/WorkerAdministrationResource.java
+++ b/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/WorkerAdministrationResource.java
@@ -19,10 +19,10 @@
package org.apache.streampipes.connect.container.master.rest;
import org.apache.streampipes.connect.container.master.management.WorkerAdministrationManagement;
-import org.apache.streampipes.connect.rest.AbstractContainerResource;
import org.apache.streampipes.model.connect.worker.ConnectWorkerContainer;
import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
+import org.apache.streampipes.rest.shared.impl.AbstractSharedRestInterface;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,7 +33,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("v2/connect/{username}/master/administration")
-public class WorkerAdministrationResource extends AbstractContainerResource {
+public class WorkerAdministrationResource extends AbstractSharedRestInterface {
private Logger LOG = LoggerFactory.getLogger(WorkerAdministrationResource.class);
diff --git a/streampipes-connect-container-worker/pom.xml b/streampipes-connect-container-worker/pom.xml
index 686c48e..4d563dd 100644
--- a/streampipes-connect-container-worker/pom.xml
+++ b/streampipes-connect-container-worker/pom.xml
@@ -31,14 +31,48 @@
<!-- StreamPipes dependencies -->
<dependency>
<groupId>org.apache.streampipes</groupId>
- <artifactId>streampipes-connect-container</artifactId>
+ <artifactId>streampipes-config</artifactId>
+ <version>0.68.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.streampipes</groupId>
+ <artifactId>streampipes-connect</artifactId>
+ <version>0.68.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.streampipes</groupId>
+ <artifactId>streampipes-container-base</artifactId>
+ <version>0.68.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.streampipes</groupId>
+ <artifactId>streampipes-rest-shared</artifactId>
+ <version>0.68.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.streampipes</groupId>
+ <artifactId>streampipes-serializers-json</artifactId>
<version>0.68.0-SNAPSHOT</version>
</dependency>
-
<!-- External dependencies -->
<!-- Test dependencies -->
<dependency>
+ <groupId>com.github.tomakehurst</groupId>
+ <artifactId>wiremock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.jayway.restassured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -49,4 +83,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/init/AdapterDeclarerSingleton.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterDeclarerSingleton.java
similarity index 98%
rename from streampipes-connect-container/src/main/java/org/apache/streampipes/connect/init/AdapterDeclarerSingleton.java
rename to streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterDeclarerSingleton.java
index 0f1ccee..ea3d872 100644
--- a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/init/AdapterDeclarerSingleton.java
+++ b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterDeclarerSingleton.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.streampipes.connect.init;
+package org.apache.streampipes.connect.container.worker.init;
import org.apache.streampipes.connect.adapter.Adapter;
import org.apache.streampipes.connect.adapter.model.Connector;
diff --git a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterWorkerContainer.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterWorkerContainer.java
index 9f31c57..a0f86a0 100644
--- a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterWorkerContainer.java
+++ b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterWorkerContainer.java
@@ -30,7 +30,6 @@ import org.springframework.context.annotation.Import;
import org.apache.streampipes.connect.adapter.Adapter;
import org.apache.streampipes.connect.adapter.model.generic.Protocol;
import org.apache.streampipes.connect.container.worker.management.MasterRestClient;
-import org.apache.streampipes.connect.init.AdapterDeclarerSingleton;
import org.apache.streampipes.model.connect.adapter.AdapterDescription;
import org.apache.streampipes.model.connect.grounding.ProtocolDescription;
import org.apache.streampipes.model.connect.worker.ConnectWorkerContainer;
diff --git a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterWorkerContainerResourceConfig.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterWorkerContainerResourceConfig.java
index b8e4b01..2897876 100644
--- a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterWorkerContainerResourceConfig.java
+++ b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/init/AdapterWorkerContainerResourceConfig.java
@@ -17,13 +17,13 @@
package org.apache.streampipes.connect.container.worker.init;
import org.apache.streampipes.connect.container.worker.rest.*;
-import org.apache.streampipes.connect.init.AdapterContainerConfig;
import org.apache.streampipes.rest.shared.serializer.JacksonSerializationProvider;
import org.glassfish.jersey.media.multipart.MultiPartFeature;
+import org.glassfish.jersey.server.ResourceConfig;
import org.springframework.stereotype.Component;
@Component
-public class AdapterWorkerContainerResourceConfig extends AdapterContainerConfig {
+public class AdapterWorkerContainerResourceConfig extends ResourceConfig {
public AdapterWorkerContainerResourceConfig() {
super();
diff --git a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/management/AdapterWorkerManagement.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/management/AdapterWorkerManagement.java
index 1cc47b8..620ab48 100644
--- a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/management/AdapterWorkerManagement.java
+++ b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/management/AdapterWorkerManagement.java
@@ -18,22 +18,18 @@
package org.apache.streampipes.connect.container.worker.management;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.streampipes.config.backend.BackendConfig;
import org.apache.streampipes.connect.RunningAdapterInstances;
import org.apache.streampipes.connect.adapter.Adapter;
import org.apache.streampipes.connect.adapter.exception.AdapterException;
import org.apache.streampipes.connect.adapter.model.generic.GenericAdapter;
import org.apache.streampipes.connect.adapter.model.generic.Protocol;
-import org.apache.streampipes.connect.config.ConnectContainerConfig;
-import org.apache.streampipes.connect.init.AdapterDeclarerSingleton;
-import org.apache.streampipes.connect.management.AdapterUtils;
+import org.apache.streampipes.connect.container.worker.init.AdapterDeclarerSingleton;
+import org.apache.streampipes.connect.container.worker.utils.AdapterUtils;
import org.apache.streampipes.model.SpDataSet;
-import org.apache.streampipes.model.connect.adapter.AdapterDescription;
-import org.apache.streampipes.model.connect.adapter.AdapterSetDescription;
-import org.apache.streampipes.model.connect.adapter.AdapterStreamDescription;
-import org.apache.streampipes.model.connect.adapter.GenericAdapterSetDescription;
-import org.apache.streampipes.model.connect.adapter.GenericAdapterStreamDescription;
+import org.apache.streampipes.model.connect.adapter.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.Collection;
@@ -116,7 +112,8 @@ public class AdapterWorkerManagement {
} catch (InterruptedException e) {
e.printStackTrace();
}
- String url = AdapterUtils.getUrl(ConnectContainerConfig.INSTANCE.getBackendApiUrl(), dataSet.getCorrespondingPipeline());
+ // TODO Service Discovery
+ String url = AdapterUtils.getUrl(BackendConfig.INSTANCE.getBackendApiUrl(), dataSet.getCorrespondingPipeline());
String result = AdapterUtils.stopPipeline(url);
logger.info(result);
diff --git a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/management/GuessManagement.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/management/GuessManagement.java
index 5d18ff3..cac2312 100644
--- a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/management/GuessManagement.java
+++ b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/management/GuessManagement.java
@@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory;
import org.apache.streampipes.connect.adapter.Adapter;
import org.apache.streampipes.connect.adapter.exception.AdapterException;
import org.apache.streampipes.connect.adapter.exception.ParseException;
-import org.apache.streampipes.connect.management.AdapterUtils;
+import org.apache.streampipes.connect.container.worker.utils.AdapterUtils;
import org.apache.streampipes.model.connect.adapter.AdapterDescription;
import org.apache.streampipes.model.connect.guess.GuessSchema;
import org.apache.streampipes.sdk.helpers.EpProperties;
diff --git a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/management/RuntimeResovable.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/management/RuntimeResovable.java
similarity index 94%
rename from streampipes-connect-container/src/main/java/org/apache/streampipes/connect/management/RuntimeResovable.java
rename to streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/management/RuntimeResovable.java
index 4170f32..9208973 100644
--- a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/management/RuntimeResovable.java
+++ b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/management/RuntimeResovable.java
@@ -16,13 +16,13 @@
*
*/
-package org.apache.streampipes.connect.management;
+package org.apache.streampipes.connect.container.worker.management;
import org.apache.streampipes.connect.adapter.Adapter;
import org.apache.streampipes.connect.adapter.AdapterRegistry;
import org.apache.streampipes.connect.adapter.model.generic.Format;
import org.apache.streampipes.connect.adapter.model.generic.Protocol;
-import org.apache.streampipes.connect.init.AdapterDeclarerSingleton;
+import org.apache.streampipes.connect.container.worker.init.AdapterDeclarerSingleton;
import org.apache.streampipes.container.api.ResolvesContainerProvidedOptions;
import java.util.Map;
diff --git a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/AdapterResource.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/AdapterResource.java
index 2c991f0..724924d 100644
--- a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/AdapterResource.java
+++ b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/AdapterResource.java
@@ -20,13 +20,9 @@ package org.apache.streampipes.connect.container.worker.rest;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import org.apache.streampipes.connect.container.worker.management.AdapterWorkerManagement;
-import org.apache.streampipes.connect.rest.AbstractContainerResource;
import org.apache.streampipes.container.assets.AssetZipGenerator;
import org.apache.streampipes.container.util.AssetsUtil;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
+import org.apache.streampipes.rest.shared.impl.AbstractSharedRestInterface;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -34,9 +30,12 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
@Path("/api/v1/{username}/worker/adapters")
-public class AdapterResource extends AbstractContainerResource {
+public class AdapterResource extends AbstractSharedRestInterface {
private AdapterWorkerManagement adapterWorkerManagement;
diff --git a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/GuessResource.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/GuessResource.java
index f29596f..75527c4 100644
--- a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/GuessResource.java
+++ b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/GuessResource.java
@@ -20,11 +20,11 @@ package org.apache.streampipes.connect.container.worker.rest;
import org.apache.streampipes.connect.adapter.exception.ParseException;
import org.apache.streampipes.connect.container.worker.management.GuessManagement;
-import org.apache.streampipes.connect.rest.AbstractContainerResource;
-import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.model.connect.adapter.AdapterDescription;
import org.apache.streampipes.model.connect.guess.GuessSchema;
+import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
+import org.apache.streampipes.rest.shared.impl.AbstractSharedRestInterface;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,7 +37,7 @@ import javax.ws.rs.core.Response;
@Path("/api/v1/{username}/worker/guess")
-public class GuessResource extends AbstractContainerResource {
+public class GuessResource extends AbstractSharedRestInterface {
private static final Logger logger = LoggerFactory.getLogger(GuessResource.class);
@@ -63,16 +63,12 @@ public class GuessResource extends AbstractContainerResource {
return ok(result);
} catch (ParseException e) {
logger.error("Error while parsing events: ", e);
- return error(Notifications.error(e.getMessage()));
+ return serverError(Notifications.error(e.getMessage()));
} catch (Exception e) {
logger.error("Error while guess schema for AdapterDescription: " + adapterDescription.getAdapterId(), e);
- return error(Notifications.error(e.getMessage()));
+ return serverError(Notifications.error(e.getMessage()));
}
}
- public void setGuessManagement(GuessManagement guessManagement) {
- this.guessManagement = guessManagement;
- }
-
}
diff --git a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/ProtocolResource.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/ProtocolResource.java
index e06902d..5d8fade 100644
--- a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/ProtocolResource.java
+++ b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/ProtocolResource.java
@@ -20,13 +20,9 @@ package org.apache.streampipes.connect.container.worker.rest;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import org.apache.streampipes.connect.container.worker.management.AdapterWorkerManagement;
-import org.apache.streampipes.connect.rest.AbstractContainerResource;
import org.apache.streampipes.container.assets.AssetZipGenerator;
import org.apache.streampipes.container.util.AssetsUtil;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
+import org.apache.streampipes.rest.shared.impl.AbstractSharedRestInterface;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -34,9 +30,12 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
@Path("/api/v1/{username}/worker/protocols")
-public class ProtocolResource extends AbstractContainerResource {
+public class ProtocolResource extends AbstractSharedRestInterface {
private AdapterWorkerManagement adapterWorkerManagement;
diff --git a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/RuntimeResolvableResource.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/RuntimeResolvableResource.java
index b686e6a..0f3d17f 100644
--- a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/RuntimeResolvableResource.java
+++ b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/RuntimeResolvableResource.java
@@ -18,13 +18,13 @@
package org.apache.streampipes.connect.container.worker.rest;
-import org.apache.streampipes.connect.management.RuntimeResovable;
-import org.apache.streampipes.connect.rest.AbstractContainerResource;
+import org.apache.streampipes.connect.container.worker.management.RuntimeResovable;
import org.apache.streampipes.container.api.ResolvesContainerProvidedOptions;
import org.apache.streampipes.model.runtime.RuntimeOptionsRequest;
import org.apache.streampipes.model.runtime.RuntimeOptionsResponse;
import org.apache.streampipes.model.staticproperty.Option;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
+import org.apache.streampipes.rest.shared.impl.AbstractSharedRestInterface;
import org.apache.streampipes.sdk.extractor.StaticPropertyExtractor;
import javax.ws.rs.*;
@@ -33,7 +33,7 @@ import javax.ws.rs.core.Response;
import java.util.List;
@Path("/api/v1/{username}/worker/resolvable")
-public class RuntimeResolvableResource extends AbstractContainerResource {
+public class RuntimeResolvableResource extends AbstractSharedRestInterface {
@POST
@Path("{id}/configurations")
diff --git a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/WelcomePageWorker.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/WelcomePageWorker.java
index 3bffb5d..ecfe056 100644
--- a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/WelcomePageWorker.java
+++ b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/WelcomePageWorker.java
@@ -19,11 +19,11 @@
package org.apache.streampipes.connect.container.worker.rest;
-import org.rendersnake.HtmlCanvas;
import org.apache.streampipes.connect.adapter.Adapter;
import org.apache.streampipes.connect.adapter.model.generic.Protocol;
import org.apache.streampipes.connect.container.worker.management.AdapterWorkerManagement;
-import org.apache.streampipes.connect.rest.AbstractContainerResource;
+import org.apache.streampipes.rest.shared.impl.AbstractSharedRestInterface;
+import org.rendersnake.HtmlCanvas;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -33,7 +33,7 @@ import java.io.IOException;
import java.util.Collection;
@Path("/")
-public class WelcomePageWorker extends AbstractContainerResource {
+public class WelcomePageWorker extends AbstractSharedRestInterface {
private String id;
diff --git a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/WorkerResource.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/WorkerResource.java
index b9dcdba..e608caa 100644
--- a/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/WorkerResource.java
+++ b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/rest/WorkerResource.java
@@ -20,11 +20,11 @@ package org.apache.streampipes.connect.container.worker.rest;
import org.apache.streampipes.connect.adapter.exception.AdapterException;
import org.apache.streampipes.connect.container.worker.management.AdapterWorkerManagement;
-import org.apache.streampipes.connect.rest.AbstractContainerResource;
import org.apache.streampipes.model.connect.adapter.AdapterSetDescription;
import org.apache.streampipes.model.connect.adapter.AdapterStreamDescription;
import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
+import org.apache.streampipes.rest.shared.impl.AbstractSharedRestInterface;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,7 +36,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/api/v1/{username}/worker")
-public class WorkerResource extends AbstractContainerResource {
+public class WorkerResource extends AbstractSharedRestInterface {
private static final Logger logger = LoggerFactory.getLogger(WorkerResource.class);
diff --git a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/management/AdapterUtils.java b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/utils/AdapterUtils.java
similarity index 96%
rename from streampipes-connect-container/src/main/java/org/apache/streampipes/connect/management/AdapterUtils.java
rename to streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/utils/AdapterUtils.java
index 59bd90a..3dd9e8d 100644
--- a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/management/AdapterUtils.java
+++ b/streampipes-connect-container-worker/src/main/java/org/apache/streampipes/connect/container/worker/utils/AdapterUtils.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.streampipes.connect.management;
+package org.apache.streampipes.connect.container.worker.utils;
import org.apache.http.client.fluent.Request;
import org.slf4j.Logger;
@@ -26,7 +26,7 @@ import org.apache.streampipes.connect.adapter.model.generic.GenericAdapter;
import org.apache.streampipes.connect.adapter.model.generic.GenericDataSetAdapter;
import org.apache.streampipes.connect.adapter.model.generic.GenericDataStreamAdapter;
import org.apache.streampipes.connect.adapter.model.generic.Protocol;
-import org.apache.streampipes.connect.init.AdapterDeclarerSingleton;
+import org.apache.streampipes.connect.container.worker.init.AdapterDeclarerSingleton;
import org.apache.streampipes.model.connect.adapter.AdapterDescription;
import org.apache.streampipes.model.connect.adapter.GenericAdapterSetDescription;
import org.apache.streampipes.model.connect.adapter.GenericAdapterStreamDescription;
diff --git a/streampipes-connect-container/src/test/java/org/streampipes/connect/Mock.java b/streampipes-connect-container-worker/src/test/java/org/apache/streampipes/connect/container/worker/management/Mock.java
similarity index 93%
rename from streampipes-connect-container/src/test/java/org/streampipes/connect/Mock.java
rename to streampipes-connect-container-worker/src/test/java/org/apache/streampipes/connect/container/worker/management/Mock.java
index 910b8ff..e387d66 100644
--- a/streampipes-connect-container/src/test/java/org/streampipes/connect/Mock.java
+++ b/streampipes-connect-container-worker/src/test/java/org/apache/streampipes/connect/container/worker/management/Mock.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.streampipes.connect;
+package org.apache.streampipes.connect.container.worker.management;
public class Mock {
public static int PORT = 8042;
diff --git a/streampipes-connect-container/src/test/java/org/streampipes/connect/management/AdapterUtilsTest.java b/streampipes-connect-container-worker/src/test/java/org/apache/streampipes/connect/container/worker/utils/AdapterUtilsTest.java
similarity index 78%
rename from streampipes-connect-container/src/test/java/org/streampipes/connect/management/AdapterUtilsTest.java
rename to streampipes-connect-container-worker/src/test/java/org/apache/streampipes/connect/container/worker/utils/AdapterUtilsTest.java
index aa4ca35..4de2353 100644
--- a/streampipes-connect-container/src/test/java/org/streampipes/connect/management/AdapterUtilsTest.java
+++ b/streampipes-connect-container-worker/src/test/java/org/apache/streampipes/connect/container/worker/utils/AdapterUtilsTest.java
@@ -16,17 +16,16 @@
*
*/
-package org.apache.streampipes.connect.management;
+package org.apache.streampipes.connect.container.worker.utils;
+import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
+import org.apache.streampipes.connect.container.worker.management.Mock;
import org.junit.Rule;
import org.junit.Test;
-import org.apache.streampipes.connect.Mock;
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
-
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
public class AdapterUtilsTest {
@Rule
@@ -37,8 +36,8 @@ public class AdapterUtilsTest {
public void stopPipeline() {
String expected = "";
- stubFor(get(urlEqualTo("/"))
- .willReturn(aResponse()
+ WireMock.stubFor(WireMock.get(WireMock.urlEqualTo("/"))
+ .willReturn(WireMock.aResponse()
.withStatus(200)
.withBody(expected)));
@@ -47,7 +46,7 @@ public class AdapterUtilsTest {
assertEquals(expected, result);
- verify(getRequestedFor(urlMatching("/")));
+ WireMock.verify(WireMock.getRequestedFor(WireMock.urlMatching("/")));
}
@Test
@@ -58,4 +57,4 @@ public class AdapterUtilsTest {
assertEquals(expected, result);
}
-}
\ No newline at end of file
+}
diff --git a/streampipes-connect-container/development/env b/streampipes-connect-container/development/env
deleted file mode 100644
index af62f52..0000000
--- a/streampipes-connect-container/development/env
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Those parameters are used by IntelliJ to set the default consul parameters for development
-SP_BACKEND_HOST=localhost
-SP_KAFKA_HOST=localhost
-SP_CONNECT_CONTAINER_HOST=localhost
-SP_COUCHDB_HOST=localhost
\ No newline at end of file
diff --git a/streampipes-connect-container/pom.xml b/streampipes-connect-container/pom.xml
deleted file mode 100644
index 3e01d2f..0000000
--- a/streampipes-connect-container/pom.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>streampipes-parent</artifactId>
- <groupId>org.apache.streampipes</groupId>
- <version>0.68.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>streampipes-connect-container</artifactId>
-
- <dependencies>
- <!-- StreamPipes dependencies -->
- <dependency>
- <groupId>org.apache.streampipes</groupId>
- <artifactId>streampipes-config</artifactId>
- <version>0.68.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.streampipes</groupId>
- <artifactId>streampipes-connect</artifactId>
- <version>0.68.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.streampipes</groupId>
- <artifactId>streampipes-container-base</artifactId>
- <version>0.68.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.streampipes</groupId>
- <artifactId>streampipes-rest-shared</artifactId>
- <version>0.68.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.streampipes</groupId>
- <artifactId>streampipes-serializers-json</artifactId>
- <version>0.68.0-SNAPSHOT</version>
- </dependency>
-
- <!-- External dependencies -->
-
- <!-- Test dependencies -->
- <dependency>
- <groupId>com.github.tomakehurst</groupId>
- <artifactId>wiremock</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.jayway.restassured</groupId>
- <artifactId>rest-assured</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
diff --git a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/config/ConfigKeys.java b/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/config/ConfigKeys.java
deleted file mode 100644
index f6148fc..0000000
--- a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/config/ConfigKeys.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.connect.config;
-
-public class ConfigKeys {
- final static String KAFKA_HOST = "SP_KAFKA_HOST";
- final static String KAFKA_PORT = "SP_KAFKA_PORT";
-
- final static String BACKEND_HOST = "SP_BACKEND_HOST";
- final static String BACKEND_PORT = "SP_BACKEND_PORT";
-
-// final static String CONNECT_CONTAINER_MASTER_HOST = "SP_CONNECT_CONTAINER_HOST";
-// final static String CONNECT_CONTAINER_MASTER_PORT = "SP_CONNECT_CONTAINER_PORT";
-
- final static String DATA_LOCATION = "SP_DATA_LOCATION";
-
-}
diff --git a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/config/ConnectContainerConfig.java b/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/config/ConnectContainerConfig.java
deleted file mode 100644
index cbbb5e6..0000000
--- a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/config/ConnectContainerConfig.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.connect.config;
-
-import org.apache.streampipes.config.SpConfig;
-
-public enum ConnectContainerConfig {
- INSTANCE;
-
- private SpConfig config;
-
- ConnectContainerConfig() {
- config = SpConfig.getSpConfig("connect-container");
-
- config.register(ConfigKeys.KAFKA_HOST, "kafka", "Hostname for backend service for kafka");
- config.register(ConfigKeys.KAFKA_PORT, 9092, "Port for backend service for kafka");
-
- config.register(ConfigKeys.BACKEND_HOST, "backend", "Hostname for backend");
- config.register(ConfigKeys.BACKEND_PORT, 8030, "Port for backend");
-
-// config.register(ConfigKeys.CONNECT_CONTAINER_MASTER_PORT, Config.MASTER_PORT, "The port of the connect container");
-// config.register(ConfigKeys.CONNECT_CONTAINER_MASTER_HOST, "connect-master", "The hostname of the connect container");
-
- config.register(ConfigKeys.DATA_LOCATION,"/data/", "Folder that stores all the uploaded data");
-
- }
-
- public String getBackendApiUrl() {
- return "http://" + config.getString( ConfigKeys.BACKEND_HOST) + ":" + config.getInteger(ConfigKeys.BACKEND_PORT) + "/streampipes-backend/";
- }
-
- public String getBackendHost() {
- return config.getString(ConfigKeys.BACKEND_HOST);
- }
-
- public int getBackendPort() {
- return config.getInteger(ConfigKeys.BACKEND_PORT);
- }
-
- public String getDataLocation() {
- return config.getString(ConfigKeys.DATA_LOCATION);
- }
-
- public String getKafkaHost() {
- return config.getString(ConfigKeys.KAFKA_HOST);
- }
-
- public int getKafkaPort() {
- return config.getInteger(ConfigKeys.KAFKA_PORT);
- }
-
- public String getKafkaUrl() {
- return getKafkaHost() + ":" + getKafkaPort();
- }
-
-
-}
diff --git a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/init/AdapterContainerConfig.java b/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/init/AdapterContainerConfig.java
deleted file mode 100644
index 02a7f33..0000000
--- a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/init/AdapterContainerConfig.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.connect.init;
-
-import org.apache.streampipes.rest.shared.serializer.GsonClientModelProvider;
-import org.apache.streampipes.rest.shared.serializer.GsonWithIdProvider;
-import org.apache.streampipes.rest.shared.serializer.GsonWithoutIdProvider;
-import org.glassfish.jersey.server.ResourceConfig;
-
-public abstract class AdapterContainerConfig extends ResourceConfig {
-
- public AdapterContainerConfig() {
- register(GsonWithIdProvider.class);
- register(GsonWithoutIdProvider.class);
- register(GsonClientModelProvider.class);
- }
-}
diff --git a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/rest/AbstractContainerResource.java b/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/rest/AbstractContainerResource.java
deleted file mode 100644
index 6ed7d23..0000000
--- a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/rest/AbstractContainerResource.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.connect.rest;
-
-import org.apache.streampipes.model.message.Message;
-
-import javax.ws.rs.core.Response;
-
-public abstract class AbstractContainerResource {
-
- protected <T> Response ok(T entity) {
- return Response
- .ok()
- .entity(entity)
- .build();
- }
-
- protected <T> Response ok() {
- return Response
- .ok()
- .build();
- }
-
- protected <T> Response error(T entity) {
- return Response
- .status(500)
- .entity(entity)
- .build();
- }
-
-
- protected Response statusMessage(Message message) {
- return ok(message);
- }
-
- protected Response fail() {
- return Response.serverError().build();
- }
-
- protected <T> Response fail(T entity) {
- return Response
- .serverError()
- .entity(entity)
- .build();
- }
-}
diff --git a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/rest/SpConnectUtils.java b/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/rest/SpConnectUtils.java
deleted file mode 100644
index ebb4005..0000000
--- a/streampipes-connect-container/src/main/java/org/apache/streampipes/connect/rest/SpConnectUtils.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.connect.rest;
-
-public class SpConnectUtils {
- public static final String SUCCESS = "success";
-}
diff --git a/streampipes-connect-container/src/test/SpConnectResourceTest.java b/streampipes-connect-container/src/test/SpConnectResourceTest.java
deleted file mode 100644
index 4da3c51..0000000
--- a/streampipes-connect-container/src/test/SpConnectResourceTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.rest.impl.connect;
-
-import com.jayway.restassured.RestAssured;
-import org.eclipse.jetty.server.Server;
-import org.glassfish.jersey.jetty.JettyHttpContainerFactory;
-import org.glassfish.jersey.server.ResourceConfig;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.streampipes.model.SpDataSet;
-import org.apache.streampipes.model.connect.adapter.AdapterStreamDescription;
-import org.apache.streampipes.rest.Mock;
-import org.apache.streampipes.rest.TestUtil;
-import org.apache.streampipes.storage.couchdb.impl.AdapterStorageImpl;
-
-import javax.ws.rs.core.UriBuilder;
-import java.net.URI;
-
-import static com.jayway.restassured.RestAssured.given;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-
-public class SpConnectResourceTest {
-
- SpConnectResource spConnectResource;
- Server server;
-
- @Before
- public void before() {
-
- spConnectResource = new SpConnectResource(new SpConnect(), "");
- RestAssured.port = Mock.PORT;
-
- ResourceConfig config = new ResourceConfig().register(spConnectResource);
-
- URI baseUri = UriBuilder
- .fromUri(Mock.HOST)
- .build();
-
- server = JettyHttpContainerFactory.createServer(baseUri, config);
- }
-
- @After
- public void after() {
- try {
- server.stop();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void addAdapterSuccess() {
-
- // Mock adatper management
- SpConnect spConnect = mock(SpConnect.class);
- org.mockito.Mockito.when(spConnect.addAdapter(any(AdapterStreamDescription.class), any(String.class), any()))
- .thenReturn(SpConnectUtils.SUCCESS);
- spConnectResource.setSpConnect(spConnect);
-
- // perform test
- String data = TestUtil.getMinimalStreamAdapterJsonLD();
- given().contentType("application/json").body(data).when()
- .post("v2/adapter").then().assertThat()
- .body("success", equalTo(true))
- .body("optionalMessage", equalTo(""))
- .body("elementId", equalTo("http://test.de/1"));
- }
-
- @Test
- public void addAdapterFail() {
-
- String errorMessage = "ERROR";
-
- SpConnect spConnect = mock(SpConnect.class);
- org.mockito.Mockito.when(spConnect.addAdapter(any(AdapterStreamDescription.class), any(String.class), any()))
- .thenReturn(errorMessage);
- spConnectResource.setSpConnect(spConnect);
- spConnectResource.setConnectContainerEndpoint(Mock.HOST);
-
- SpConnect backendConfig = mock(SpConnect.class);
-
- String data = TestUtil.getMinimalStreamAdapterJsonLD();
- given().contentType("application/json").body(data).when()
- .post("v2/adapter").then().assertThat()
- .body("success", equalTo(false))
- .body("optionalMessage", equalTo(errorMessage))
- .body("elementId", equalTo("http://test.de/1"));
- }
-
- @Test
- public void invokeAdapterSuccess() {
-
- SpConnect spConnect = mock(SpConnect.class);
- org.mockito.Mockito.when(spConnect.invokeAdapter(any(String.class), any(SpDataSet.class), any(String.class),
- any(AdapterStorageImpl.class)))
- .thenReturn(SpConnectUtils.SUCCESS);
- spConnectResource.setSpConnect(spConnect);
-
- String data = TestUtil.getMinimalDataSet();
- given().contentType("application/json").body(data).when()
- .post("v2/adapter/all/1234/streams").then().assertThat()
- .body("success", equalTo(true))
- .body("optionalMessage", equalTo(""))
- .body("elementId", equalTo("1234"));
- }
-
- @Test
- public void invokeAdapterFail() {
-
- String errorMessage = "ERROR";
-
- SpConnect spConnect = mock(SpConnect.class);
- org.mockito.Mockito.when(spConnect.invokeAdapter(any(String.class), any(SpDataSet.class), any(String.class),
- any(AdapterStorageImpl.class)))
- .thenReturn(errorMessage);
- spConnectResource.setSpConnect(spConnect);
-
- String data = TestUtil.getMinimalDataSet();
- given().contentType("application/json").body(data).when()
- .post("v2/adapter/all/1234/streams").then().assertThat()
- .body("success", equalTo(false))
- .body("optionalMessage", equalTo(errorMessage))
- .body("elementId", equalTo("1234"));
- }
-
-}
\ No newline at end of file
diff --git a/streampipes-connect-container/src/test/SpConnectTest.java b/streampipes-connect-container/src/test/SpConnectTest.java
deleted file mode 100644
index d54209b..0000000
--- a/streampipes-connect-container/src/test/SpConnectTest.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.rest.impl.connect;
-
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.apache.streampipes.model.Response;
-import org.apache.streampipes.model.SpDataSet;
-import org.apache.streampipes.model.connect.adapter.AdapterDescription;
-import org.apache.streampipes.model.connect.adapter.AdapterSetDescription;
-import org.apache.streampipes.model.connect.adapter.AdapterStreamDescription;
-import org.apache.streampipes.model.schema.EventSchema;
-import org.apache.streampipes.rest.Mock;
-import org.apache.streampipes.rest.TestUtil;
-import org.apache.streampipes.storage.couchdb.impl.AdapterStorageImpl;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-
-public class SpConnectTest {
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(Mock.PORT);
-
- @Before
- public void before() {
- }
-
- @Test
- public void isStreamAdapterSuccess() {
- AdapterStorageImpl adapterStorage = mock(AdapterStorageImpl.class);
- org.mockito.Mockito.when(adapterStorage.getAdapter(org.mockito.ArgumentMatchers.any(String.class)))
- .thenReturn(new AdapterStreamDescription());
-
-
- assertTrue(SpConnect.isStreamAdapter("", adapterStorage));
- }
-
- @Test
- public void isStreamAdapterFail() {
- AdapterStorageImpl adapterStorage = mock(AdapterStorageImpl.class);
- org.mockito.Mockito.when(adapterStorage.getAdapter(org.mockito.ArgumentMatchers.any(String.class)))
- .thenReturn(new AdapterSetDescription());
-
- assertFalse(SpConnect.isStreamAdapter("", adapterStorage));
- }
-
-
- @Test
- public void getAdapterStreamDescriptionWithoutType() {
- AdapterDescription asd = SpConnect
- .getAdapterDescription(TestUtil.getMinimalStreamAdapterJsonLD());
-
- assertTrue(asd instanceof AdapterStreamDescription);
- }
-
- @Test
- public void getAdapterSetDescriptionWithoutType() {
- AdapterDescription asd = SpConnect.
- getAdapterDescription(TestUtil.getMinimalSetAdapterJsonLD());
-
- assertTrue(asd instanceof AdapterSetDescription);
- }
-
- @Test
- public void startStreamAdapterTest() {
- // expected http request to connect-container /invoke/stream
- Response expected = new Response("id",true);
- stubFor(post(urlEqualTo("/api/v1/invoke/stream"))
- .willReturn(aResponse()
- .withStatus(200)
- .withBody(expected.toString())));
-
- AdapterStreamDescription adapter = new AdapterStreamDescription();
- adapter.setUri("http://test.de/1");
-
- String result = SpConnect.startStreamAdapter(adapter, Mock.HOST + "/");
-
- assertEquals(SpConnectUtils.SUCCESS, result);
- verify(postRequestedFor(urlEqualTo("/api/v1/invoke/stream"))
- .withHeader("Content-Type", equalTo("application/json; charset=UTF-8")));
- }
-
- @Test
- public void invokeAdapterTest() {
- Response expected = new Response("id",true);
- stubFor(post(urlEqualTo("/api/v1/invoke/set"))
- .willReturn(aResponse()
- .withStatus(200)
- .withBody(expected.toString())));
-
- AdapterSetDescription adapterSetDescription = new AdapterSetDescription();
- adapterSetDescription.setUri("http://test.adapter");
- AdapterStorageImpl adapterStorage = mock(AdapterStorageImpl.class);
- org.mockito.Mockito.when(adapterStorage.getAdapter(org.mockito.ArgumentMatchers.any(String.class)))
- .thenReturn(adapterSetDescription);
-
-
- SpDataSet dataSet = new SpDataSet("http://one.de", "name", "desc", new EventSchema());
-
- SpConnect spConnect = new SpConnect();
- String result = spConnect.invokeAdapter("1234", dataSet, Mock.HOST + "/", adapterStorage);
-
- assertEquals(SpConnectUtils.SUCCESS, result);
- verify(postRequestedFor(urlEqualTo("/api/v1/invoke/set"))
- .withHeader("Content-Type", equalTo("application/json; charset=UTF-8")));
-
- }
-
- @Test
- public void stopStreamAdapterTest() {
- Response expected = new Response("id",true);
- stubFor(post(urlEqualTo("/api/v1/stopAdapter/stream"))
- .willReturn(aResponse()
- .withStatus(200)
- .withBody(expected.toString())));
-
- AdapterDescription adapterDescription = new AdapterSetDescription();
- adapterDescription.setUri("http://test.adapter");
- AdapterStorageImpl adapterStorage = mock(AdapterStorageImpl.class);
- org.mockito.Mockito.when(adapterStorage.getAdapter(org.mockito.ArgumentMatchers.any(String.class)))
- .thenReturn(adapterDescription);
-
-
- SpConnect spConnect = new SpConnect();
- String result = spConnect.stopStreamAdapter("1234",Mock.HOST + "/", adapterStorage);
-
- assertEquals(SpConnectUtils.SUCCESS, result);
- verify(postRequestedFor(urlEqualTo("/api/v1/stopAdapter/stream"))
- .withHeader("Content-Type", equalTo("application/json; charset=UTF-8")));
- }
-
- @Test
- public void stopSetAdapterTest() {
- Response expected = new Response("id",true);
- stubFor(post(urlEqualTo("/api/v1/stopAdapter/set"))
- .willReturn(aResponse()
- .withStatus(200)
- .withBody(expected.toString())));
-
- AdapterDescription adapterDescription = new AdapterSetDescription();
- adapterDescription.setUri("http://test.adapter");
- AdapterStorageImpl adapterStorage = mock(AdapterStorageImpl.class);
- org.mockito.Mockito.when(adapterStorage.getAdapter(org.mockito.ArgumentMatchers.any(String.class)))
- .thenReturn(adapterDescription);
-
-
- SpConnect spConnect = new SpConnect();
- String result = spConnect.stopSetAdapter("1234",Mock.HOST + "/", adapterStorage);
-
- assertEquals(SpConnectUtils.SUCCESS, result);
- verify(postRequestedFor(urlEqualTo("/api/v1/stopAdapter/set"))
- .withHeader("Content-Type", equalTo("application/json; charset=UTF-8")));
- }
-
-// @Test
-// public void installDatasource() {
-//// stubFor(post(urlEqualTo("/api/v1/stopAdapter/set"))
-//// .willReturn(aResponse()
-//// .withStatus(200)
-//// .wit
-//// .withBody(expected.toString())));
-//
-// SpConnect spConnect = new SpConnect();
-// boolean result = spConnect.installDatasource();
-//
-// assertEquals(true, result);
-// }
-}
\ No newline at end of file
diff --git a/streampipes-connect-container/src/test/java/org/streampipes/connect/management/AdapterDeserializerTest.java b/streampipes-connect-container/src/test/java/org/streampipes/connect/management/AdapterDeserializerTest.java
deleted file mode 100644
index c48d898..0000000
--- a/streampipes-connect-container/src/test/java/org/streampipes/connect/management/AdapterDeserializerTest.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.connect.management;
-
-public class AdapterDeserializerTest {
-//
-// @Test
-// public void getGenericAdapterStreamDescription() throws AdapterException {
-// AdapterDescription genericAdapterStreamDescription = new GenericAdapterStreamDescription();
-// String jsonLd = JsonLdUtils.toJsonLD(genericAdapterStreamDescription);
-//
-// AdapterDescription a = AdapterDeserializer.getAdapterDescription(jsonLd);
-//
-// assertTrue(a instanceof GenericAdapterStreamDescription);
-// assertEquals(GenericAdapterStreamDescription.ID, a.getUri());
-// }
-//
-// @Test
-// public void getGenericAdapterSetDescription() throws AdapterException {
-// AdapterDescription genericAdapterSetDescription = new GenericAdapterSetDescription();
-// String jsonLd = JsonLdUtils.toJsonLD(genericAdapterSetDescription);
-//
-// AdapterDescription a = AdapterDeserializer.getAdapterDescription(jsonLd);
-//
-// assertTrue(a instanceof GenericAdapterSetDescription);
-// assertEquals(GenericAdapterSetDescription.ID, a.getUri());
-// }
-//
-// @Test
-// public void getFormatDescriptionHttpProtocolXmlFormat() throws AdapterException {
-// AdapterDescription genericAdapterStreamDescription = new GenericAdapterStreamDescription();
-//
-// XmlFormat xmlFormat = new XmlFormat("row");
-// HttpProtocol httpProtocol = new HttpProtocol(new XmlParser("row"), xmlFormat, "URL");
-//
-// FormatDescription formatDescription = xmlFormat.declareModel();
-// ProtocolDescription protocolDescription = httpProtocol.declareModel();
-//
-//
-// ((GenericAdapterStreamDescription) genericAdapterStreamDescription).setProtocolDescription(protocolDescription);
-// ((GenericAdapterStreamDescription) genericAdapterStreamDescription).setFormatDescription(formatDescription);
-//
-// String jsonLd = JsonLdUtils.toJsonLD(genericAdapterStreamDescription);
-//
-// AdapterDescription a = AdapterDeserializer.getAdapterDescription(jsonLd);
-//
-// assertNotNull(((GenericAdapterStreamDescription) a).getFormatDescription());
-// }
-//
-// @Test
-// public void getFormatDescriptionKafkaProtocolJsobObjectFormat() throws AdapterException {
-// AdapterDescription genericAdapterStreamDescription = new GenericAdapterStreamDescription();
-//
-// JsonObjectFormat jsonObjectFormat = new JsonObjectFormat();
-// KafkaProtocol kafkaProtocol = new KafkaProtocol(new JsonObjectParser(), jsonObjectFormat, "URL", "broker");
-//
-// FormatDescription formatDescription = jsonObjectFormat.declareModel();
-// ProtocolDescription protocolDescription = kafkaProtocol.declareModel();
-//
-// ((GenericAdapterStreamDescription) genericAdapterStreamDescription).setProtocolDescription(protocolDescription);
-// ((GenericAdapterStreamDescription) genericAdapterStreamDescription).setFormatDescription(formatDescription);
-//
-// String jsonLd = JsonLdUtils.toJsonLD(genericAdapterStreamDescription);
-//
-// System.out.println(jsonLd);
-// AdapterDescription a = AdapterDeserializer.getAdapterDescription(jsonLd);
-//
-// assertNotNull(((GenericAdapterStreamDescription) a).getFormatDescription());
-// }
-//
-// @Test
-// public void testAdapterSetDeserialization() throws AdapterException {
-// String jsonld = getGenericAdapterSetDescripionGeneratedByFrontend();
-// AdapterDescription a = AdapterDeserializer.getAdapterDescription(jsonld);
-//
-//
-// assertNotNull(((GenericAdapterSetDescription) a).getFormatDescription());
-// assertNotNull(((GenericAdapterSetDescription) a).getProtocolDescription());
-//
-// }
-//
-// @Test
-// public void getRuleDescription() throws AdapterException {
-// GenericAdapterStreamDescription genericAdapterStreamDescription = new GenericAdapterStreamDescription();
-//
-// JsonObjectFormat jsonObjectFormat = new JsonObjectFormat();
-// KafkaProtocol kafkaProtocol = new KafkaProtocol(new JsonObjectParser(), jsonObjectFormat, "URL", "broker");
-// UnitTransformRuleDescription unitTransformRuleDescription = new UnitTransformRuleDescription("key","Degree Celsius", "Kelvin");
-//
-// FormatDescription formatDescription = jsonObjectFormat.declareModel();
-// ProtocolDescription protocolDescription = kafkaProtocol.declareModel();
-//
-// genericAdapterStreamDescription.setProtocolDescription(protocolDescription);
-// genericAdapterStreamDescription.setFormatDescription(formatDescription);
-// genericAdapterStreamDescription.setRules(Collections.singletonList(unitTransformRuleDescription));
-//
-// String jsonLd = JsonLdUtils.toJsonLD(genericAdapterStreamDescription);
-//
-// AdapterDescription a = AdapterDeserializer.getAdapterDescription(jsonLd);
-//
-// assertEquals(1, (a.getRules().size()));
-// assertEquals("Degree Celsius", ((UnitTransformRuleDescription) (a).getRules().get(0)).getFromUnitRessourceURL());
-// assertEquals("Kelvin", ((UnitTransformRuleDescription) (a).getRules().get(0)).getToUnitRessourceURL());
-// }
-//
-// private String getGenericAdapterSetDescripionGeneratedByFrontend() {
-// return "{ \n"
-// + " \"@context\":{ \n"
-// + " \"sp\":\"https://streampipes.org/vocabulary/v1/\",\n"
-// + " \"spi\":\"urn:streampipes.org:spi:\",\n"
-// + " \"foaf\":\"http://xmlns.com/foaf/0.1/\"\n"
-// + " },\n"
-// + " \"@graph\":[ \n"
-// + " { \n"
-// + " \"@id\":\"http://streampipes.org/dataset/69165e7e-e837-2b48-455b-909be67abb7e\",\n"
-// + " \"@type\":\"sp:DataSet\"\n"
-// + " },\n"
-// + " { \n"
-// + " \"@id\":\"http://streampipes.org/genericadaptersetdescription\",\n"
-// + " \"@type\":\"sp:GenericAdapterSetDescription\",\n"
-// + " \"http://www.w3.org/2000/01/rdf-schema#description\":\"This is the description for the http protocol\",\n"
-// + " \"http://www.w3.org/2000/01/rdf-schema#label\":\"HTTP (Set)\",\n"
-// + " \"sp:config\":[ \n"
-// + "\n"
-// + " ],\n"
-// + " \"sp:hasDataSet\":{ \n"
-// + " \"@id\":\"http://streampipes.org/dataset/69165e7e-e837-2b48-455b-909be67abb7e\"\n"
-// + " },\n"
-// + " \"sp:hasFormat\":{ \n"
-// + " \"@id\":\"sp:format/xml\"\n"
-// + " },\n"
-// + " \"sp:hasProtocol\":{ \n"
-// + " \"@id\":\"sp:protocol/set/http\"\n"
-// + " },\n"
-// + " \"sp:hasUri\":\"http://streampipes.org/genericadaptersetdescription\"\n"
-// + " },\n"
-// + " { \n"
-// + " \"@id\":\"sp:format/xml\",\n"
-// + " \"@type\":\"sp:FormatDescription\",\n"
-// + " \"http://www.w3.org/2000/01/rdf-schema#description\":\"This is the description for the XML format\",\n"
-// + " \"http://www.w3.org/2000/01/rdf-schema#label\":\"XML\",\n"
-// + " \"sp:config\":{ \n"
-// + " \"@id\":\"spi:freetextstaticproperty:CEVrUb\"\n"
-// + " },\n"
-// + " \"sp:hasUri\":\"https://streampipes.org/vocabulary/v1/format/xml\"\n"
-// + " },\n"
-// + " { \n"
-// + " \"@id\":\"sp:protocol/set/http\",\n"
-// + " \"@type\":\"sp:ProtocolDescription\",\n"
-// + " \"http://www.w3.org/2000/01/rdf-schema#description\":\"This is the description for the http protocol\",\n"
-// + " \"http://www.w3.org/2000/01/rdf-schema#label\":\"HTTP (Set)\",\n"
-// + " \"sp:config\":{ \n"
-// + " \"@id\":\"spi:freetextstaticproperty:dbiWfF\"\n"
-// + " },\n"
-// + " \"sp:hasUri\":\"https://streampipes.org/vocabulary/v1/protocol/set/http\",\n"
-// + " \"sp:sourceType\":\"SET\"\n"
-// + " },\n"
-// + " { \n"
-// + " \"@id\":\"spi:freetextstaticproperty:CEVrUb\",\n"
-// + " \"@type\":\"sp:FreeTextStaticProperty\",\n"
-// + " \"http://www.w3.org/2000/01/rdf-schema#description\":\"The Tag name of the events\",\n"
-// + " \"http://www.w3.org/2000/01/rdf-schema#label\":\"Tag\",\n"
-// + " \"sp:hasValue\":\"asd\",\n"
-// + " \"sp:internalName\":\"tag\",\n"
-// + " \"sp:requiredDomainProperty\":\"\"\n"
-// + " },\n"
-// + " { \n"
-// + " \"@id\":\"spi:freetextstaticproperty:dbiWfF\",\n"
-// + " \"@type\":\"sp:FreeTextStaticProperty\",\n"
-// + " \"http://www.w3.org/2000/01/rdf-schema#description\":\"This property defines the URL for the http request.\",\n"
-// + " \"http://www.w3.org/2000/01/rdf-schema#label\":\"url\",\n"
-// + " \"sp:hasValue\":\"sdf\",\n"
-// + " \"sp:internalName\":\"url\",\n"
-// + " \"sp:requiredDomainProperty\":\"\"\n"
-// + " }\n"
-// + " ]\n"
-// + "}";
-// }
-}
\ No newline at end of file
diff --git a/streampipes-connect-container/src/test/java/org/streampipes/connect/utils/TestAdapterSerializer.java b/streampipes-connect-container/src/test/java/org/streampipes/connect/utils/TestAdapterSerializer.java
deleted file mode 100644
index a12a9d6..0000000
--- a/streampipes-connect-container/src/test/java/org/streampipes/connect/utils/TestAdapterSerializer.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.streampipes.connect.utils;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.apache.streampipes.model.connect.adapter.AdapterDescription;
-import org.apache.streampipes.model.connect.adapter.GenericAdapterStreamDescription;
-import org.apache.streampipes.model.connect.grounding.FormatDescription;
-import org.apache.streampipes.model.schema.EventProperty;
-import org.apache.streampipes.model.schema.EventPropertyPrimitive;
-import org.apache.streampipes.model.schema.EventSchema;
-import org.apache.streampipes.model.staticproperty.FreeTextStaticProperty;
-import org.apache.streampipes.serializers.json.GsonSerializer;
-
-import java.util.Arrays;
-
-public class TestAdapterSerializer {
-
- @Test
- public void testGenericAdapterStreamSerialization() {
- GenericAdapterStreamDescription desc = new GenericAdapterStreamDescription();
- FormatDescription formatDescription = new FormatDescription();
- formatDescription.addConfig(new FreeTextStaticProperty("internal-id", "test", "test"));
- desc.setFormatDescription(formatDescription);
-
- // Add _id field to json, probably there is a cleaner solution
- String serialized = (GsonSerializer.getAdapterGson().toJson(desc));
- serialized = serialized.substring(1);
- serialized = "{\"_id\": \"1\", \"_rev\": \"2\"," + serialized;
-
- AdapterDescription deserialized = GsonSerializer.getAdapterGson().fromJson(serialized, AdapterDescription.class);
- assertEquals(deserialized.getAdapterId(), "http://streampipes.org/genericadapterstreamdescription");
- }
-
- @Test
- public void testEventPropertySerialization() {
- EventSchema schema = new EventSchema();
- EventProperty primitive = new EventPropertyPrimitive();
- primitive.setRuntimeName("test");
- ((EventPropertyPrimitive) primitive).setRuntimeType("test");
- schema.setEventProperties(Arrays.asList(primitive));
- String serialized = GsonSerializer.getGson().toJson(primitive);
- System.out.println(serialized);
- }
-
-// @Test
-// public void testCouchDbSerialization() {
-// GenericAdapterStreamDescription desc = new GenericAdapterStreamDescription();
-//
-// new AdapterStorageImpl().storeAdapter(desc);
-//
-// AdapterDescription deserialized = new AdapterStorageImpl().getAllAdapters().get(0);
-// System.out.println(deserialized.getAdapterId());
-// }
-
-}
diff --git a/streampipes-container-extensions/src/main/java/org/apache/streampipes/container/extensions/ExtensionsModelSubmitter.java b/streampipes-container-extensions/src/main/java/org/apache/streampipes/container/extensions/ExtensionsModelSubmitter.java
index 0026618..15f7eb7 100644
--- a/streampipes-container-extensions/src/main/java/org/apache/streampipes/container/extensions/ExtensionsModelSubmitter.java
+++ b/streampipes-container-extensions/src/main/java/org/apache/streampipes/container/extensions/ExtensionsModelSubmitter.java
@@ -20,7 +20,7 @@ package org.apache.streampipes.container.extensions;
import org.apache.streampipes.connect.adapter.Adapter;
import org.apache.streampipes.connect.adapter.model.generic.Protocol;
import org.apache.streampipes.connect.container.worker.management.MasterRestClient;
-import org.apache.streampipes.connect.init.AdapterDeclarerSingleton;
+import org.apache.streampipes.connect.container.worker.init.AdapterDeclarerSingleton;
import org.apache.streampipes.container.init.DeclarersSingleton;
import org.apache.streampipes.container.init.ModelSubmitter;
import org.apache.streampipes.container.init.RunningInstances;
diff --git a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/impl/AbstractSharedRestInterface.java b/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/impl/AbstractSharedRestInterface.java
index 2687815..7c667ef 100644
--- a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/impl/AbstractSharedRestInterface.java
+++ b/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/impl/AbstractSharedRestInterface.java
@@ -30,15 +30,17 @@ public abstract class AbstractSharedRestInterface {
}
protected <T> Response badRequest(T entity) {
- return Response
- .status(400)
- .entity(entity)
- .build();
+ return error(entity, 400);
}
protected <T> Response serverError(T entity) {
+ return error(entity, 500);
+ }
+
+ protected <T> Response error(T entity,
+ Integer statusCode) {
return Response
- .status(500)
+ .status(statusCode)
.entity(entity)
.build();
}