summaryrefslogtreecommitdiffstats
path: root/sdnr
diff options
context:
space:
mode:
authorherbert <herbert.eiselt@highstreet-technologies.com>2019-12-14 00:22:47 +0100
committerherbert <herbert.eiselt@highstreet-technologies.com>2019-12-16 10:35:58 +0100
commit7ce54d65de834d2901285e152c42044e8136c473 (patch)
tree652e29e86489a9a5390db06a34c79833e0fda9b3 /sdnr
parentda4fd6169717cfa04d644d0af0d23dd089a6e373 (diff)
update old version
of apigateway common data-provider helpserver websocketmanager2 Issue-ID: SDNC-1005 Signed-off-by: herbert <herbert.eiselt@highstreet-technologies.com> Change-Id: I13990aa4329810bb7a7dd815e6149e9890617d07 Signed-off-by: herbert <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr')
-rw-r--r--sdnr/wt/apigateway/feature/pom.xml67
-rwxr-xr-xsdnr/wt/apigateway/installer/pom.xml208
-rwxr-xr-xsdnr/wt/apigateway/pom.xml13
-rw-r--r--sdnr/wt/apigateway/provider/pom.xml22
-rw-r--r--sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MsServlet.java21
-rw-r--r--sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java2
-rw-r--r--sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/DatabaseEntryProvider.java3
-rw-r--r--sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/DatabaseHttpClient.java6
-rw-r--r--sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/http/BaseHTTPClient.java307
-rw-r--r--sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseHttpClient.java17
-rw-r--r--sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestHttpClient.java17
-rw-r--r--sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestProperties.java19
-rw-r--r--sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestQueryCallback.java17
-rw-r--r--sdnr/wt/common/pom.xml8
-rw-r--r--sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/TestDbClient.java71
-rw-r--r--sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/TestDbRequests.java412
-rw-r--r--sdnr/wt/data-provider/database/pom.xml2
-rwxr-xr-xsdnr/wt/data-provider/database/src/main/resources/es-init.sh2
-rw-r--r--sdnr/wt/data-provider/database/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/test/TestDataMappings.java209
-rw-r--r--sdnr/wt/data-provider/database/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/test/TestYangGenSalMapping.java408
-rw-r--r--sdnr/wt/data-provider/provider/pom.xml2
-rw-r--r--sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java1453
-rw-r--r--sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestInitalMaintenanceObjectInDatabase.java34
-rw-r--r--sdnr/wt/helpserver/feature/pom.xml50
-rwxr-xr-xsdnr/wt/helpserver/installer/pom.xml209
-rwxr-xr-xsdnr/wt/helpserver/pom.xml40
-rw-r--r--sdnr/wt/helpserver/provider/pom.xml24
-rw-r--r--sdnr/wt/helpserver/provider/src/main/resources/help/meta.json62
-rw-r--r--sdnr/wt/pom.xml1
-rw-r--r--sdnr/wt/websocketmanager2/feature/pom.xml69
-rwxr-xr-xsdnr/wt/websocketmanager2/installer/pom.xml205
-rw-r--r--sdnr/wt/websocketmanager2/model/pom.xml27
-rwxr-xr-xsdnr/wt/websocketmanager2/pom.xml42
-rw-r--r--sdnr/wt/websocketmanager2/provider/pom.xml244
-rw-r--r--sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManagerProvider.java18
-rw-r--r--sdnr/wt/websocketmanager2/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml33
-rw-r--r--sdnr/wt/websocketmanager2/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml4
37 files changed, 3508 insertions, 840 deletions
diff --git a/sdnr/wt/apigateway/feature/pom.xml b/sdnr/wt/apigateway/feature/pom.xml
index 88ccad411..cb83b169e 100644
--- a/sdnr/wt/apigateway/feature/pom.xml
+++ b/sdnr/wt/apigateway/feature/pom.xml
@@ -22,41 +22,40 @@
-->
<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">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>single-feature-parent</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
-
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-apigateway-feature</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>feature</packaging>
-
- <name>ccsdk-features-sdnr-wt :: ${project.artifactId} :: feature</name>
-
- <dependencyManagement>
- <dependencies>
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>mdsal-artifacts</artifactId>
- <version>${odl.controller.mdsal.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-apigateway-feature</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>feature</packaging>
+ <name>ccsdk-features-sdnr-wt :: ${project.artifactId} :: feature</name>
+
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>single-feature-parent</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <dependencyManagement>
<dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>mdsal-artifacts</artifactId>
+ <version>${odl.controller.mdsal.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sdnr-wt-apigateway-provider</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <dependencies>
- </dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sdnr-wt-apigateway-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
</project>
diff --git a/sdnr/wt/apigateway/installer/pom.xml b/sdnr/wt/apigateway/installer/pom.xml
index cee4f7d1c..96888e243 100755
--- a/sdnr/wt/apigateway/installer/pom.xml
+++ b/sdnr/wt/apigateway/installer/pom.xml
@@ -1,115 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>odlparent-lite</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-apigateway-installer</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-apigateway-installer</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>pom</packaging>
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
- <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
+ <properties>
+ <application.name>sdnr-wt-apigateway</application.name>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
- <properties>
- <application.name>sdnr-wt-apigateway</application.name>
- <include.transitive.dependencies>false</include.transitive.dependencies>
- </properties>
+ <dependencies>
- <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>${application.name}-feature</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>features</classifier>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>${application.name}-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>${application.name}-feature</artifactId>
- <version>${project.version}</version>
- <type>xml</type>
- <classifier>features</classifier>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>${application.name}-provider</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+ </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>maven-repo-zip</id>
- <goals>
- <goal>single</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <attach>true</attach>
- <finalName>stage/${application.name}-${project.version}</finalName>
- <descriptors>
- <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
- </descriptors>
- <appendAssemblyId>true</appendAssemblyId>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <!-- <execution> -->
- <!-- <id>copy-dependencies</id> -->
- <!-- <goals> -->
- <!-- <goal>copy-dependencies</goal> -->
- <!-- </goals> -->
- <!-- <phase>prepare-package</phase> -->
- <!-- <configuration> -->
- <!-- <transitive>true</transitive> -->
- <!-- <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> -->
- <!-- <overWriteReleases>false</overWriteReleases> -->
- <!-- <overWriteSnapshots>true</overWriteSnapshots> -->
- <!-- <overWriteIfNewer>true</overWriteIfNewer> -->
- <!-- <useRepositoryLayout>true</useRepositoryLayout> -->
- <!-- <addParentPoms>false</addParentPoms> -->
- <!-- <copyPom>false</copyPom> -->
- <!-- <includeArtifactIds>sdnr-wt-apigateway-provider,${application.name}</includeArtifactIds> -->
- <!-- <scope>provided</scope> -->
- <!-- </configuration> -->
- <!-- </execution> -->
- <execution>
- <id>copy-nested-dependencies</id>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <phase>prepare-package</phase>
- <configuration>
- <transitive>true</transitive>
- <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- <useRepositoryLayout>true</useRepositoryLayout>
- <addParentPoms>false</addParentPoms>
- <copyPom>false</copyPom>
- <!--<includeArtifactIds>sdnr-wt-apigateway-provider,${application.name}</includeArtifactIds>-->
- <!--<scope>provided</scope>-->
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>maven-repo-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <attach>true</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ <appendAssemblyId>true</appendAssemblyId>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+<!-- <execution> -->
+<!-- <id>copy-dependencies</id> -->
+<!-- <goals> -->
+<!-- <goal>copy-dependencies</goal> -->
+<!-- </goals> -->
+<!-- <phase>prepare-package</phase> -->
+<!-- <configuration> -->
+<!-- <transitive>true</transitive> -->
+<!-- <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> -->
+<!-- <overWriteReleases>false</overWriteReleases> -->
+<!-- <overWriteSnapshots>true</overWriteSnapshots> -->
+<!-- <overWriteIfNewer>true</overWriteIfNewer> -->
+<!-- <useRepositoryLayout>true</useRepositoryLayout> -->
+<!-- <addParentPoms>false</addParentPoms> -->
+<!-- <copyPom>false</copyPom> -->
+<!-- <includeArtifactIds>sdnr-wt-apigateway-provider,${application.name}</includeArtifactIds> -->
+<!-- <scope>provided</scope> -->
+<!-- </configuration> -->
+<!-- </execution> -->
+ <execution>
+ <id>copy-nested-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <transitive>true</transitive>
+ <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <useRepositoryLayout>true</useRepositoryLayout>
+ <addParentPoms>false</addParentPoms>
+ <copyPom>false</copyPom>
+ <!--<includeArtifactIds>sdnr-wt-apigateway-provider,${application.name}</includeArtifactIds>-->
+ <!--<scope>provided</scope>-->
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/sdnr/wt/apigateway/pom.xml b/sdnr/wt/apigateway/pom.xml
index 8efdbc0c0..8189a2ce8 100755
--- a/sdnr/wt/apigateway/pom.xml
+++ b/sdnr/wt/apigateway/pom.xml
@@ -24,6 +24,12 @@
<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">
<modelVersion>4.0.0</modelVersion>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-apigateway-top</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
+
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
@@ -31,13 +37,6 @@
<relativePath/>
</parent>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-apigateway-top</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
-
<modules>
<module>feature</module>
<module>provider</module>
diff --git a/sdnr/wt/apigateway/provider/pom.xml b/sdnr/wt/apigateway/provider/pom.xml
index b4bbe1e56..a989874f8 100644
--- a/sdnr/wt/apigateway/provider/pom.xml
+++ b/sdnr/wt/apigateway/provider/pom.xml
@@ -11,27 +11,24 @@
OR CONDITIONS OF ANY KIND, either express or implied. * See the License for
the specific language governing permissions and * limitations under the License.
* ============LICENSE_END========================================================= -->
-<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">
- <modelVersion>4.0.0</modelVersion>
+<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/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>binding-parent</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
+ <modelVersion>4.0.0</modelVersion>
<groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
<artifactId>sdnr-wt-apigateway-provider</artifactId>
<version>0.7.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
<name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
-
+ <packaging>bundle</packaging>
<properties>
<checkstyle.skip>true</checkstyle.skip>
</properties>
-
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
@@ -52,7 +49,6 @@
</dependency>
</dependencies>
-
<build>
<plugins>
<!-- fixed bug for sonarcube -->
diff --git a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MsServlet.java b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MsServlet.java
index c0b6c99a2..aee7a3b09 100644
--- a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MsServlet.java
+++ b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MsServlet.java
@@ -38,14 +38,25 @@ public class MsServlet extends BaseServlet {
private static Logger LOG = LoggerFactory.getLogger(MsServlet.class);
private static final long serialVersionUID = -5361461082028405171L;
private static final String OFFLINE_RESPONSE_MESSAGE = "MediatorServer interface is offline";
- private static final String DATABASE_REQUEST_URI_REGEX = "/mwtn/mediator-server";
+ private static final String DATABASE_REQUEST_URI_REGEX = "/mediator-server/mediator-server";
private final DatabaseEntryProvider entryProvider;
+ private boolean isSecure;
+ public void setIsSecure(boolean secure) {
+ if(this.isSecure!=secure) {
+ this.isSecure=secure;
+ this.entryProvider.setBaseUrl(this.getDBBaseUrl());
+ }
+ }
public MsServlet() {
super();
- this.entryProvider = new DatabaseEntryProvider("http://localhost:9200/",60);
+ this.entryProvider = new DatabaseEntryProvider(this.getDBBaseUrl(),60);
EsServlet.registerRequestCallback(DATABASE_REQUEST_URI_REGEX, this.dbRequestCallback);
}
+ private String getDBBaseUrl() {
+ return MyProperties.getInstance().getEsBaseUrl();
+ }
+
private final IRequestCallback dbRequestCallback = new IRequestCallback() {
@Override
@@ -64,7 +75,11 @@ public class MsServlet extends BaseServlet {
protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setStatus(200);
}
-
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ super.doGet(req, resp);
+ this.isSecure=req.getScheme().equals("https");
+ }
@Override
protected String getOfflineResponse() {
return OFFLINE_RESPONSE_MESSAGE;
diff --git a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java
index 3d66f526e..36fce2081 100644
--- a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java
+++ b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java
@@ -40,7 +40,7 @@ public class MyProperties {
private static final String DEFAULT_AAI_HEADERS = "[\"X-FromAppId:SDNR\",\"Authorization:Basic QUFJOkFBSQ==\"]";
private static final String DEFAULT_CORSENABLED = "0";
private static final String DEFAULT_TRUSTINSECURE = "0";
- private static final String DEFAULT_ESDATABASE = "http://localhost:9200";
+ private static final String DEFAULT_ESDATABASE = "http://sdnrdb:9200";
private static final String DEFAULT_AAI = "off";
@Override
diff --git a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/DatabaseEntryProvider.java b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/DatabaseEntryProvider.java
index 086c3c977..b467e27a0 100644
--- a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/DatabaseEntryProvider.java
+++ b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/DatabaseEntryProvider.java
@@ -102,5 +102,8 @@ public class DatabaseEntryProvider implements AutoCloseable {
}
return s;
}
+ public void setBaseUrl(String baseUrl) {
+ this.httpClient.setBaseUrl(baseUrl);
+ }
}
diff --git a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/DatabaseHttpClient.java b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/DatabaseHttpClient.java
index af46509e9..d0f575362 100644
--- a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/DatabaseHttpClient.java
+++ b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/DatabaseHttpClient.java
@@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
public class DatabaseHttpClient extends BaseHTTPClient {
private static Logger LOG = LoggerFactory.getLogger(DatabaseHttpClient.class);
- private static final String URI = "/mwtn/mediator-server/_search";
+ private static final String URI = "/mediator-server/mediator-server/_search";
private final Map<String, String> headers;
public DatabaseHttpClient(String base, boolean trustAllCerts) {
@@ -44,7 +44,7 @@ public class DatabaseHttpClient extends BaseHTTPClient {
private Map<String, String> getHeaders() {
Map<String, String> h = new HashMap<String, String>();
-
+ h.put("Content-Type", "application/json");
return h;
}
@@ -80,4 +80,6 @@ public class DatabaseHttpClient extends BaseHTTPClient {
}
return entries;
}
+
+
}
diff --git a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/http/BaseHTTPClient.java b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/http/BaseHTTPClient.java
index f8f95b386..9c89eeff3 100644
--- a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/http/BaseHTTPClient.java
+++ b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/database/http/BaseHTTPClient.java
@@ -40,154 +40,161 @@ import org.slf4j.LoggerFactory;
public class BaseHTTPClient {
- private static Logger LOG = LoggerFactory.getLogger(BaseHTTPClient.class);
- private static final int BUFSIZE = 1024;
- private static final Charset CHARSET = StandardCharsets.UTF_8;
- private static final String SSLCONTEXT = "TLSv1.2";
- private static final int DEFAULT_HTTP_TIMEOUT_MS = 30000; // in ms
-
- private final boolean trustAll;
- private final String baseUrl;
-
- private int timeout = DEFAULT_HTTP_TIMEOUT_MS;
- private SSLContext sc = null;
-
- public BaseHTTPClient(String base) {
- this(base, false);
- }
-
-
- public BaseHTTPClient(String base, boolean trustAllCerts) {
- this.baseUrl = base;
- this.trustAll = trustAllCerts;
- try {
- sc = setupSsl(trustAll);
- } catch (KeyManagementException | NoSuchAlgorithmException e) {
- LOG.warn("problem ssl setup: " + e.getMessage());
- }
- }
-
- protected @Nonnull BaseHTTPResponse sendRequest(String uri, String method, String body, Map<String, String> headers)
- throws IOException {
- return this.sendRequest(uri, method, body != null ? body.getBytes(CHARSET) : null, headers);
- }
-
- protected @Nonnull BaseHTTPResponse sendRequest(String uri, String method, byte[] body, Map<String, String> headers)
- throws IOException {
- if (uri == null) {
- uri = "";
- }
- String surl = this.baseUrl;
- if (!surl.endsWith("/") && uri.length() > 0) {
- surl += "/";
- }
- if (uri.startsWith("/")) {
- uri = uri.substring(1);
- }
- surl += uri;
- LOG.debug("try to send request with url=" + this.baseUrl + uri + " as method=" + method);
- LOG.trace("body:" + (body == null ? "null" : new String(body, CHARSET)));
- URL url = new URL(surl);
- URLConnection http = url.openConnection();
- http.setConnectTimeout(this.timeout);
- if (surl.toString().startsWith("https")) {
- if (sc != null) {
- ((HttpsURLConnection) http).setSSLSocketFactory(sc.getSocketFactory());
- if (trustAll) {
- LOG.debug("trusting all certs");
- HostnameVerifier allHostsValid = (hostname, session) -> true;
- ((HttpsURLConnection) http).setHostnameVerifier(allHostsValid);
- }
- } else // Should never happen
- {
- LOG.warn("No SSL context available");
- return new BaseHTTPResponse(-1, "");
- }
- }
- ((HttpURLConnection) http).setRequestMethod(method);
- http.setDoOutput(true);
- if (headers != null && headers.size() > 0) {
- for (String key : headers.keySet()) {
- http.setRequestProperty(key, headers.get(key));
- LOG.trace("set http header " + key + ": " + headers.get(key));
- }
- }
- byte[] buffer = new byte[BUFSIZE];
- int len = 0, lensum = 0;
- // send request
- // Send the message to destination
- if (!method.equals("GET") && body != null && body.length > 0) {
- try (OutputStream output = http.getOutputStream()) {
- output.write(body);
- }
- }
- // Receive answer
- int responseCode = ((HttpURLConnection) http).getResponseCode();
- String sresponse = "";
- InputStream response = null;
- try {
- if (responseCode >= 200 && responseCode < 300) {
- response = http.getInputStream();
- } else {
- response = ((HttpURLConnection) http).getErrorStream();
- if (response == null) {
- response = http.getInputStream();
- }
- }
- if (response != null) {
- while (true) {
- len = response.read(buffer, 0, BUFSIZE);
- if (len <= 0) {
- break;
- }
- lensum += len;
- sresponse += new String(buffer, 0, len, CHARSET);
- }
- } else {
- LOG.debug("response is null");
- }
- } catch (Exception e) {
- LOG.debug("No response. ", e);
- } finally {
- if (response != null) {
- response.close();
- }
- }
- LOG.debug("ResponseCode: " + responseCode);
- LOG.trace("Response (len:{}): {}", String.valueOf(lensum), sresponse);
- return new BaseHTTPResponse(responseCode, sresponse);
- }
-
-
- public static SSLContext setupSsl(boolean trustall) throws KeyManagementException, NoSuchAlgorithmException{
-
- SSLContext sc = SSLContext.getInstance(SSLCONTEXT);
- TrustManager[] trustCerts = null;
- if (trustall) {
- trustCerts = new TrustManager[] {new javax.net.ssl.X509TrustManager() {
- @Override
- public java.security.cert.X509Certificate[] getAcceptedIssuers() {
- return null;
- }
-
- @Override
- public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {}
-
- @Override
- public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {}
- }};
-
- }
- KeyManager[] kms = null;
- // Init the SSLContext with a TrustManager[] and SecureRandom()
- sc.init(kms, trustCerts, new java.security.SecureRandom());
- return sc;
- }
-
- public static String getAuthorizationHeaderValue(String username, String password) {
- return "Basic " + new String(Base64.getEncoder().encode((username + ":" + password).getBytes()));
- }
-
-
-
+ private static Logger LOG = LoggerFactory.getLogger(BaseHTTPClient.class);
+ private static final int BUFSIZE = 1024;
+ private static final Charset CHARSET = StandardCharsets.UTF_8;
+ private static final String SSLCONTEXT = "TLSv1.2";
+ private static final int DEFAULT_HTTP_TIMEOUT_MS = 30000; // in ms
+
+ private final boolean trustAll;
+ private String baseUrl;
+
+ private int timeout = DEFAULT_HTTP_TIMEOUT_MS;
+ private SSLContext sc = null;
+
+ public BaseHTTPClient(String base) {
+ this(base, false);
+ }
+
+ public void setBaseUrl(String baseUrl) {
+ this.baseUrl = baseUrl;
+ try {
+ sc = setupSsl(trustAll);
+ } catch (KeyManagementException | NoSuchAlgorithmException e) {
+ LOG.warn("problem ssl setup: " + e.getMessage());
+ }
+ }
+
+ public BaseHTTPClient(String base, boolean trustAllCerts) {
+ this.baseUrl = base;
+ this.trustAll = trustAllCerts;
+ try {
+ sc = setupSsl(trustAll);
+ } catch (KeyManagementException | NoSuchAlgorithmException e) {
+ LOG.warn("problem ssl setup: " + e.getMessage());
+ }
+ }
+
+ protected @Nonnull BaseHTTPResponse sendRequest(String uri, String method, String body, Map<String, String> headers)
+ throws IOException {
+ return this.sendRequest(uri, method, body != null ? body.getBytes(CHARSET) : null, headers);
+ }
+
+ protected @Nonnull BaseHTTPResponse sendRequest(String uri, String method, byte[] body, Map<String, String> headers)
+ throws IOException {
+ if (uri == null) {
+ uri = "";
+ }
+ String surl = this.baseUrl;
+ if (!surl.endsWith("/") && uri.length() > 0) {
+ surl += "/";
+ }
+ if (uri.startsWith("/")) {
+ uri = uri.substring(1);
+ }
+ surl += uri;
+ LOG.debug("try to send request with url=" + this.baseUrl + uri + " as method=" + method);
+ LOG.trace("body:" + (body == null ? "null" : new String(body, CHARSET)));
+ URL url = new URL(surl);
+ URLConnection http = url.openConnection();
+ http.setConnectTimeout(this.timeout);
+ if (surl.toString().startsWith("https")) {
+ if (sc != null) {
+ ((HttpsURLConnection) http).setSSLSocketFactory(sc.getSocketFactory());
+ if (trustAll) {
+ LOG.debug("trusting all certs");
+ HostnameVerifier allHostsValid = (hostname, session) -> true;
+ ((HttpsURLConnection) http).setHostnameVerifier(allHostsValid);
+ }
+ } else // Should never happen
+ {
+ LOG.warn("No SSL context available");
+ return new BaseHTTPResponse(-1, "");
+ }
+ }
+ ((HttpURLConnection) http).setRequestMethod(method);
+ http.setDoOutput(true);
+ if (headers != null && headers.size() > 0) {
+ for (String key : headers.keySet()) {
+ http.setRequestProperty(key, headers.get(key));
+ LOG.trace("set http header " + key + ": " + headers.get(key));
+ }
+ }
+ byte[] buffer = new byte[BUFSIZE];
+ int len = 0, lensum = 0;
+ // send request
+ // Send the message to destination
+ if (!method.equals("GET") && body != null && body.length > 0) {
+ try (OutputStream output = http.getOutputStream()) {
+ output.write(body);
+ }
+ }
+ // Receive answer
+ int responseCode = ((HttpURLConnection) http).getResponseCode();
+ String sresponse = "";
+ InputStream response = null;
+ try {
+ if (responseCode >= 200 && responseCode < 300) {
+ response = http.getInputStream();
+ } else {
+ response = ((HttpURLConnection) http).getErrorStream();
+ if (response == null) {
+ response = http.getInputStream();
+ }
+ }
+ if (response != null) {
+ while (true) {
+ len = response.read(buffer, 0, BUFSIZE);
+ if (len <= 0) {
+ break;
+ }
+ lensum += len;
+ sresponse += new String(buffer, 0, len, CHARSET);
+ }
+ } else {
+ LOG.debug("response is null");
+ }
+ } catch (Exception e) {
+ LOG.debug("No response. ", e);
+ } finally {
+ if (response != null) {
+ response.close();
+ }
+ }
+ LOG.debug("ResponseCode: " + responseCode);
+ LOG.trace("Response (len:{}): {}", String.valueOf(lensum), sresponse);
+ return new BaseHTTPResponse(responseCode, sresponse);
+ }
+
+ public static SSLContext setupSsl(boolean trustall) throws KeyManagementException, NoSuchAlgorithmException {
+
+ SSLContext sc = SSLContext.getInstance(SSLCONTEXT);
+ TrustManager[] trustCerts = null;
+ if (trustall) {
+ trustCerts = new TrustManager[] { new javax.net.ssl.X509TrustManager() {
+ @Override
+ public java.security.cert.X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+
+ @Override
+ public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
+ }
+
+ @Override
+ public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
+ }
+ } };
+
+ }
+ KeyManager[] kms = null;
+ // Init the SSLContext with a TrustManager[] and SecureRandom()
+ sc.init(kms, trustCerts, new java.security.SecureRandom());
+ return sc;
+ }
+
+ public static String getAuthorizationHeaderValue(String username, String password) {
+ return "Basic " + new String(Base64.getEncoder().encode((username + ":" + password).getBytes()));
+ }
+
}
diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseHttpClient.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseHttpClient.java
index 795228834..791e9bad0 100644
--- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseHttpClient.java
+++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseHttpClient.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt
+ * =================================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * =================================================================================================
+ * Licensed 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.
+ * ============LICENSE_END==========================================================================
+ ******************************************************************************/
package org.onap.ccsdk.features.sdnr.wt.apigateway.test;
import static org.junit.Assert.*;
diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestHttpClient.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestHttpClient.java
index 6e21bc133..18e84853a 100644
--- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestHttpClient.java
+++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestHttpClient.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt
+ * =================================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * =================================================================================================
+ * Licensed 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.
+ * ============LICENSE_END==========================================================================
+ ******************************************************************************/
package org.onap.ccsdk.features.sdnr.wt.apigateway.test;
import static org.junit.Assert.fail;
diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestProperties.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestProperties.java
index 1a63240d8..6efd06feb 100644
--- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestProperties.java
+++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestProperties.java
@@ -27,6 +27,8 @@ import java.io.File;
import java.util.HashMap;
import java.util.Map;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.apigateway.MyProperties;
@@ -38,7 +40,7 @@ public class TestProperties {
private static final boolean DEFAULT_TRUSTINSECURE = false;
private static final String DEFAULT_AAIBASEURL = "off";
private static Map<String, String> DEFAULT_AAIHEADERS = new HashMap<String, String>();
- private static final String DEFAULT_ESBASEURL = "http://localhost:9200";
+ private static final String DEFAULT_ESBASEURL = "http://sdnrdb:9200";
private static final boolean CUSTOM_CORSENABLED = true;
private static final boolean CUSTOM_AAIOFF = false;
@@ -49,10 +51,18 @@ public class TestProperties {
private static final String CUSTOM_ESBASEURL = "http://localhost:9200";
private static final String LR = "\n";
-
+ final String tmpFilename = "tmp2.cfg";
+
+ @Before
+ @After
+ public void init() {
+ File f = new File(tmpFilename);
+ if(f.exists()) {
+ f.delete();
+ }
+ }
@Test
public void test() {
- final String tmpFilename = "tmp2.cfg";
DEFAULT_AAIHEADERS.put("X-FromAppId", "SDNR");
DEFAULT_AAIHEADERS.put("Authorization", "Basic QUFJOkFBSQ==");
CUSTOM_AAIHEADERS.put("X-FromAppId", "SDNC");
@@ -62,9 +72,6 @@ public class TestProperties {
+ "\"]" + LR + "database=" + CUSTOM_ESBASEURL + LR + "insecure=" + (CUSTOM_TRUSTINSECURE ? "1" : "0")
+ LR + "cors=" + (CUSTOM_CORSENABLED ? "1" : "0");
File ftest = new File(tmpFilename);
- // delete autogenerated testfile
- if (ftest.exists())
- ftest.delete();
MyProperties prop = null;
ftest = new File(tmpFilename);
try {
diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestQueryCallback.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestQueryCallback.java
index 78341dfad..3340ec66c 100644
--- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestQueryCallback.java
+++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestQueryCallback.java
@@ -1,3 +1,20 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt
+ * =================================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * =================================================================================================
+ * Licensed 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.
+ * ============LICENSE_END==========================================================================
+ ******************************************************************************/
package org.onap.ccsdk.features.sdnr.wt.apigateway.test;
import static org.junit.Assert.*;
diff --git a/sdnr/wt/common/pom.xml b/sdnr/wt/common/pom.xml
index 2254b78f1..dfefe1834 100644
--- a/sdnr/wt/common/pom.xml
+++ b/sdnr/wt/common/pom.xml
@@ -107,8 +107,9 @@
<goal>exec</goal>
</goals>
<configuration>
- <executable>${basedir}/../data-provider/database/src/main/resources/es-init.sh</executable>
+ <executable>bash</executable>
<arguments>
+ <argument>${basedir}/../data-provider/database/src/main/resources/es-init.sh</argument>
<argument>initfile</argument>
<argument>-f</argument>
<argument>${project.build.directory}/EsInit.script</argument>
@@ -122,11 +123,12 @@
<artifactId>elasticsearch-maven-plugin</artifactId>
<version>6.16</version>
<configuration>
- <skip>true</skip>
+ <skip>${skipTests}</skip>
<clusterName>testCluster</clusterName>
<transportPort>9500</transportPort>
<httpPort>${databaseport}</httpPort>
- <version>6.4.3</version>
+ <version>6.5.0</version>
+ <timeout>120</timeout>
<pathInitScript>${project.build.directory}/EsInit.script</pathInitScript>
</configuration>
<executions>
diff --git a/sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/TestDbClient.java b/sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/TestDbClient.java
new file mode 100644
index 000000000..0d46b4d20
--- /dev/null
+++ b/sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/TestDbClient.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt
+ * =================================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * =================================================================================================
+ * Licensed 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.
+ * ============LICENSE_END==========================================================================
+ ******************************************************************************/
+package org.onap.ccsdk.features.sdnr.wt.common.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.common.database.SearchHit;
+import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult;
+import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
+
+public class TestDbClient {
+
+ private static HtDatabaseClient dbClient;
+ private static HostInfo[] hosts = new HostInfo[] { new HostInfo("localhost", Integer
+ .valueOf(System.getProperty("databaseport") != null ? System.getProperty("databaseport") : "49200")) };
+
+ @BeforeClass
+ public static void init() {
+
+ dbClient = new HtDatabaseClient(hosts);
+ dbClient.waitForYellowStatus(20000);
+
+ }
+ @Test
+ public void testCRUD() {
+ final String IDX = "test23-knmoinsd";
+ final String ID = "abcddd";
+ final String JSON = "{\"data\":{\"inner\":\"more\"}}";
+ final String JSON2 = "{\"data\":{\"inner\":\"more2\"}}";
+ //Create
+ String esId=dbClient.doWriteRaw(IDX, ID, JSON);
+ assertEquals("inserted id is wrong",ID,esId);
+ //Read
+ SearchResult<SearchHit> result = dbClient.doReadByQueryJsonData(IDX, QueryBuilders.matchQuery("_id", ID));
+ assertEquals("amount of results is wrong",1,result.getTotal());
+ assertEquals("data not valid", JSON,result.getHits().get(0).getSourceAsString());
+ //Update
+ esId= dbClient.doUpdateOrCreate(IDX, ID, JSON2);
+ assertEquals("update response not successfull",ID,esId);
+ //Verify
+ result = dbClient.doReadByQueryJsonData( IDX, QueryBuilders.matchQuery("_id", ID));
+ assertEquals("amount of results is wrong",1,result.getTotal());
+ assertEquals("data not valid", JSON2,result.getHits().get(0).getSourceAsString());
+ //Delete
+ boolean del=dbClient.doRemove(IDX, ID);
+ assertTrue("item not deleted",del);
+ //Verify
+ result = dbClient.doReadByQueryJsonData(IDX, QueryBuilders.matchQuery("_id", ID));
+ assertEquals("amount of results is wrong",0,result.getTotal());
+ }
+
+}
diff --git a/sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/TestDbRequests.java b/sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/TestDbRequests.java
new file mode 100644
index 000000000..36bbebefd
--- /dev/null
+++ b/sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/TestDbRequests.java
@@ -0,0 +1,412 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt
+ * =================================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * =================================================================================================
+ * Licensed 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.
+ * ============LICENSE_END==========================================================================
+ ******************************************************************************/
+package org.onap.ccsdk.features.sdnr.wt.common.test;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.ClusterHealthRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.CreateIndexRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.DeleteByQueryRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.DeleteIndexRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.DeleteRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.GetRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.IndexRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.NodeStatsRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.RefreshIndexRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.SearchRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.UpdateByQueryRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.UpdateRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.ClusterHealthResponse;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.CreateIndexResponse;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.DeleteByQueryResponse;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.DeleteIndexResponse;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.DeleteResponse;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.GetResponse;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.IndexResponse;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.NodeStatsResponse;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.SearchResponse;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.UpdateByQueryResponse;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.UpdateResponse;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class TestDbRequests {
+
+ private static HtDatabaseClient dbClient;
+ private static HostInfo[] hosts = new HostInfo[] { new HostInfo("localhost", Integer
+ .valueOf(System.getProperty("databaseport") != null ? System.getProperty("databaseport") : "49200")) };
+
+ @BeforeClass
+ public static void init() {
+
+ dbClient = new HtDatabaseClient(hosts);
+
+ }
+ @AfterClass
+ public static void deinit() {
+ if(dbClient!=null) {
+ dbClient.close();
+ }
+ }
+ @Test
+ public void testHealth() {
+
+ ClusterHealthResponse response = null;
+ ClusterHealthRequest request = new ClusterHealthRequest();
+ request.timeout(10);
+ try {
+ response = dbClient.health(request);
+ } catch (UnsupportedOperationException | IOException | JSONException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull("response is null", response);
+ assertTrue(response.isStatusMinimal(ClusterHealthResponse.HEALTHSTATUS_YELLOW));
+ }
+
+ @Test
+ public void testCount() {
+
+ }
+
+ @Test
+ public void testCreateAndDeleteIndex() {
+ final String IDX = "testcidx1";
+ CreateIndexRequest request = new CreateIndexRequest(IDX);
+ CreateIndexResponse response = null;
+ try {
+ response = dbClient.createIndex(request);
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull(response);
+
+ assertTrue("index not existing", dbClient.isExistsIndex(IDX));
+
+ DeleteIndexRequest request2 = new DeleteIndexRequest(IDX);
+
+ DeleteIndexResponse response2 = null;
+ try {
+ response2 = dbClient.deleteIndex(request2);
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull(response2);
+ assertFalse("index still existing", dbClient.isExistsIndex(IDX));
+ this.deleteIndex(IDX);
+ }
+
+ @Test
+ public void testInsertAndDelete() {
+ final String IDX = "test23-knmoinsd";
+ final String ID = "abcddd";
+ final String JSON = "{\"data\":{\"inner\":\"more\"}}";
+ this.insert(IDX, ID, JSON);
+ // delete data
+ DeleteRequest request2 = new DeleteRequest(IDX, IDX, ID);
+ DeleteResponse response2 = null;
+ try {
+ response2 = dbClient.delete(request2);
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull(response2);
+ assertTrue(response2.isDeleted());
+ try {
+ dbClient.refreshIndex(new RefreshIndexRequest(IDX));
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ // verify data deleted
+ GetRequest request4 = new GetRequest(IDX, IDX, ID);
+ GetResponse response4 = null;
+ try {
+ response4 = dbClient.get(request4);
+ } catch (IOException e1) {
+ fail(e1.getMessage());
+ }
+ assertNotNull(response4);
+ assertFalse("data still existing", response4.isExists());
+ this.deleteIndex(IDX);
+ }
+
+ @Test
+ public void testInsertAndDeleteByQuery() {
+ final String IDX = "test34-knmoinsd";
+ final String ID = "abcdddseae";
+ final String JSON = "{\"data\":{\"inner\":\"more\"}}";
+ this.insert(IDX, ID, JSON);
+
+ // delete data
+ DeleteByQueryRequest request2 = new DeleteByQueryRequest(IDX);
+ request2.source(QueryBuilders.matchQuery("_id", ID));
+ DeleteByQueryResponse response2 = null;
+ try {
+ response2 = dbClient.deleteByQuery(request2);
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull(response2);
+ assertTrue(response2.isResponseSucceeded());
+ try {
+ dbClient.refreshIndex(new RefreshIndexRequest(IDX));
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ // verify data deleted
+ GetRequest request4 = new GetRequest(IDX, IDX, ID);
+ GetResponse response4 = null;
+ try {
+ response4 = dbClient.get(request4);
+ } catch (IOException e1) {
+ fail(e1.getMessage());
+ }
+ assertNotNull(response4);
+ assertFalse("data still existing", response4.isExists());
+ this.deleteIndex(IDX);
+ }
+
+ private void insert(String IDX, String ID, String JSON) {
+
+ // create data
+ IndexRequest request = new IndexRequest(IDX, IDX, ID);
+ request.source(JSON);
+ IndexResponse response = null;
+ try {
+ response = dbClient.index(request);
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull(response);
+ if (ID != null) {
+ assertEquals("id not correct", ID, response.getId());
+ } else {
+ ID = response.getId();
+ }
+ // do db refresh
+ try {
+ dbClient.refreshIndex(new RefreshIndexRequest(IDX));
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ // verify data exists
+ GetRequest request3 = new GetRequest(IDX, IDX, ID);
+ GetResponse response3 = null;
+ try {
+ response3 = dbClient.get(request3);
+ } catch (IOException e1) {
+ fail(e1.getMessage());
+ }
+ assertNotNull(response3);
+ JSONAssert.assertEquals("could not verify update", JSON, response3.getSourceAsBytesRef(), true);
+ }
+
+ @Test
+ public void testSearch() {
+ final String IDX = "test44-moinsd";
+ final String ID = "abe";
+ final String JSON = "{\"data\":{\"inner\":\"more\"}}";
+ final String ID2 = "abe2";
+ final String JSON2 = "{\"data\":{\"inner\":\"more2\"}}";
+ final String ID3 = "abe3";
+ final String JSON3 = "{\"data\":{\"inner\":\"more3\"}}";
+ this.insert(IDX, ID, JSON);
+ this.insert(IDX, ID2, JSON2);
+ this.insert(IDX, ID3, JSON3);
+ SearchRequest request = new SearchRequest(IDX, IDX);
+ request.setQuery(QueryBuilders.matchAllQuery());
+ SearchResponse response = null;
+ try {
+ response = dbClient.search(request);
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull(response);
+ assertEquals("not all items found", 3, response.getHits().length);
+ assertEquals("incorrect index",IDX,response.getHits()[0].getIndex());
+ assertEquals("incorrect type",IDX,response.getHits()[0].getType());
+ this.deleteIndex(IDX);
+ }
+
+ @Test
+ public void testUpdate() {
+ final String IDX = "test4534-moinsd";
+ final String ID = "assbe";
+ final String JSON = "{\"data\":{\"inner\":\"more\"}}";
+ final String JSON2 = "{\"data\":{\"inner\":\"more2\"},\"data2\":\"value2\",\"data3\":true}";
+
+ this.insert(IDX, ID, JSON);
+ UpdateRequest request = new UpdateRequest(IDX, IDX, ID);
+ UpdateResponse response = null;
+ try {
+ request.source(new JSONObject(JSON2));
+ response = dbClient.update(request);
+ } catch (JSONException | IOException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull(response);
+ assertTrue(response.succeeded());
+ // refresh index
+ try {
+ dbClient.refreshIndex(new RefreshIndexRequest(IDX));
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ // verify update
+ GetRequest request3 = new GetRequest(IDX, IDX, ID);
+ GetResponse response3 = null;
+ try {
+ response3 = dbClient.get(request3);
+ } catch (IOException e1) {
+ fail(e1.getMessage());
+ }
+ assertNotNull(response3);
+ JSONAssert.assertEquals("could not verify update", JSON2, response3.getSourceAsBytesRef(), true);
+ this.deleteIndex(IDX);
+ }
+
+ @Test
+ public void testUpdateByQuery() {
+ final String IDX = "test224534-moinsd";
+ final String ID = "asssabe";
+ final String JSON = "{\"data\":{\"inner\":\"more\"}}";
+ final String JSON2 = "{\"data\":{\"inner\":\"more2\"},\"data2\":\"value2\",\"data3\":true}";
+
+ this.insert(IDX, ID, JSON);
+ UpdateByQueryRequest request = new UpdateByQueryRequest(IDX, IDX);
+ UpdateByQueryResponse response = null;
+ try {
+ request.source(ID, new JSONObject(JSON2));
+ response = dbClient.update(request);
+ } catch (JSONException | IOException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull(response);
+ assertTrue(response.isUpdated());
+ // refresh index
+ try {
+ dbClient.refreshIndex(new RefreshIndexRequest(IDX));
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ // verify update
+ GetRequest request3 = new GetRequest(IDX, IDX, ID);
+ GetResponse response3 = null;
+ try {
+ response3 = dbClient.get(request3);
+ } catch (IOException e1) {
+ fail(e1.getMessage());
+ }
+ assertNotNull(response3);
+ JSONAssert.assertEquals("could not verify update", JSON2, response3.getSourceAsBytesRef(), true);
+ this.deleteIndex(IDX);
+ }
+
+ @Test
+ public void testAggregations() {
+ final String IDX = "test3227533677-moisnsd";
+ final String JSON = "{ \"node-id\":\"sim1\",\"severity\":\"critical\"}";
+ final String JSON2 = "{ \"node-id\":\"sim2\",\"severity\":\"critical\"}";
+ final String JSON3 = "{ \"node-id\":\"sim3\",\"severity\":\"minor\"}";
+ final String JSON4 = "{ \"node-id\":\"sim4\",\"severity\":\"warning\"}";
+ final String JSON5 = "{ \"node-id\":\"sim5\",\"severity\":\"major\"}";
+ final String MAPPINGS = "{\""+IDX+"\":{\"properties\":{\"node-id\": {\"type\": \"keyword\"},\"severity\": {\"type\": \"keyword\"}}}}";
+ //create index with mapping keyword
+ CreateIndexRequest irequest = new CreateIndexRequest(IDX);
+ irequest.mappings(new JSONObject(MAPPINGS));
+ CreateIndexResponse iresponse = null;
+ try {
+ iresponse = dbClient.createIndex(irequest);
+ } catch (IOException e1) {
+ fail("unable to create index: "+e1.getMessage());
+ }
+ assertNotNull(iresponse);
+ assertTrue(iresponse.isAcknowledged());
+ // fill index
+ this.insert(IDX, null, JSON);
+ this.insert(IDX, null, JSON2);
+ this.insert(IDX, null, JSON3);
+ this.insert(IDX, null, JSON4);
+ this.insert(IDX, null, JSON5);
+ // refresh index
+ try {
+ dbClient.refreshIndex(new RefreshIndexRequest(IDX));
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+
+ SearchRequest request = new SearchRequest(IDX, IDX);
+ request.setQuery(QueryBuilders.matchAllQuery().aggregations("severity").size(0));
+ SearchResponse response = null;
+ try {
+ response = dbClient.search(request);
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull(response);
+ assertTrue(response.hasAggregations());
+ assertEquals("aggregation size not correct", 4, response.getAggregations("severity").size());
+
+ List<String> items1 = Arrays.asList(response.getAggregations("severity").getKeysAsPagedStringList(2, 0));
+ List<String> items2 = Arrays.asList(response.getAggregations("severity").getKeysAsPagedStringList(2, 2));
+ assertEquals("pagination does not work", 2,items1.size());
+ assertEquals("pagination does not work", 2,items2.size());
+ for(String s:items1) {
+ assertFalse("pagination overlap is not allowed",items2.contains(s));
+ }
+ for(String s:items2) {
+ assertFalse("pagination overlap is not allowed",items1.contains(s));
+ }
+
+ this.deleteIndex(IDX);
+ }
+
+ @Test
+ public void testStatistics() {
+ NodeStatsResponse stats=null;
+ try {
+ stats = dbClient.stats(new NodeStatsRequest());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull(stats);
+ System.out.println(stats.getNodesInfo());
+ System.out.println(stats.getNodeStatistics());
+ }
+ private void deleteIndex(String idx) {
+ try {
+ dbClient.deleteIndex( new DeleteIndexRequest(idx));
+ } catch (IOException e) {
+
+ }
+ }
+
+}
diff --git a/sdnr/wt/data-provider/database/pom.xml b/sdnr/wt/data-provider/database/pom.xml
index 444cd59bf..ce4b29152 100644
--- a/sdnr/wt/data-provider/database/pom.xml
+++ b/sdnr/wt/data-provider/database/pom.xml
@@ -128,7 +128,7 @@
<artifactId>elasticsearch-maven-plugin</artifactId>
<version>6.16</version>
<configuration>
- <skip>true</skip>
+ <skip>${skipTests}</skip>
<clusterName>testCluster</clusterName>
<transportPort>9500</transportPort>
<httpPort>${databaseport}</httpPort>
diff --git a/sdnr/wt/data-provider/database/src/main/resources/es-init.sh b/sdnr/wt/data-provider/database/src/main/resources/es-init.sh
index 0b122c060..68e6e8488 100755
--- a/sdnr/wt/data-provider/database/src/main/resources/es-init.sh
+++ b/sdnr/wt/data-provider/database/src/main/resources/es-init.sh
@@ -270,6 +270,8 @@ cmd_initfile() {
echo "Create script initfile: $INITFILENAME"
if [ -f "$INITFILENAME" ] ; then
rm $INITFILENAME
+ else
+ mkdir -p $( dirname $INITFILENAME )
fi
for i in "${!ALIAS[@]}"; do
create_index_alias "${ALIAS[$i]}" "${MAPPING[$i]}" file
diff --git a/sdnr/wt/data-provider/database/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/test/TestDataMappings.java b/sdnr/wt/data-provider/database/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/test/TestDataMappings.java
new file mode 100644
index 000000000..1dc02b92f
--- /dev/null
+++ b/sdnr/wt/data-provider/database/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/test/TestDataMappings.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt
+ * =================================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * =================================================================================================
+ * Licensed 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.
+ * ============LICENSE_END==========================================================================
+ ******************************************************************************/
+package org.onap.ccsdk.features.sdnr.wt.dataprovider.database.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.database.DatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.common.database.SearchHit;
+import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult;
+import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.SearchResponse;
+import org.onap.ccsdk.features.sdnr.wt.database.EsDataObjectReaderWriter;
+import org.onap.ccsdk.features.sdnr.wt.yangtools.YangToolsMapper;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+public class TestDataMappings {
+
+ private static final HostInfo[] HOSTINFOS = new HostInfo[] {HostInfo.getDefault()};
+ //public static final String ESDATATYPENAME = "faultcurrent";
+
+ private static class HtDatabaseClientHelper extends HtDatabaseClient {
+
+ private final String json;
+
+ public HtDatabaseClientHelper(String jsonResponse, HostInfo[] hosts) {
+ super(hosts);
+ this.json = jsonResponse;
+
+ }
+
+ @Override
+ public SearchResult<SearchHit> doReadByQueryJsonData(String dataTypeName, QueryBuilder qb) {
+ return new SearchResult<SearchHit>(new SearchResponse(this.json).getHits());
+ }
+ }
+
+ private static class MapResult<T extends DataObject> {
+ public final List<T> mappedData;
+ public MapResult(String dataType, Class<T> cls, String dbJson) throws ClassNotFoundException {
+ System.out.println(dbJson);
+ DatabaseClient db = new HtDatabaseClientHelper(dbJson,HOSTINFOS);
+ EsDataObjectReaderWriter<T> dbrw=new EsDataObjectReaderWriter<T>(db,dataType,cls);
+ this.mappedData=dbrw.doReadAll().getHits();
+ }
+ }
+
+ private static final String SEARCHJSON_FORMAT = "{\n" +
+ "\"took\": 0,\n" +
+ "\"timed_out\": false,\n" +
+ "\"_shards\": {\n" +
+ "\"total\": 5,\n" +
+ "\"successful\": 5,\n" +
+ "\"skipped\": 0,\n" +
+ "\"failed\": 0\n" +
+ "},\n" +
+ "\"hits\": {\n" +
+ "\"total\": 1,\n" +
+ "\"max_score\": 1,\n" +
+ "\"hits\": [\n" +
+ "{\n" +
+ "\"_index\": \"%s\",\n" +
+ "\"_type\": \"%s\",\n" +
+ "\"_id\": \"%s\",\n" +
+ "\"_score\": 1,\n" +
+ "\"_source\": %s}\n" +
+ "]\n" +
+ "}\n" +
+ "}";
+
+ private static final String MEDIATORSERVER_DB_ID="LumwSG0BFvcE3yf8MBM5";
+ private static final String MEDIATOR_SERVERDB_JSON = "{\"url\":\"https://10.45.44.223:7590\",\"name\":\"test mediator server\"}";
+
+ private static final String FAULTCURRENT_DB_ID="LumwSG0BFvcE3yf8MBM5";
+ private static final String FAULTCURRENT_DB_NODEID = "sim1";
+ private static final int FAULTCURRENT_DB_COUNTER = 3;
+ private static final String FAULTCURRENT_DB_OBJECTID = "LPS-MWT-01";
+ private static final String FAULTCURRENT_DB_PROBLEM = "rlsExceeded";
+ private static final String FAULTCURRENT_DB_SEVERITY = "critical";
+ private static final DateAndTime FAULTCURRENT_DB_TIMESTAMP = DateAndTime.getDefaultInstance("2019-09-18T13:07:05.8Z");
+
+ private static final String FAULTCURRENT_SERVERDB_JSON = "{\"node-id\":\""+FAULTCURRENT_DB_NODEID+"\","+
+ "\"counter\":"+FAULTCURRENT_DB_COUNTER+","+
+ "\"object-id\":\""+FAULTCURRENT_DB_OBJECTID+"\","+
+ "\"problem\":\""+FAULTCURRENT_DB_PROBLEM+"\","+
+ "\"timestamp\":\""+FAULTCURRENT_DB_TIMESTAMP.getValue()+"\","+
+ "\"severity\":\""+FAULTCURRENT_DB_SEVERITY+"\""+
+ "}";
+
+
+ private static final String PMDATA15M_SERVERDB_JSON="{\n" +
+ "\"node-name\": \"sim2\",\n" +
+ "\"uuid-interface\": \"LP-MWPS-TTP-01\",\n" +
+ "\"layer-protocol-name\": \"MWPS\",\n" +
+ "\"radio-signal-id\": \"Test11\",\n" +
+ "\"time-stamp\": \"2017-07-04T14:00:00.0Z\",\n" +
+ "\"granularity-period\": \"PERIOD_15MIN\",\n" +
+ "\"scanner-id\": \"PM_RADIO_15M_9\",\n" +
+ "\"performance-data\": {\n" +
+ "\"es\": 0,\n" +
+ "\"rx-level-avg\": -41,\n" +
+ "\"time2-states\": -1,\n" +
+ "\"time4-states-s\": 0,\n" +
+ "\"time4-states\": 0,\n" +
+ "\"time8-states\": 0,\n" +
+ "\"time16-states-s\": -1,\n" +
+ "\"time16-states\": 0,\n" +
+ "\"time32-states\": 0,\n" +
+ "\"time64-states\": 0,\n" +
+ "\"time128-states\": 0,\n" +
+ "\"time256-states\": 900,\n" +
+ "\"time512-states\": -1,\n" +
+ "\"time512-states-l\": -1,\n" +
+ "\"time1024-states\": -1,\n" +
+ "\"time1024-states-l\": -1,\n" +
+ "\"time2048-states\": -1,\n" +
+ "\"time2048-states-l\": -1,\n" +
+ "\"time4096-states\": -1,\n" +
+ "\"time4096-states-l\": -1,\n" +
+ "\"time8192-states\": -1,\n" +
+ "\"time8192-states-l\": -1,\n" +
+ "\"snir-min\": -99,\n" +
+ "\"snir-max\": -99,\n" +
+ "\"snir-avg\": -99,\n" +
+ "\"xpd-min\": -99,\n" +
+ "\"xpd-max\": -99,\n" +
+ "\"xpd-avg\": -99,\n" +
+ "\"rf-temp-min\": -99,\n" +
+ "\"rf-temp-max\": -99,\n" +
+ "\"rf-temp-avg\": -99,\n" +
+ "\"defect-blocks-sum\": -1,\n" +
+ "\"time-period\": 900,\n" +
+ "\"tx-level-min\": 25,\n" +
+ "\"tx-level-max\": 25,\n" +
+ "\"tx-level-avg\": 25,\n" +
+ "\"rx-level-min\": -41,\n" +
+ "\"rx-level-max\": -41,\n" +
+ "\"unavailability\": 0,\n" +
+ "\"ses\": 0,\n" +
+ "\"cses\": 0\n" +
+ "},\n" +
+ "\"suspect-interval-flag\": false\n" +
+ "}";
+
+ //@Test
+// public void testMediatorServer() throws ClassNotFoundException {
+//
+// MapResult<EsMediatorServer> result = new MapResult<EsMediatorServer>(EsMediatorServer.ESDATATYPENAME,
+// EsMediatorServer.class,
+// getSearchJson(EsMediatorServer.ESDATATYPENAME,MEDIATORSERVER_DB_ID,MEDIATOR_SERVERDB_JSON));
+// assertEquals("test mediator server", result.mappedData.get(0).getName());
+// assertEquals("https://10.45.44.223:7590", result.mappedData.get(0).getUrl());
+// assertEquals(MEDIATORSERVER_DB_ID, result.mappedData.get(0).getId());
+//
+// }
+ //@Test
+// public void testFaultCurrent() {
+//
+// MapResult<FaultcurrentEntity> result = new MapResult<FaultcurrentEntity>(ESDATATYPENAME, EsFaultCurrent.class,
+// getSearchJson(ESDATATYPENAME, FAULTCURRENT_DB_ID, FAULTCURRENT_SERVERDB_JSON));
+// assertEquals(FAULTCURRENT_DB_ID, result.mappedData.get(0).getId());
+// assertEquals(FAULTCURRENT_DB_NODEID, result.mappedData.get(0).getNodeId());
+// assertEquals(FAULTCURRENT_DB_COUNTER, result.mappedData.get(0).getCounter().intValue());
+// assertEquals(FAULTCURRENT_DB_OBJECTID, result.mappedData.get(0).getObjectId());
+// assertEquals(FAULTCURRENT_DB_PROBLEM, result.mappedData.get(0).getProblem());
+// assertEquals(FAULTCURRENT_DB_SEVERITY, result.mappedData.get(0).getSeverity());
+// assertEquals(FAULTCURRENT_DB_TIMESTAMP, result.mappedData.get(0).getTimestamp());
+// }
+//
+ @Test
+ public void testPmData15m() {
+
+ YangToolsMapper mapper = new YangToolsMapper();
+ try {
+ Data data =mapper.readValue(PMDATA15M_SERVERDB_JSON.getBytes(), Data.class);
+ System.out.println(data);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+
+ }
+ private String getSearchJson(String dataType,String dbId, String source) {
+ return String.format(SEARCHJSON_FORMAT,dataType,dataType, dbId,source);
+ }
+
+}
diff --git a/sdnr/wt/data-provider/database/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/test/TestYangGenSalMapping.java b/sdnr/wt/data-provider/database/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/test/TestYangGenSalMapping.java
new file mode 100644
index 000000000..666061425
--- /dev/null
+++ b/sdnr/wt/data-provider/database/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/test/TestYangGenSalMapping.java
@@ -0,0 +1,408 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt
+ * =================================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * =================================================================================================
+ * Licensed 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.
+ * ============LICENSE_END==========================================================================
+ ******************************************************************************/
+package org.onap.ccsdk.features.sdnr.wt.dataprovider.database.test;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.json.JSONObject;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.database.DatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.common.database.InvalidProtocolException;
+import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult;
+import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo;
+import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo.Protocol;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.BoolQueryBuilder;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
+import org.onap.ccsdk.features.sdnr.wt.database.EsDataObjectReaderWriter;
+import org.onap.ccsdk.features.sdnr.wt.yangtools.YangToolsMapper;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.parameters.OdlHelloMessageCapabilitiesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPasswordBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateMediatorServerInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Entity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EntityInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata15mListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata15mListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata15mListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SortOrder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.Filter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.PaginationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.Sortorder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.pmdata15m.entity.PerformanceDataBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.DataBuilder;
+import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+public class TestYangGenSalMapping {
+
+ // Create mapper for serialization and deserialization
+ YangToolsMapper mapper = new YangToolsMapper();
+
+ @Test
+ public void test1() throws IOException {
+
+ // Create test object
+ NetconfNodeBuilder netconfNodeBuilder = new NetconfNodeBuilder();
+ netconfNodeBuilder.setConnectedMessage("ConnMessage");
+
+ LoginPasswordBuilder loginPasswordBuilder = new LoginPasswordBuilder();
+ loginPasswordBuilder.setUsername("myTestUsername");
+ loginPasswordBuilder.setPassword("myTestPassword");
+ netconfNodeBuilder.setCredentials(loginPasswordBuilder.build());
+
+ OdlHelloMessageCapabilitiesBuilder odlHelloMessageCapabilitiesBuilder = new OdlHelloMessageCapabilitiesBuilder();
+ List<Uri> uriList = new ArrayList<>();
+ uriList.add( new Uri("test.uri") );
+ odlHelloMessageCapabilitiesBuilder.setCapability(uriList);
+ netconfNodeBuilder.setOdlHelloMessageCapabilities(odlHelloMessageCapabilitiesBuilder.build());
+
+ NetconfNode netconfNode = netconfNodeBuilder.build();
+ out(netconfNode.toString());
+
+ // Map Object to JSON String
+ String res = mapper.writeValueAsString(netconfNode);
+ JSONObject json = new JSONObject(res); // Convert text to object
+ out(json.toString(4)); // Print it with specified indentation
+
+ // Map to JSON String to Object
+ NetconfNode generatedNode = mapper.readValue(res.getBytes(), NetconfNode.class);
+ out(generatedNode.toString()); // Print it with specified indentation
+ // Compare result
+ out("Equal? "+(netconfNode.equals(generatedNode)));
+ }
+
+ static class TestDataObjectBuilder implements Builder<TestDataObject> {
+ @Override
+ public @NonNull TestDataObject build() throws IllegalArgumentException {
+ return new TestDataObject();
+ }
+ }
+
+ static class TestDataObject implements DataObject {
+ String test;
+
+ @Override
+ public Class<? extends DataContainer> getImplementedInterface() {
+ return null;
+ }
+ }
+
+ @Test
+ public void test2() throws InvalidProtocolException, ClassNotFoundException {
+
+
+ int databasePort = Integer.valueOf(System.getProperty("databaseport"));
+ System.out.println("DB Port: "+databasePort);
+
+ HostInfo[] HOSTINFOS = new HostInfo[] { new HostInfo("localhost", databasePort )};
+ DatabaseClient db = new HtDatabaseClient(HOSTINFOS);
+
+ EsDataObjectReaderWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.Data> dataRW =
+ new EsDataObjectReaderWriter<>(db, "inventorytest", org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.Data.class);
+
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.Data d1;
+ d1 = getInventoryDataBuilder("MyDescription", 23L).build();
+ String id = dataRW.write(d1,null);
+
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.Data d2;
+ d2 = dataRW.read(id);
+
+ out(d2.toString());
+
+ }
+
+ @Test
+ public void test3() throws IOException {
+
+ PerformanceDataBuilder performanceBuilder = new PerformanceDataBuilder();
+ performanceBuilder.setEs(99);
+ DataBuilder pmData15MinutesBuilder = new DataBuilder();
+ pmData15MinutesBuilder.setLayerProtocolName("fdsaf");
+ pmData15MinutesBuilder.setTimeStamp(new DateAndTime("2017-03-01T09:15:00.0Z"));
+ pmData15MinutesBuilder.setPerformanceData(performanceBuilder.build());
+
+ // Map Object to JSON String
+ String res = mapper.writeValueAsString(pmData15MinutesBuilder.build());
+ JSONObject json = new JSONObject(res); // Convert text to object
+ out(json.toString(4)); // Print it with specified indentation
+
+ // Map to JSON String to Object
+ Data generatedNode = mapper.readValue(res.getBytes(), Data.class);
+ out(generatedNode.toString()); // Print it with specified indentation
+ }
+
+ @Test
+ public void test4() throws IOException {
+
+ String jsonString = "{\n" + "\"node-name\": \"Sim2230\",\n" + "\"uuid-interface\": \"LP-MWPS-TTP-RADIO\",\n"
+ + "\"layer-protocol-name\": \"MWPS\",\n" + "\"radio-signal-id\": \"Test8\",\n"
+ + "\"time-stamp\": \"2017-03-01T09:15:00.0Z\",\n" + "\"granularity-period\": \"PERIOD_15MIN\",\n"
+ + "\"scanner-id\": \"PM_RADIO_15M_4\",\n" + "\"performance-data\": {\n" + "\"unavailability\": 0,\n"
+ + "\"tx-level-max\": 3,\n" + "\"tx-level-avg\": 3,\n" + "\"rx-level-min\": -44,\n"
+ + "\"rx-level-max\": -45,\n" + "\"rx-level-avg\": -44,\n" + "\"time2-states\": 0,\n"
+ + "\"time4-states-s\": 0,\n" + "\"time4-states\": 0,\n" + "\"time8-states\": -1,\n"
+ + "\"time16-states-s\": -1,\n" + "\"time16-states\": 0,\n" + "\"time32-states\": -1,\n"
+ + "\"time64-states\": 900,\n" + "\"time128-states\": -1,\n" + "\"time256-states\": -1,\n"
+ + "\"time512-states\": -1,\n" + "\"time512-states-l\": -1,\n" + "\"time1024-states\": -1,\n"
+ + "\"time1024-states-l\": -1,\n" + "\"time8192-states-l\": -1,\n" + "\"time8192-states\": -1,\n"
+ + "\"time2048-states\": -1,\n" + "\"snir-min\": -99,\n" + "\"snir-max\": -99,\n"
+ + "\"snir-avg\": -99,\n" + "\"xpd-min\": -99,\n" + "\"xpd-max\": -99,\n" + "\"xpd-avg\": -99,\n"
+ + "\"rf-temp-min\": -99,\n" + "\"rf-temp-max\": -99,\n" + "\"rf-temp-avg\": -99,\n"
+ + "\"defect-blocks-sum\": -1,\n" + "\"time-period\": 900,\n" + "\"cses\": 0,\n"
+ + "\"time4096-states-l\": -1,\n" + "\"tx-level-min\": 3,\n" + "\"es\": 0,\n"
+ + "\"time2048-states-l\": -1,\n" + "\"time4096-states\": -1,\n" + "\"ses\": 0\n" + "},\n"
+ + "\"suspect-interval-flag\": false\n" + "}\n" + "}";
+ // Map to JSON String to Object
+ Data generatedNode = mapper.readValue(jsonString.getBytes(), Data.class);
+ out(generatedNode.toString()); // Print it with specified indentation
+
+ }
+
+
+ @Test
+ public void test5() throws IOException {
+ String jsonString = "{\n" +
+ " \"time-stamp\": \"2017-03-01T06:45:00.0Z\",\n" +
+ " \"node-name\": \"Sim2230\",\n" +
+ " \"uuid-interface\": \"LP-MWPS-TTP-RADIO\",\n" +
+ " \"scanner-id\": \"PM_RADIO_15M_14\",\n" +
+ " \"layer-protocol-name\": \"MWPS\",\n" +
+ " \"granularity-period\": \"PERIOD_15MIN\",\n" +
+ " \"radio-signal-id\": \"Test8\",\n" +
+ " \"suspect-interval-flag\": false,\n" +
+ " \"performance-data\": {\n" +
+ " \"time4096-states-l\": -1,\n" +
+ " \"time16-states-s\": -1,\n" +
+ " \"tx-level-max\": 3,\n" +
+ " \"snir-max\": -99,\n" +
+ " \"time16-states\": 0,\n" +
+ " \"time64-states\": 900,\n" +
+ " \"unavailability\": 0,\n" +
+ " \"time8192-states-l\": -1,\n" +
+ " \"time512-states\": -1,\n" +
+ " \"xpd-min\": -99,\n" +
+ " \"xpd-avg\": -99,\n" +
+ " \"tx-level-avg\": 3,\n" +
+ " \"tx-level-min\": 3,\n" +
+ " \"rf-temp-min\": -99,\n" +
+ " \"rf-temp-avg\": -99,\n" +
+ " \"snir-avg\": -99,\n" +
+ " \"snir-min\": -99,\n" +
+ " \"time-period\": 900,\n" +
+ " \"time2-states\": 0,\n" +
+ " \"time4-states\": 0,\n" +
+ " \"time8-states\": -1,\n" +
+ " \"ses\": 0,\n" +
+ " \"time2048-states-l\": -1,\n" +
+ " \"time2048-states\": -1,\n" +
+ " \"xpd-max\": -99,\n" +
+ " \"rf-temp-max\": -99,\n" +
+ " \"time8192-states\": -1,\n" +
+ " \"time128-states\": -1,\n" +
+ " \"time256-states\": -1,\n" +
+ " \"rx-level-min\": -44,\n" +
+ " \"rx-level-avg\": -44,\n" +
+ " \"time1024-states-l\": -1,\n" +
+ " \"es\": 0,\n" +
+ " \"cses\": 0,\n" +
+ " \"time4-states-s\": 0,\n" +
+ " \"time1024-states\": -1,\n" +
+ " \"time512-states-l\": -1,\n" +
+ " \"time4096-states\": -1,\n" +
+ " \"rx-level-max\": -45,\n" +
+ " \"defect-blocks-sum\": -1,\n" +
+ " \"time32-states\": -1\n" +
+ " }\n" +
+ "}";
+
+ // Map to JSON String to Object
+ Data generatedNode = mapper.readValue(jsonString.getBytes(), Data.class);
+ out(generatedNode.toString()); // Print it with specified indentation
+
+ }
+
+
+ @Test
+ public void test6() throws IOException, ClassNotFoundException {
+ out(method());
+ HtDatabaseClient dbClient = new HtDatabaseClient(new HostInfo[] { new HostInfo("sdnrdb", 9200, Protocol.HTTP) });
+ String PMDATA15M_TYPE = "historicalperformance15min";
+
+ EsDataObjectReaderWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data> pm15mRW =
+ new EsDataObjectReaderWriter<>(dbClient, PMDATA15M_TYPE, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data.class);
+ pm15mRW.setEsIdAttributeName("_nodeName");
+
+ ReadPmdata15mListInputBuilder inputBuilder = new ReadPmdata15mListInputBuilder();
+ PaginationBuilder paginationBuilder = new PaginationBuilder();
+ paginationBuilder.setPage(new BigInteger("1"));
+ paginationBuilder.setSize(20L);
+ inputBuilder.setPagination(paginationBuilder.build());
+
+ ReadPmdata15mListInput input = inputBuilder.build();
+
+
+ ReadPmdata15mListOutputBuilder outputBuilder = new ReadPmdata15mListOutputBuilder();
+ long page = getPage(input);
+ long pageSize = getPageSize(input);
+
+ QueryBuilder query = fromFilter(input.getFilter()).from((page - 1) * pageSize).size(pageSize);
+ setSortOrder(query, input.getSortorder());
+
+ SearchResult<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data> result=pm15mRW.doReadAll(query);
+
+ out("Found: "+result.getHits().size());
+ int t=0;
+ for (Data hit : result.getHits()) {
+ out("Hit "+(t++)+":"+hit);
+ }
+ setPagination(outputBuilder, page, pageSize, result.getTotal());
+ outputBuilder.setData(result.getHits());
+ }
+
+ @Test
+ public void test7() throws IOException, ClassNotFoundException {
+ out(method());
+ String ESDATATYPE_MEDIATORSERVER = Entity.MediatorServer.getName();
+ HtDatabaseClient dbClient = new HtDatabaseClient(new HostInfo[] { new HostInfo("sdnrdb", 9200, Protocol.HTTP) });
+ EsDataObjectReaderWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.mediator.server.list.output.Data> mediatorserverRW;
+
+ mediatorserverRW = new EsDataObjectReaderWriter<>(dbClient, ESDATATYPE_MEDIATORSERVER,
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.mediator.server.list.output.Data.class)
+ .setWriteInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.MediatorServerEntity.class)
+ .setEsIdAttributeName("_id");
+
+ CreateMediatorServerInputBuilder inputBuilder = new CreateMediatorServerInputBuilder();
+ inputBuilder.setName("Hans");
+ inputBuilder.setUrl("MyGreatUrl");
+
+ String id = mediatorserverRW.write(inputBuilder.build(),"testid");
+ System.out.println(id);
+
+ }
+
+ @Test
+ public void test8() throws IOException {
+ out(method());
+ String input;
+ input = "id-dd-dd";
+ System.out.println("Map " + input + " to "+YangToolsMapper.toCamelCaseAttributeName(input));
+ input = "idDdGg";
+ System.out.println("Map " + input + " to "+YangToolsMapper.toCamelCaseAttributeName(input));
+ input = "_idDdGg";
+ System.out.println("Map " + input + " to "+YangToolsMapper.toCamelCaseAttributeName(input));
+ input = "--ff--gfg";
+ System.out.println("Map " + input + " to "+YangToolsMapper.toCamelCaseAttributeName(input));
+ input = "";
+ System.out.println("Map " + input + " to "+YangToolsMapper.toCamelCaseAttributeName(input));
+ }
+
+ /* ---------------------------------
+ * Private
+ */
+ private static String method() {
+ String nameofCurrMethod = new Throwable().getStackTrace()[1].getMethodName();
+ return nameofCurrMethod;
+ }
+
+ private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.DataBuilder getInventoryDataBuilder(String description, long treeLevel) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.DataBuilder dataBuilder =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.DataBuilder();
+ dataBuilder.setDescription(description);
+ dataBuilder.setTreeLevel(treeLevel);
+ return dataBuilder;
+ }
+
+
+ private static void out(String text) {
+ System.out.println("----------------------");
+ System.out.println(text);
+ }
+
+ private static long getPage(EntityInput input) {
+ return getPage(input, 1);
+ }
+
+ private static long getPage(EntityInput input, long defaultValue) {
+ return input.getPagination() != null ? input.getPagination().getPage().longValue() : defaultValue;
+ }
+
+ private static long getPageSize(EntityInput input) {
+ return getPageSize(input, 1);
+ }
+
+ private static long getPageSize(EntityInput input, long defaultValue) {
+ return input.getPagination() != null ? input.getPagination().getSize().longValue() : defaultValue;
+ }
+
+ private static QueryBuilder fromFilter(@Nullable List<Filter> filters) {
+ return fromFilter(filters, "");
+ }
+
+ private static QueryBuilder fromFilter(@Nullable List<Filter> filters, String prefix) {
+ if (filters == null || filters.size() == 0) {
+ return QueryBuilders.matchAllQuery();
+
+ } else if(filters.size()==1){
+ return QueryBuilders.matchQuery(filters.get(0).getProperty(), filters.get(0).getFiltervalue());
+ }
+ else {
+ BoolQueryBuilder query = new BoolQueryBuilder();
+ for (Filter fi : filters) {
+ query.must(QueryBuilders.matchQuery((prefix != null ? prefix : "") + fi.getProperty(),
+ fi.getFiltervalue()));
+ }
+ return query;
+ }
+
+ }
+ private static QueryBuilder setSortOrder(QueryBuilder query, @Nullable List<Sortorder> sortorder) {
+ return setSortOrder(query, sortorder, "");
+ }
+
+ private static QueryBuilder setSortOrder(QueryBuilder query, @Nullable List<Sortorder> sortorder, String prefix) {
+ if (sortorder != null && sortorder.size() > 0) {
+ for (Sortorder so : sortorder) {
+ query.sort((prefix != null ? prefix : "") + so.getProperty(),
+ so.getSortorder() == SortOrder.Ascending
+ ? org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder.ASCENDING
+ : org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder.DESCENDING);
+ }
+ }
+ return query;
+
+ }
+
+ private static void setPagination(ReadPmdata15mListOutputBuilder outputBuilder, long page, long pageSize, long totalSize) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Pagination value = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.PaginationBuilder()
+ .setPage(BigInteger.valueOf(page)).setSize(pageSize).setTotal(BigInteger.valueOf(totalSize)).build();
+ outputBuilder.setPagination(value);
+ }
+
+}
diff --git a/sdnr/wt/data-provider/provider/pom.xml b/sdnr/wt/data-provider/provider/pom.xml
index 2c1978ba4..b21d2f991 100644
--- a/sdnr/wt/data-provider/provider/pom.xml
+++ b/sdnr/wt/data-provider/provider/pom.xml
@@ -145,7 +145,7 @@
<artifactId>elasticsearch-maven-plugin</artifactId>
<version>6.16</version>
<configuration>
- <skip>true</skip>
+ <skip>${skipTests}</skip>
<clusterName>testCluster</clusterName>
<transportPort>9500</transportPort>
<httpPort>${databaseport}</httpPort>
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java
new file mode 100644
index 000000000..f1d512530
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java
@@ -0,0 +1,1453 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt
+ * =================================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * =================================================================================================
+ * Licensed 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.
+ * ============LICENSE_END==========================================================================
+ ******************************************************************************/
+
+package org.onap.ccsdk.features.sdnr.wt.dataprovider.test;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.common.database.SearchHit;
+import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult;
+import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.BaseRequest;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.ElasticSearchDataProvider;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateMaintenanceInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateMaintenanceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateMaintenanceOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateMediatorServerInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateMediatorServerInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateMediatorServerOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateNetworkElementConnectionInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateNetworkElementConnectionInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateNetworkElementConnectionOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.DeleteMaintenanceInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.DeleteMaintenanceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.DeleteMediatorServerInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.DeleteMediatorServerInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.DeleteNetworkElementConnectionInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.DeleteNetworkElementConnectionInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Entity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadConnectionlogListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadConnectionlogListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadConnectionlogListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadEventlogListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadEventlogListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadEventlogListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadFaultcurrentListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadFaultcurrentListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadFaultcurrentListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadFaultlogListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadFaultlogListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadFaultlogListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadInventoryListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadInventoryListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadInventoryListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadMaintenanceListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadMaintenanceListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadMaintenanceListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadMediatorServerListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadMediatorServerListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadMediatorServerListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadNetworkElementConnectionListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadNetworkElementConnectionListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadNetworkElementConnectionListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata15mDeviceListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata15mDeviceListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata15mDeviceListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata15mListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata15mListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata15mListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata15mLtpListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata15mLtpListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata15mLtpListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata24hDeviceListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata24hDeviceListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata24hDeviceListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata24hListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata24hListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata24hListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata24hLtpListInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata24hLtpListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ReadPmdata24hLtpListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.UpdateMaintenanceInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.UpdateMaintenanceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.UpdateMaintenanceOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.UpdateMediatorServerInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.UpdateMediatorServerInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.UpdateMediatorServerOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.UpdateNetworkElementConnectionInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.UpdateNetworkElementConnectionInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.UpdateNetworkElementConnectionOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.FilterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.Pagination;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.PaginationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.mediator.server.list.output.Data;
+
+public class TestCRUDforDatabase {
+
+ private static ElasticSearchDataProvider dbProvider;
+ private static HtDatabaseClient dbRawProvider;
+ private static HostInfo[] hosts = new HostInfo[] { new HostInfo("localhost", Integer
+ .valueOf(System.getProperty("databaseport") != null ? System.getProperty("databaseport") : "49200")) };
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ dbProvider = new ElasticSearchDataProvider(hosts);
+ dbProvider.waitForYellowDatabaseStatus(30, TimeUnit.SECONDS);
+ dbRawProvider = new HtDatabaseClient(hosts);
+ }
+
+ private static void trySleep(long ms) {
+ try {
+ Thread.sleep(ms);
+ } catch (Exception e) {
+ Thread.interrupted();
+ }
+ }
+
+ private static void trySleep() {
+ trySleep(0);
+ }
+
+ @Test
+ public void testStatus() throws IOException {
+
+ //== CLEAR AND CREATE ================================
+ clearAndCreatefaultEntity("1", Entity.Faultcurrent.getName(), "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateFaultcurrentInput", SeverityType.Critical);
+ createFaultEntity("Lorem Ipsum", Entity.Faultcurrent.getName(), "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateFaultcurrentInput", SeverityType.Major);
+ createFaultEntity("3", Entity.Faultcurrent.getName(), "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateFaultcurrentInput", SeverityType.Minor);
+ createFaultEntity("4", Entity.Faultcurrent.getName(), "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateFaultcurrentInput", SeverityType.Warning);
+
+ //== READ ================================
+
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.status.output.Data> readOutput = dbProvider.readStatus().getData();
+ System.out.println(readOutput);
+
+ assertEquals(1,readOutput.get(0).getFaults().getMajors().intValue());
+ assertEquals(1,readOutput.get(0).getFaults().getMinors().intValue());
+ assertEquals(1,readOutput.get(0).getFaults().getWarnings().intValue());
+ assertEquals(1,readOutput.get(0).getFaults().getCriticals().intValue());
+
+ //== DELETE ================================
+
+ System.out.println("try to delete entries");
+ try {
+ dbRawProvider.doRemove(Entity.Faultcurrent.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting entry: " + e.getMessage());
+ }
+
+ //== VERIFY DELETE ===========================
+ System.out.println("verify entries were deleted");
+ readOutput = dbProvider.readStatus().getData();
+ assertEquals(0,readOutput.get(0).getFaults().getMajors().intValue());
+ assertEquals(0,readOutput.get(0).getFaults().getMinors().intValue());
+ assertEquals(0,readOutput.get(0).getFaults().getWarnings().intValue());
+ assertEquals(0,readOutput.get(0).getFaults().getCriticals().intValue());
+ }
+
+ @Test
+ public void testMediatorServer() {
+ final String NAME = "ms1";
+ final String URL = "http://11.23.45.55:4599";
+ final String NAME2 = "ms1-nu";
+ final String URL2 = "http://11.23.45.56:4599";
+
+ // ==CLEAR BEFORE TEST============================
+ System.out.println("try to clear entry");
+ try {
+ dbRawProvider.doRemove(Entity.MediatorServer.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting entry: " + e.getMessage());
+ }
+ trySleep();
+ // ==CREATE============================
+ System.out.println("try to create entry");
+ CreateMediatorServerOutputBuilder createOutput = null;
+ CreateMediatorServerInput input = new CreateMediatorServerInputBuilder().setName(NAME).setUrl(URL).build();
+ String dbId = null;
+
+ try {
+ createOutput = dbProvider.createMediatorServer(input);
+ dbId = createOutput.getId();
+ System.out.println(createOutput);
+ } catch (Exception e) {
+ fail("failed to create " + input.toString() + ":" + e.getMessage());
+ }
+ assertNotNull(createOutput);
+ assertNotNull(dbId);
+ trySleep();
+ // ==READ===========================
+ System.out.println("try to read entry");
+ ReadMediatorServerListInput readinput = new ReadMediatorServerListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("id").setFiltervalue(dbId).build()))
+ .setPagination(getPagination(20, 1)).build();
+ ReadMediatorServerListOutputBuilder readoutput = dbProvider.readMediatorServerList(readinput);
+ List<Data> data = readoutput.getData();
+ assertNotNull(data);
+ assertEquals("no entry found", 1, data.size());
+ assertEquals(NAME, data.get(0).getName());
+ assertEquals(URL, data.get(0).getUrl());
+ String dbId2 = data.get(0).getId();
+ assertEquals(dbId, dbId2);
+ System.out.println(data);
+ // ==UPDATE============================
+ System.out.println("try to update entry");
+ UpdateMediatorServerInput updateInput = new UpdateMediatorServerInputBuilder().setId(dbId2).setName(NAME2)
+ .setUrl(URL2).build();
+ UpdateMediatorServerOutputBuilder updateOutput = null;
+ try {
+ updateOutput = dbProvider.updateMediatorServer(updateInput);
+ System.out.println(updateOutput);
+ } catch (Exception e) {
+ fail("problem updating entry:" + e.getMessage());
+ }
+ assertNotNull(updateOutput);
+ trySleep();
+ // ==READ============================
+ System.out.println("try to read entry");
+ readinput = new ReadMediatorServerListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("name").setFiltervalue(NAME2).build()))
+ .setPagination(getPagination(20, 1)).build();
+ readoutput = dbProvider.readMediatorServerList(readinput);
+ data = readoutput.getData();
+ System.out.println(data);
+ assertNotNull("no update response", data);
+ assertEquals("update not verifiied", 1, data.size());
+ assertEquals("update not verifiied", NAME2, data.get(0).getName());
+ assertEquals("update not verifiied", URL2, data.get(0).getUrl());
+ assertEquals("update not verifiied", dbId, data.get(0).getId());
+ // ==DELETE============================
+ System.out.println("try to delete entry");
+ DeleteMediatorServerInput deleteInput = new DeleteMediatorServerInputBuilder().setId(dbId).build();
+ try {
+ dbProvider.deleteMediatorServer(deleteInput);
+ } catch (Exception e) {
+ fail("problem deleting entry: " + e.getMessage());
+ }
+
+ trySleep();
+ // ==READ/VERIFY DELETE============================
+ System.out.println("try to read entry");
+ readinput = new ReadMediatorServerListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("name").setFiltervalue(NAME2).build()))
+ .setPagination(getPagination(20, 1)).build();
+ readoutput = dbProvider.readMediatorServerList(readinput);
+ data = readoutput.getData();
+ assertNotNull("delete not verifiied", data);
+ assertEquals("delete not verifiied", 0, data.size());
+ }
+
+ @Test
+ public void testNetworkElementConnectionCurrent() {
+
+ System.out.println("networkElementConnection test start");
+
+ // ==CLEAR BEFORE TEST============================
+ System.out.println("try to clear entry");
+ try {
+ dbRawProvider.doRemove(Entity.NetworkelementConnection.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting entry: " + e.getMessage());
+ }
+
+ // ==CREATE============================
+ System.out.println("try to create");
+ final String name = "sim87";
+ final String url = "10.5.10.1";
+ final long port = 5959;
+
+ CreateNetworkElementConnectionOutputBuilder create = null;
+ CreateNetworkElementConnectionInput input = new CreateNetworkElementConnectionInputBuilder().setNodeId(name)
+ .setIsRequired(true).setHost(url).setPort(port).build();
+ String dbId = null;
+
+ try {
+ create = dbProvider.createNetworkElementConnection(input);
+ dbId = create.getId();
+ } catch (Exception e) {
+ fail("networkElementConnection create failed" + e.getMessage());
+ }
+
+ assertNotNull(dbId);
+ assertNotNull(create);
+
+ // ==READ===========================
+
+ ReadNetworkElementConnectionListInput readInput = new ReadNetworkElementConnectionListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("id").setFiltervalue(dbId).build()))
+ .setPagination(getPagination(20, 1)).build();
+
+ ReadNetworkElementConnectionListOutputBuilder readOperation = dbProvider
+ .readNetworkElementConnectionList(readInput);
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.network.element.connection.list.output.Data> data = readOperation
+ .getData();
+
+ assertNotNull(data);
+ assertEquals(dbId, data.get(0).getId());
+ assertEquals(name, data.get(0).getNodeId());
+ assertEquals(url, data.get(0).getHost());
+ assertEquals(port, data.get(0).getPort().longValue());
+
+ // ==UPDATE============================
+ System.out.println("Trying to update...");
+ final String name2 = "sim88";
+ final String url2 = "10.5.10.2";
+ final long port2 = 5960;
+
+ UpdateNetworkElementConnectionInput updateInput = new UpdateNetworkElementConnectionInputBuilder().setId(dbId).setHost(url2).setPort(port2).setIsRequired(false).build();
+ UpdateNetworkElementConnectionOutputBuilder updateOutput = null;
+ try {
+ updateOutput = dbProvider.updateNetworkElementConnection(updateInput);
+ } catch (Exception e) {
+ fail("update failed: " + e.getMessage());
+ }
+
+ assertNotNull(updateOutput);
+
+ // == Verify UPDATE============================
+ System.out.println("Verfiying update...");
+
+ readOperation = dbProvider.readNetworkElementConnectionList(readInput);
+ data = readOperation.getData();
+
+ assertNotNull(data);
+ assertEquals(url2, data.get(0).getHost());
+ assertEquals(port2, data.get(0).getPort().longValue());
+
+ // ==PARTIAL UPDATE============================
+ System.out.println("Try partial update...");
+ assertEquals(false, data.get(0).isIsRequired());
+ updateInput = new UpdateNetworkElementConnectionInputBuilder().setId(dbId).setIsRequired(true).build();
+ try {
+ updateOutput = dbProvider.updateNetworkElementConnection(updateInput);
+ } catch (Exception e) {
+ fail("update failed: " + e.getMessage());
+ }
+
+ assertNotNull(updateOutput);
+
+ readOperation = dbProvider.readNetworkElementConnectionList(readInput);
+ data = readOperation.getData();
+
+ assertEquals(true, data.get(0).isIsRequired());
+ assertEquals(url2, data.get(0).getHost());
+ assertEquals(port2, data.get(0).getPort().longValue());
+
+ // ==DELETE============================
+ System.out.println("Try delete...");
+
+ DeleteNetworkElementConnectionInput deleteInput = new DeleteNetworkElementConnectionInputBuilder().setId(dbId)
+ .build();
+ try {
+ dbProvider.deleteNetworkElementConnection(deleteInput);
+ } catch (Exception e) {
+ fail("problem deleting "+e.getMessage());
+ }
+
+ readInput = new ReadNetworkElementConnectionListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("id").setFiltervalue(dbId).build()))
+ .setPagination(getPagination(20, 1)).build();
+ readOperation = dbProvider.readNetworkElementConnectionList(readInput);
+ data = readOperation.getData();
+ assertEquals(0, data.size());
+
+ }
+
+ @Test
+ public void testMaintenance() {
+ System.out.println("Starting Maintenance tests...");
+
+ // ==CLEAR BEFORE TEST============================
+ System.out.println("try to clear entry");
+ try {
+ dbRawProvider.doRemove(Entity.Maintenancemode.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting entry: " + e.getMessage());
+ }
+
+ // ==CREATE============================
+
+ final String nodeId = "Lorem Ipsum";
+ final boolean isActive = true;
+
+ CreateMaintenanceOutputBuilder create = null;
+ CreateMaintenanceInput input = new CreateMaintenanceInputBuilder().setNodeId(nodeId).setActive(isActive)
+ .build();
+ String dbId = null;
+ try {
+ create = dbProvider.createMaintenance(input);
+ dbId = create.getId();
+ } catch (Exception e) {
+ fail("Failed to create:" + e.getMessage());
+ }
+
+ System.out.println(dbId);
+ assertNotNull(create);
+ assertNotNull(dbId);
+
+ // ==READ===========================
+ System.out.println("Try read...");
+
+ ReadMaintenanceListInput readinput = new ReadMaintenanceListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("id").setFiltervalue(dbId).build()))
+ .setPagination(getPagination(20, 1)).build();
+ ReadMaintenanceListOutputBuilder readResult = dbProvider.readMaintenanceList(readinput);
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.maintenance.list.output.Data> data = readResult
+ .getData();
+
+ assertNotEquals(0, data.size());
+ assertNotNull(data);
+ assertEquals(nodeId, data.get(0).getNodeId());
+ assertEquals(isActive, data.get(0).isActive());
+
+ // ==UPDATE============================
+
+ System.out.println("Trying to update...");
+ final String nodeId2 = "Name2";
+ final boolean isActive2 = false;
+
+ UpdateMaintenanceInput updateInput = new UpdateMaintenanceInputBuilder().setId(dbId).setNodeId(nodeId2)
+ .setActive(isActive2).build();
+ UpdateMaintenanceOutputBuilder updateResult = null;
+ try {
+ updateResult = dbProvider.updateMaintenance(updateInput);
+ } catch (Exception e) {
+ fail("maintenance update failed..." + e.getMessage());
+ }
+
+ assertNotNull(updateResult);
+
+ // == VERIFY UPDATE============================
+ System.out.println("Verfify update...");
+ readResult = dbProvider.readMaintenanceList(readinput);
+ data = readResult.getData();
+
+ assertNotNull(data);
+ assertEquals(nodeId2, data.get(0).getNodeId());
+ assertEquals(isActive2, data.get(0).isActive());
+
+ // ==DELETE================================
+ System.out.println("Trying to delete...");
+
+ DeleteMaintenanceInput deleteInput = new DeleteMaintenanceInputBuilder().setId(dbId).build();
+ try {
+ dbProvider.deleteMaintenance(deleteInput);
+ } catch (Exception e) {
+ fail("Maintenance entry couldn't be deleted" + e.getMessage());
+ }
+
+ readResult = dbProvider.readMaintenanceList(readinput);
+ data = readResult.getData();
+
+ assertEquals(0, data.size());
+ }
+
+ @Test
+ public void testFaultLog() {
+
+ System.out.println("Starting fault log tests...");
+ String dbId = clearAndCreatefaultEntity("1", Entity.Faultlog.getName(), "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateFaultlogInput", SeverityType.Critical);
+
+ // ==READ===========================
+ System.out.println("try to read entry");
+
+ ReadFaultlogListInput readinput = new ReadFaultlogListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("id").setFiltervalue(dbId).build()))
+ .setPagination(getPagination(20, 1)).build();
+
+ ReadFaultlogListOutputBuilder readResult = null;
+ try {
+ readResult = dbProvider.readFaultLogList(readinput);
+
+ } catch (Exception e) {
+ fail("Fault log not read: " + e.getMessage());
+ }
+
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.faultlog.list.output.Data> data = readResult
+ .getData();
+
+ assertNotNull(data);
+ assertEquals(1, data.size());
+ assertEquals("signalIsLost", data.get(0).getProblem());
+ assertEquals("Critical", data.get(0).getSeverity().toString());
+ assertEquals("s1", data.get(0).getNodeId());
+
+ //== UPDATE ================================
+ System.out.println("try to update entry");
+
+ dbRawProvider.doUpdateOrCreate(Entity.Faultlog.getName(), "1", "{'problem': 'CableLOS', 'severity': 'Major', 'node-id': 'test4657-78'}");
+
+ System.out.println("try to search entry 1");
+ readinput = new ReadFaultlogListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("node-id").setFiltervalue("test").build()))
+ .setPagination(getPagination(20, 1)).build();
+
+ //== VERIFY UPDATE ================================
+ readResult = dbProvider.readFaultLogList(readinput);
+ data = readResult.getData();
+
+
+ assertNotNull(data);
+ System.out.println(data);
+ assertEquals(0, data.size());
+
+ System.out.println("try to search entry 2");
+
+ readinput = new ReadFaultlogListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("node-id").setFiltervalue("test*").build()))
+ .setPagination(getPagination(20, 1)).build();
+
+ readResult = dbProvider.readFaultLogList(readinput);
+ data = readResult.getData();
+
+
+ assertNotNull(data);
+ assertEquals(1, data.size());
+ assertEquals("CableLOS", data.get(0).getProblem());
+ assertEquals("Major", data.get(0).getSeverity().toString());
+ assertEquals("test4657-78", data.get(0).getNodeId());
+
+ //== DELETE ================================
+
+ System.out.println("try to clear entry");
+ try {
+ dbRawProvider.doRemove(Entity.Faultlog.getName(), dbId);
+ } catch (Exception e) {
+ fail("problem deleting entry: " + e.getMessage());
+ }
+
+ //== VERIFY DELETE ===========================
+ System.out.println("verify entries deleted");
+ readResult = dbProvider.readFaultLogList(new ReadFaultlogListInputBuilder().setPagination(getPagination(20, 1)).build());
+ data = readResult.getData();
+ assertEquals(0, data.size());
+ }
+
+ @Test
+ public void testFaultCurrent() {
+ System.out.println("Starting faultCurrent test...");
+ String dbId = null;
+ dbId = clearAndCreatefaultEntity("1", Entity.Faultcurrent.getName(), "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateFaultcurrentInput", SeverityType.NonAlarmed);
+ assertEquals("1", dbId);
+
+ // ==READ===========================
+ System.out.println("Trying to read...");
+
+
+ ReadFaultcurrentListInput readinput = new ReadFaultcurrentListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("id").setFiltervalue(dbId).build()))
+ .setPagination(getPagination(20, 1)).build();
+
+ ReadFaultcurrentListOutputBuilder readResult = null;
+ try {
+ readResult = dbProvider.readFaultCurrentList(readinput);
+
+ } catch (Exception e) {
+ fail("Fault log not read: " + e.getMessage());
+ }
+
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.faultcurrent.list.output.Data> data = readResult
+ .getData();
+
+
+ assertNotNull(data);
+ assertEquals(1, data.size());
+ assertEquals("signalIsLost", data.get(0).getProblem());
+ assertEquals("NonAlarmed", data.get(0).getSeverity().toString());
+ assertEquals("s1", data.get(0).getNodeId());
+ assertEquals(4340, data.get(0).getCounter().intValue());
+ assertEquals(new DateAndTime("2019-10-28T11:55:58.3Z"), data.get(0).getTimestamp());
+ assertEquals(4340, data.get(0).getCounter().intValue());
+ assertEquals("LP-MWPS-RADIO", data.get(0).getObjectId());
+
+
+ // ==UPDATE============================
+ System.out.println("Trying to update...");
+
+ String json = "{\n" +
+ "\"timestamp\": \"2019-12-28T11:55:58.3Z\",\n" +
+ "\"node-id\": \"SDN-Controller-0\",\n" +
+ "\"counter\": 75,\n" +
+ "\"problem\": \"connectionLossNeOAM\",\n" +
+ "}";
+
+ String updatedDbId = dbRawProvider.doUpdateOrCreate(Entity.Faultcurrent.getName(), dbId, json);
+ assertEquals(dbId, updatedDbId);
+
+ // ==READ============================
+
+ try {
+ readResult = dbProvider.readFaultCurrentList(readinput);
+
+ } catch (Exception e) {
+ fail("Fault log not read: " + e.getMessage());
+ }
+
+ data = readResult.getData();
+
+ assertNotNull(data);
+ assertEquals(1, data.size());
+ assertEquals("connectionLossNeOAM", data.get(0).getProblem());
+ assertEquals("SDN-Controller-0", data.get(0).getNodeId());
+ assertEquals(75, data.get(0).getCounter().intValue());
+ assertEquals("LP-MWPS-RADIO", data.get(0).getObjectId());
+
+ // ==DELETE============================
+ try {
+ dbRawProvider.doRemove(Entity.Faultcurrent.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting: " + e.getMessage());
+ }
+
+ // ==READ/VERIFY DELETE============================
+
+ try {
+ readResult = dbProvider.readFaultCurrentList(readinput);
+
+ } catch (Exception e) {
+ fail("Fault log not read: " + e.getMessage());
+ }
+
+ data = readResult.getData();
+
+ assertNotNull(data);
+ assertEquals(0, data.size());
+ }
+
+ @Test
+ public void testConnectionLog() {
+
+ // ==CLEAR================================
+ System.out.println("Clear before test");
+ try {
+ dbRawProvider.doRemove(Entity.Connectionlog.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting: " + e.getMessage());
+ }
+
+ // ==CREATE================================
+
+ System.out.println("Try create entry");
+ final String initialDbId = "1";
+ String dbId = null;
+ String json ="{\n" +
+ "\"timestamp\": \"2019-11-01T11:28:34.7Z\",\n" +
+ "\"status\": \"Connecting\",\n" +
+ "\"node-id\": \"sim2230\",\n" +
+ "\"implemented-interface\": \"org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateConnectionlogInput\"\n" +
+ "}";
+
+ dbId = dbRawProvider.doUpdateOrCreate(Entity.Connectionlog.getName(), initialDbId, json);
+
+ assertEquals(initialDbId, dbId);
+
+ // ==READ================================
+ System.out.println("Try read entry");
+
+ ReadConnectionlogListInput readinput = new ReadConnectionlogListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("id").setFiltervalue(dbId).build()))
+ .setPagination(getPagination(20, 1)).build();
+
+ ReadConnectionlogListOutputBuilder readResult = null;
+ try {
+ readResult = dbProvider.readConnectionlogList(readinput);
+
+ } catch (Exception e) {
+ fail("Connection log not read: " + e.getMessage());
+ }
+
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.connectionlog.list.output.Data> data = readResult
+ .getData();
+
+ assertNotNull(data);
+ assertEquals(1, data.size());
+ assertEquals("Connecting", data.get(0).getStatus().toString());
+ assertEquals("sim2230", data.get(0).getNodeId());
+
+
+ // ==UPDATE================================
+ System.out.println("Try update entry");
+
+ dbRawProvider.doUpdateOrCreate(Entity.Connectionlog.getName(), dbId, "{'status' : 'Connected'}");
+
+ // ==READ 2================================
+ System.out.println("Try read updated entry");
+
+ readinput = new ReadConnectionlogListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("status").setFiltervalue("Connected").build()))
+ .setPagination(getPagination(20, 1)).build();
+
+ try {
+ readResult = dbProvider.readConnectionlogList(readinput);
+
+ } catch (Exception e) {
+ fail("Connection log not read: " + e.getMessage());
+ }
+
+ data = readResult.getData();
+
+ assertNotNull(data);
+ assertEquals(1, data.size());
+ assertEquals("Connected", data.get(0).getStatus().toString());
+ assertEquals("sim2230", data.get(0).getNodeId());
+
+ //== DELETE ================================
+
+ System.out.println("try to clear entry");
+ try {
+ dbRawProvider.doRemove(Entity.Connectionlog.getName(), dbId);
+ } catch (Exception e) {
+ fail("problem deleting entry: " + e.getMessage());
+ }
+
+ //== VERIFY DELETE ===========================
+ System.out.println("verify entries deleted");
+ readResult = dbProvider.readConnectionlogList(new ReadConnectionlogListInputBuilder().setPagination(getPagination(20, 1)).build());
+ data = readResult.getData();
+ assertEquals(0, data.size());
+
+ }
+
+ @Test
+ public void testEventLog() {
+ System.out.println("Test event log starting...");
+
+ // ==CLEAR================================
+ System.out.println("Clear before test");
+ try {
+ dbRawProvider.doRemove(Entity.Eventlog.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting: " + e.getMessage());
+ }
+ // ==CREATE============================
+
+ String dbId = null;
+ String json = " {\n" +
+ "\"timestamp\": \"2019-11-08T16:39:23.0Z\",\n" +
+ "\"new-value\": \"done\",\n" +
+ "\"object-id\": \"SDN-Controller-0\",\n" +
+ "\"attribute-name\": \"startup\",\n" +
+ "\"counter\": 0,\n" +
+ "\"implemented-interface\": \"org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Eventlog\",\n" +
+ "\"node-id\": \"SDN-Controller-0\"\n" +
+ "}";
+
+ dbId = dbRawProvider.doUpdateOrCreate(Entity.Eventlog.getName(), "1", json);
+ assertNotNull(dbId);
+
+ // ==READ===========================
+
+ ReadEventlogListInput readinput = new ReadEventlogListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("id").setFiltervalue(dbId).build()))
+ .setPagination(getPagination(20, 1)).build();
+ ReadEventlogListOutputBuilder readResult = null;
+ try {
+ readResult = dbProvider.readEventlogList(readinput);
+
+ } catch (Exception e) {
+ fail("problem reading eventlog");
+ }
+
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.eventlog.list.output.Data> data = readResult.getData();
+ assertEquals(1,data.size());
+
+ //== DELETE ================================
+
+ System.out.println("try to clear entry");
+ try {
+ dbRawProvider.doRemove(Entity.Eventlog.getName(), dbId);
+ } catch (Exception e) {
+ fail("problem deleting entry: " + e.getMessage());
+ }
+
+ //== VERIFY DELETE ===========================
+ System.out.println("verify entries deleted");
+ try {
+ readResult = dbProvider.readEventlogList(new ReadEventlogListInputBuilder().setPagination(getPagination(20, 1)).build());
+ } catch (IOException e) {
+ fail("problem reading eventlog");
+ }
+ data = readResult.getData();
+ assertEquals(0, data.size());
+
+ }
+
+ @Test
+ public void testInventory() {
+
+ System.out.println("Test inventory starting...");
+
+ // ==CLEAR================================
+ System.out.println("Clear before test");
+ try {
+ dbRawProvider.doRemove(Entity.Inventoryequipment.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting: " + e.getMessage());
+ }
+
+
+ // ==CREATE============================
+
+ String dbId = null;
+ String json = " {\"tree-level\": 1,\n" +
+ " \"parent-uuid\": \"SHELF-1.1.0.0\",\n" +
+ " \"node-id\": \"sim2\",\n" +
+ " \"uuid\": \"CARD-1.1.8.0\",\n" +
+ " \"contained-holder\": [ ],\n" +
+ " \"manufacturer-name\": \"Lorem Ipsum\",\n" +
+ " \"manufacturer-identifier\": \"ONF-Wireless-Transport\",\n" +
+ " \"serial\": \"sd-dsa-eqw\",\n" +
+ " \"date\": \"2008-10-21T00:00:00.0Z\",\n" +
+ "\"implemented-interface\": \"org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Inventory\",\n" +
+ " \"version\": \"unknown\",\n" +
+ " \"description\": \"WS/DS3\",\n" +
+ " \"part-type-id\": \"unknown\",\n" +
+ " \"model-identifier\": \"model-id-s3s\",\n" +
+ " \"type-name\": \"p4.module\"}";
+
+ dbId = dbRawProvider.doUpdateOrCreate(Entity.Inventoryequipment.getName(), "1 1", json);
+ assertNotNull(dbId);
+
+ // ==READ===========================
+ ReadInventoryListInput readinput = new ReadInventoryListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("id").setFiltervalue(dbId).build()))
+ .setPagination(getPagination(20, 1)).build();
+ ReadInventoryListOutputBuilder readResult = null;
+ try {
+ readResult = dbProvider.readInventoryList(readinput);
+
+ } catch (Exception e) {
+ fail("Problem reading inventory list"+e.getMessage());
+ }
+
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.Data> data = readResult.getData();
+ assertEquals(1,data.size());
+ assertEquals("Lorem Ipsum", data.get(0).getManufacturerName());
+ assertEquals("ONF-Wireless-Transport", data.get(0).getManufacturerIdentifier());
+ assertEquals("sim2", data.get(0).getNodeId());
+ assertEquals("unknown", data.get(0).getVersion());
+ assertEquals("WS/DS3", data.get(0).getDescription());
+ assertEquals("2008-10-21T00:00:00.0Z", data.get(0).getDate());
+ assertEquals("sd-dsa-eqw", data.get(0).getSerial());
+ System.out.println(data.get(0).getDate());
+
+ // ==UPDATE============================
+ String updatedDbId=null;
+ final String[] holderArray = {"Lorem Ipsum 1", "Lorem Ipsum 2", "Lorem Ipsum &%/$_2"};
+ String updatejson = " {" +
+ " \"node-id\": \"sim5\",\n" +
+ " \"contained-holder\": [ \"Lorem Ipsum 1\", \"Lorem Ipsum 2\", \"Lorem Ipsum &%/$_2\" ],\n" +
+ " \"serial\": \"sd-dsa-eww\",\n" +
+ " \"date\": \"2008-11-21T00:00:00.0Z\",\n" +
+ " \"part-type-id\": \"not unknown\",\n" +
+ "}";
+
+ updatedDbId = dbRawProvider.doUpdateOrCreate(Entity.Inventoryequipment.getName(), dbId, updatejson);
+ assertEquals(dbId, updatedDbId);
+
+ try {
+ readResult = dbProvider.readInventoryList(readinput);
+
+ } catch (Exception e) {
+ fail("Problem reading inventory list"+e.getMessage());
+ }
+
+ data = readResult.getData();
+
+ assertEquals(1,data.size());
+ assertEquals("Lorem Ipsum", data.get(0).getManufacturerName());
+ assertEquals("ONF-Wireless-Transport", data.get(0).getManufacturerIdentifier());
+ assertEquals("sim5", data.get(0).getNodeId());
+ assertEquals("not unknown", data.get(0).getPartTypeId());
+ assertEquals("WS/DS3", data.get(0).getDescription());
+ assertEquals("2008-11-21T00:00:00.0Z", data.get(0).getDate());
+ assertEquals("sd-dsa-eww", data.get(0).getSerial());
+ assertEquals(holderArray.length,data.get(0).getContainedHolder().size());
+ assertEquals(holderArray[0],data.get(0).getContainedHolder().get(0));
+ assertEquals(holderArray[1],data.get(0).getContainedHolder().get(1));
+ assertEquals(holderArray[2],data.get(0).getContainedHolder().get(2));
+
+ // ==DELETE============================
+
+ System.out.println("delete after test");
+ try {
+ dbRawProvider.doRemove(Entity.Inventoryequipment.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting: " + e.getMessage());
+ }
+
+ // ==VERIFY DELETE ============================
+
+ try {
+ readResult = dbProvider.readInventoryList(readinput);
+
+ } catch (Exception e) {
+ fail("Problem reading inventory list"+e.getMessage());
+ }
+
+ data = readResult.getData();
+ assertEquals(0,data.size());
+
+ }
+
+ @Test
+ public void test15MinPerformanceReadLtpListWithoutNodeIdSetThrowsException() {
+
+ System.out.println("Reading 15m ltp list without node id filter set throws an exception test start...");
+
+ try {
+ dbRawProvider.doRemove(Entity.Historicalperformance15min.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting: " + e.getMessage());
+ }
+
+ System.out.println("create entries...");
+
+ createPerformanceData("1", timeInterval.PERIOD_15MIN, "PM_RADIO_15M_6", "LP-MWPS-TTP-02", "a2");
+ createPerformanceData("2", timeInterval.PERIOD_15MIN, "PM_RADIO_15M_4", "LP-MWPS-TTP-01", "a2");
+
+ createPerformanceData("4", timeInterval.PERIOD_15MIN, "PM_RADIO_15M_6", "LP-MWPS-TTP-02", "a3");
+ createPerformanceData("5", timeInterval.PERIOD_15MIN, "PM_RADIO_15M_4", "LP-MWPS-TTP-01", "a3");
+ createPerformanceData("6", timeInterval.PERIOD_15MIN, "PM_RADIO_15M_7", "LP-MWPS-TTP-03", "a3");
+ createPerformanceData("3", timeInterval.PERIOD_15MIN, "PM_RADIO_15M_7", "LP-MWPS-TTP-05", "a3");
+
+ System.out.println("trying to read, should throw exception...");
+
+
+ ReadPmdata15mLtpListInput readLtp = new ReadPmdata15mLtpListInputBuilder()
+ .setPagination(getPagination(20, 1)).build();
+
+ ReadPmdata15mLtpListOutputBuilder readltpResult = null;
+
+ try {
+ readltpResult = dbProvider.readPmdata15mLtpList(readLtp);
+ fail("No exception thrown!");
+ } catch (Exception e) {
+ System.out.println(e);
+ assertTrue(e instanceof IllegalArgumentException);
+ assertEquals("no nodename in filter found ", e.getMessage());
+ }
+
+ assertNull(readltpResult);
+
+ //== DELETE ================================
+
+ System.out.println("try to clear entry");
+ try {
+ dbRawProvider.doRemove(Entity.Historicalperformance15min.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting entry: " + e.getMessage());
+ }
+
+ //== VERIFY DELETE ===========================
+ System.out.println("verify entries deleted");
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data> data = dbProvider.readPmdata15mList(new ReadPmdata15mListInputBuilder()
+ .setPagination(getPagination(20, 1)).build()).getData();
+
+ assertEquals(0, data.size());
+ }
+
+ @Test
+ public void test15MinPerformanceData() {
+ // == CLEAR BEFORE TESTS ============================
+ System.out.println("Test 15 min performance...");
+
+ try {
+ dbRawProvider.doRemove(Entity.Historicalperformance15min.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting: " + e.getMessage());
+ }
+
+ // == CREATE ============================
+
+ System.out.println("create entries...");
+
+ createPerformanceData("1", timeInterval.PERIOD_15MIN, "PM_RADIO_15M_6", "LP-MWPS-TTP-02", "a2");
+ createPerformanceData("2", timeInterval.PERIOD_15MIN, "PM_RADIO_15M_4", "LP-MWPS-TTP-01", "a2");
+
+ createPerformanceData("4", timeInterval.PERIOD_15MIN, "PM_RADIO_15M_6", "LP-MWPS-TTP-02", "a3");
+ createPerformanceData("5", timeInterval.PERIOD_15MIN, "PM_RADIO_15M_4", "LP-MWPS-TTP-01", "a3");
+ createPerformanceData("6", timeInterval.PERIOD_15MIN, "PM_RADIO_15M_7", "LP-MWPS-TTP-03", "a3");
+ createPerformanceData("3", timeInterval.PERIOD_15MIN, "PM_RADIO_15M_7", "LP-MWPS-TTP-05", "a3");
+
+ // == READ ============================
+ System.out.println("read list entries...");
+
+ ReadPmdata15mListInput read = new ReadPmdata15mListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("node-name").setFiltervalue("a2").build()))
+ .setPagination(getPagination(20, 1)).build();
+
+ ReadPmdata15mListOutputBuilder readResult = null;
+
+ try {
+ readResult = dbProvider.readPmdata15mList(read);
+ } catch (Exception e) {
+ fail("Problem reading 15m data");
+ }
+
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data> data = readResult
+ .getData();
+
+ assertNotNull(data);
+ assertEquals(2, data.size());
+
+ System.out.println("read ltp entries with node name set...");
+
+ ReadPmdata15mLtpListInput readLtp = new ReadPmdata15mLtpListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("node-name").setFiltervalue("a2").build()))
+ .setPagination(getPagination(20, 1)).build();
+
+ ReadPmdata15mLtpListOutputBuilder readltpResult = null;
+
+ try {
+ readltpResult = dbProvider.readPmdata15mLtpList(readLtp);
+ } catch (Exception e) {
+ fail("Problem reading 15m ltp data");
+ }
+
+ List<String> dataLtp = readltpResult.getData();
+
+ assertNotNull(dataLtp);
+ assertEquals(2, dataLtp.size());
+ assertTrue(dataLtp.contains("LP-MWPS-TTP-02"));
+ assertTrue(dataLtp.contains("LP-MWPS-TTP-01"));
+
+ System.out.println("read device entries...");
+
+ ReadPmdata15mDeviceListInput readDevices = new ReadPmdata15mDeviceListInputBuilder()
+ .setPagination(getPagination(20, 1)).build();
+
+ ReadPmdata15mDeviceListOutputBuilder readDeviceResult = null;
+
+ try {
+ readDeviceResult = dbProvider.readPmdata15mDeviceList(readDevices);
+ } catch (Exception e) {
+ fail("Problem reading 15m device data");
+ }
+
+ List<String> dataDevice = readDeviceResult.getData();
+
+ assertNotNull(dataDevice);
+ assertEquals(2, dataDevice.size());
+ assertTrue(dataDevice.contains("a2"));
+ assertTrue(dataDevice.contains("a3"));
+
+ //== DELETE ================================
+
+ System.out.println("try to clear entry");
+ try {
+ dbRawProvider.doRemove(Entity.Historicalperformance15min.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting entry: " + e.getMessage());
+ }
+
+ //== VERIFY DELETE ===========================
+ System.out.println("verify entries deleted");
+ readResult = dbProvider.readPmdata15mList(new ReadPmdata15mListInputBuilder()
+ .setPagination(getPagination(20, 1)).build());
+ data = readResult.getData();
+ assertEquals(0, data.size());
+
+ }
+
+ @Test
+ public void test24hPerformanceData() {
+ System.out.println("Test 24h performance...");
+
+ try {
+ dbRawProvider.doRemove(Entity.Historicalperformance24h.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting: " + e.getMessage());
+ }
+
+ System.out.println("create entries...");
+
+ createPerformanceData("1", timeInterval.PERIOD_24HOURS, "PM_RADIO_15M_6", "LP-MWPS-TTP-02", "a2");
+ createPerformanceData("2", timeInterval.PERIOD_24HOURS, "PM_RADIO_15M_4", "LP-MWPS-TTP-01", "a2");
+ String aDbId = createPerformanceData("4", timeInterval.PERIOD_24HOURS, "PM_RADIO_15M_6", "LP-MWPS-TTP-06", "a2");
+
+ createPerformanceData("5", timeInterval.PERIOD_24HOURS, "PM_RADIO_15M_4", "LP-MWPS-TTP-01", "a3");
+ createPerformanceData("6", timeInterval.PERIOD_24HOURS, "PM_RADIO_15M_7", "LP-MWPS-TTP-03", "a3");
+ createPerformanceData("3", timeInterval.PERIOD_24HOURS, "PM_RADIO_15M_7", "LP-MWPS-TTP-05", "a3");
+
+ System.out.println("read all list entries...");
+
+ ReadPmdata24hListInput read = new ReadPmdata24hListInputBuilder()
+ .setPagination(getPagination(20, 1)).build();
+
+ ReadPmdata24hListOutputBuilder readResult = null;
+
+ try {
+ readResult = dbProvider.readPmdata24hList(read);
+ } catch (Exception e) {
+ fail("Problem reading 24h data");
+ }
+
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._24h.list.output.Data> data = readResult
+ .getData();
+
+ assertNotNull(data);
+ assertEquals(6, data.size());
+
+
+ System.out.println("filter list entries...");
+
+ read = new ReadPmdata24hListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("node-name").setFiltervalue("a2").build()))
+ .setPagination(getPagination(20, 1)).build();
+
+ readResult = null;
+
+ try {
+ readResult = dbProvider.readPmdata24hList(read);
+ } catch (Exception e) {
+ fail("Problem reading 24h data");
+ }
+
+ data = readResult.getData();
+
+ assertNotNull(data);
+ assertEquals(3, data.size());
+
+ System.out.println("read ltp entries with node name set...");
+
+ ReadPmdata24hLtpListInput readLtp = new ReadPmdata24hLtpListInputBuilder()
+ .setFilter(Arrays.asList(new FilterBuilder().setProperty("node-name").setFiltervalue("a2").build()))
+ .setPagination(getPagination(20, 1)).build();
+
+ ReadPmdata24hLtpListOutputBuilder readltpResult = null;
+
+ try {
+ readltpResult = dbProvider.readPmdata24hLtpList(readLtp);
+ } catch (Exception e) {
+ fail("Problem reading 24h ltp data");
+ }
+
+ List<String> dataLtp = readltpResult.getData();
+
+ assertNotNull(dataLtp);
+ assertEquals(3, dataLtp.size());
+ assertTrue(dataLtp.contains("LP-MWPS-TTP-02"));
+ assertTrue(dataLtp.contains("LP-MWPS-TTP-01"));
+ assertTrue(dataLtp.contains("LP-MWPS-TTP-06"));
+
+
+ System.out.println("read device entries...");
+
+ ReadPmdata24hDeviceListInput readDevices = new ReadPmdata24hDeviceListInputBuilder()
+ .setPagination(getPagination(20, 1)).build();
+
+ ReadPmdata24hDeviceListOutputBuilder readDeviceResult = null;
+
+ try {
+ readDeviceResult = dbProvider.readPmdata24hDeviceList(readDevices);
+ } catch (Exception e) {
+ fail("Problem reading 24h device data");
+ }
+
+ List<String> dataDevice = readDeviceResult.getData();
+
+ assertNotNull(dataDevice);
+ assertEquals(2, dataDevice.size());
+ assertTrue(dataDevice.contains("a2"));
+ assertTrue(dataDevice.contains("a3"));
+
+ // == UPDATE ==============================
+
+ String shouldbeEmpty = dbRawProvider.doUpdate(Entity.Historicalperformance24h.getName(), "{'uuid-interface':'LTP-TEST-MWP-097'}", QueryBuilders.termQuery("_id", aDbId));
+ assertEquals("",shouldbeEmpty);
+ try {
+ readltpResult = dbProvider.readPmdata24hLtpList(readLtp);
+ } catch (Exception e) {
+ fail("Problem reading 24h ltp data");
+ }
+
+ // == VERIFY UPDATE ==============================
+
+ dataLtp = readltpResult.getData();
+
+ assertNotNull(dataLtp);
+ assertEquals(3, dataLtp.size());
+ assertTrue(dataLtp.contains("LP-MWPS-TTP-02"));
+ assertTrue(dataLtp.contains("LP-MWPS-TTP-01"));
+ assertTrue(dataLtp.contains("LTP-TEST-MWP-097"));
+
+
+
+ //== DELETE ===========================
+
+ System.out.println("try to clear entries");
+ try {
+ dbRawProvider.doRemove(Entity.Historicalperformance24h.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting entry: " + e.getMessage());
+ }
+
+ //== VERIFY DELETE ===========================
+ System.out.println("verify entries deleted");
+ readResult = dbProvider.readPmdata24hList(new ReadPmdata24hListInputBuilder()
+ .setPagination(getPagination(20, 1)).build());
+ data = readResult.getData();
+ assertEquals(0, data.size());
+ }
+
+ @Test
+ public void test24hPerformanceDataReadLtpListWithoutNodeIdSetThrowsException() {
+ System.out.println("Test 24 hour tp list without node id filter set throws an exception test start...\"...");
+
+ try {
+ dbRawProvider.doRemove(Entity.Historicalperformance24h.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting: " + e.getMessage());
+ }
+
+ System.out.println("create entries...");
+
+ createPerformanceData("1", timeInterval.PERIOD_24HOURS, "PM_RADIO_15M_6", "LP-MWPS-TTP-02", "a2");
+ createPerformanceData("2", timeInterval.PERIOD_24HOURS, "PM_RADIO_15M_4", "LP-MWPS-TTP-01", "a2");
+
+ createPerformanceData("4", timeInterval.PERIOD_24HOURS, "PM_RADIO_15M_6", "LP-MWPS-TTP-02", "a3");
+ createPerformanceData("5", timeInterval.PERIOD_24HOURS, "PM_RADIO_15M_4", "LP-MWPS-TTP-01", "a3");
+ createPerformanceData("6", timeInterval.PERIOD_24HOURS, "PM_RADIO_15M_7", "LP-MWPS-TTP-03", "a3");
+ createPerformanceData("3", timeInterval.PERIOD_24HOURS, "PM_RADIO_15M_7", "LP-MWPS-TTP-05", "a3");
+
+ System.out.println("trying to read, should throw exception...");
+
+
+ ReadPmdata24hLtpListInput readLtp = new ReadPmdata24hLtpListInputBuilder()
+ .setPagination(getPagination(20, 1)).build();
+
+ ReadPmdata24hLtpListOutputBuilder readltpResult = null;
+
+ try {
+ readltpResult = dbProvider.readPmdata24hLtpList(readLtp);
+ fail("No exception thrown!");
+ } catch (Exception e) {
+ System.out.println(e);
+ assertTrue(e instanceof IllegalArgumentException);
+ assertEquals("no nodename in filter found ", e.getMessage());
+ }
+
+ assertNull(readltpResult);
+
+ try {
+ dbRawProvider.doRemove(Entity.Historicalperformance24h.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testUrlEncoding() {
+ System.out.println("Testing url encding");
+
+ final String test = "Lorem Ipsum";
+ final String test1 = "Lorem/Ipsum";
+ final String test2 = "Lorem_Ipsum";
+ final String test3 = "Lorem%Ipsum";
+
+ assertEquals("Lorem%20Ipsum", BaseRequest.urlEncodeValue(test));
+ assertEquals("Lorem%2FIpsum", BaseRequest.urlEncodeValue(test1));
+ assertEquals("Lorem_Ipsum", BaseRequest.urlEncodeValue(test2));
+ assertEquals("Lorem%25Ipsum", BaseRequest.urlEncodeValue(test3));
+ }
+
+ @Test
+ public void testDoUpdateOrCreateWithNullId() {
+ System.out.println("Test DoUpdateOrCreate doesn't create new database entry if null is passed");
+
+ String dbId = clearAndCreatefaultEntity(null, Entity.Faultlog.getName(), "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateFaultlogInput", SeverityType.Critical);
+ assertNull(dbId);
+ }
+
+ @Test
+ public void readTestFaultCurrentViaRawDbProvider() {
+ System.out.println("Starting faultCurrent test...");
+ String dbId = null;
+ dbId = clearAndCreatefaultEntity("1", Entity.Faultcurrent.getName(), "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateFaultcurrentInput", SeverityType.Critical);
+ assertEquals("1", dbId);
+
+ // ==READ===========================
+ System.out.println("Trying to read...");
+
+ String readResult = null;
+ try {
+ readResult = dbRawProvider.doReadJsonData(Entity.Faultcurrent.getName(), dbId);
+
+ } catch (Exception e) {
+ fail("Fault log not read: " + e.getMessage());
+ }
+
+
+ String expectedDbResult ="{\"severity\":\"Critical\",\"node-id\":\"s1\",\"problem\":\"signalIsLost\",\"counter\":4340,\"object-id\":\"LP-MWPS-RADIO\",\"implemented-interface\":\"org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateFaultcurrentInput\",\"type\":\"ProblemNotificationXml\",\"timestamp\":\"2019-10-28T11:55:58.3Z\"}";
+
+ System.out.println(readResult);
+ assertNotNull(readResult);
+ assertEquals(expectedDbResult, readResult);
+
+ SearchResult<SearchHit> searchResult = dbRawProvider.doReadAllJsonData(Entity.Faultcurrent.getName());
+ assertNotNull(searchResult);
+
+ List<SearchHit> hits = searchResult.getHits();
+
+ assertNotNull(hits);
+ assertEquals(1, searchResult.getTotal());
+ assertEquals(expectedDbResult, hits.get(0).getSourceAsString());
+
+ //== DELETE ==============================
+ try {
+ dbRawProvider.doRemove(Entity.Faultcurrent.getName(), QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting: " + e.getMessage());
+ }
+ //== VERIFY DELETE ========================
+ searchResult = dbRawProvider.doReadAllJsonData(Entity.Faultcurrent.getName());
+ hits = searchResult.getHits();
+ assertNotNull(hits);
+ assertEquals(0, searchResult.getTotal());
+
+ }
+
+
+ private Pagination getPagination(long pageSize, int page) {
+ return new PaginationBuilder().setPage(BigInteger.valueOf(page)).setSize(pageSize).build();
+ }
+
+
+ private String clearAndCreatefaultEntity(String initialDbId, String entityType, String implementedInterface, SeverityType severity) {
+ // ==CLEAR BEFORE TEST============================
+ System.out.println("try to clear entry");
+ try {
+ dbRawProvider.doRemove(entityType, QueryBuilders.matchAllQuery());
+ } catch (Exception e) {
+ fail("problem deleting: " + e.getMessage());
+ }
+
+
+ return createFaultEntity(initialDbId, entityType, implementedInterface, severity);
+ }
+
+ private String createFaultEntity(String initialDbId, String entityType, String implementedInterface, SeverityType severity) {
+ // ==CREATE============================
+ System.out.println("try to create entry");
+ String dbId = null;
+
+ try {
+
+ dbId = dbRawProvider.doUpdateOrCreate(entityType, initialDbId,"{\n" +
+ "\"timestamp\": \"2019-10-28T11:55:58.3Z\",\n" +
+ "\"object-id\": \"LP-MWPS-RADIO\",\n" +
+ "\"severity\": \""+severity.toString()+"\",\n" +
+ "\"node-id\": \"s1\",\n" +
+ "\"implemented-interface\": \""+implementedInterface+"\",\n" +
+ "\"counter\": 4340,\n" +
+ "\"problem\": \"signalIsLost\",\n" +
+ "\"type\": \"ProblemNotificationXml\"\n" +
+ "}");
+
+
+
+ } catch (Exception e) {
+ fail("Problem creating fault log entry" + e.getMessage());
+ }
+
+ return dbId;
+ }
+
+ private enum timeInterval{
+ PERIOD_15MIN,
+ PERIOD_24HOURS
+ }
+
+ private String createPerformanceData(String initialDbId, timeInterval timeInterval, String scannerId, String uuidInterface, String nodename) {
+
+ String json = "{\n" +
+ "\"node-name\": \""+nodename+"\",\n" +
+ "\"uuid-interface\": \""+uuidInterface+"\",\n" +
+ "\"layer-protocol-name\": \"MWPS\",\n" +
+ "\"radio-signal-id\": \"Test8\",\n" +
+ "\"time-stamp\": \"2017-03-01T06:15:00.0Z\",\n" +
+ "\"granularity-period\": \""+timeInterval.toString()+"\",\n" +
+ "\"scanner-id\": \""+scannerId+"\",\n" +
+ "\"performance-data\": {\n" +
+ "\"cses\": 0,\n" +
+ "\"ses\": 0,\n" +
+ "\"es\": 0,\n" +
+ "\"tx-level-max\": 3,\n" +
+ "\"tx-level-avg\": 3,\n" +
+ "\"rx-level-min\": -44,\n" +
+ "\"rx-level-max\": -45,\n" +
+ "\"rx-level-avg\": -44,\n" +
+ "\"time2-states\": 0,\n" +
+ "\"time4-states-s\": 0,\n" +
+ "\"time4-states\": 0,\n" +
+ "\"time8-states\": -1,\n" +
+ "\"time16-states-s\": -1,\n" +
+ "\"time16-states\": 0,\n" +
+ "\"time32-states\": -1,\n" +
+ "\"time64-states\": 900,\n" +
+ "\"time128-states\": -1,\n" +
+ "\"time256-states\": -1,\n" +
+ "\"time512-states\": -1,\n" +
+ "\"time512-states-l\": -1,\n" +
+ "\"unavailability\": 0,\n" +
+ "\"tx-level-min\": 3,\n" +
+ "\"time1024-states\": -1,\n" +
+ "\"time1024-states-l\": -1,\n" +
+ "\"time2048-states\": -1,\n" +
+ "\"time2048-states-l\": -1,\n" +
+ "\"time4096-states\": -1,\n" +
+ "\"time4096-states-l\": -1,\n" +
+ "\"time8192-states\": -1,\n" +
+ "\"time8192-states-l\": -1,\n" +
+ "\"snir-min\": -99,\n" +
+ "\"snir-max\": -99,\n" +
+ "\"snir-avg\": -99,\n" +
+ "\"xpd-min\": -99,\n" +
+ "\"xpd-max\": -99,\n" +
+ "\"xpd-avg\": -99,\n" +
+ "\"rf-temp-min\": -99,\n" +
+ "\"rf-temp-max\": -99,\n" +
+ "\"rf-temp-avg\": -99,\n" +
+ "\"defect-blocks-sum\": -1,\n" +
+ "\"time-period\": 900\n" +
+ "},\n" +
+ "\"suspect-interval-flag\": false\n" +
+ "}";
+
+ if(timeInterval.toString().equals("PERIOD_15MIN")) {
+ return dbRawProvider.doUpdateOrCreate(Entity.Historicalperformance15min.getName(), initialDbId, json);
+ }else {
+ return dbRawProvider.doUpdateOrCreate(Entity.Historicalperformance24h.getName(), initialDbId, json);
+ }
+ }
+
+}
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestInitalMaintenanceObjectInDatabase.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestInitalMaintenanceObjectInDatabase.java
new file mode 100644
index 000000000..633912579
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestInitalMaintenanceObjectInDatabase.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt
+ * =================================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * =================================================================================================
+ * Licensed 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.
+ * ============LICENSE_END==========================================================================
+ ******************************************************************************/
+package org.onap.ccsdk.features.sdnr.wt.dataprovider.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+/**
+ * - Handling of inital values for Maintenance mode.
+ */
+public class TestInitalMaintenanceObjectInDatabase {
+
+ //@Test
+ public void test() {
+ fail("Not yet implemented");
+ }
+
+}
diff --git a/sdnr/wt/helpserver/feature/pom.xml b/sdnr/wt/helpserver/feature/pom.xml
index f7e6271d9..da50bc9db 100644
--- a/sdnr/wt/helpserver/feature/pom.xml
+++ b/sdnr/wt/helpserver/feature/pom.xml
@@ -22,29 +22,29 @@
-->
<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">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>single-feature-parent</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
-
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-helpserver-feature</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>feature</packaging>
-
- <name>ccsdk-features-sdnr-wt :: ${project.artifactId} :: feature</name>
-
- <dependencies>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sdnr-wt-helpserver-provider</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- </dependencies>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-helpserver-feature</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>feature</packaging>
+ <name>ccsdk-features-sdnr-wt :: ${project.artifactId} :: feature</name>
+
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>single-feature-parent</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
+ <relativePath />
+ </parent>
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sdnr-wt-helpserver-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
</project>
diff --git a/sdnr/wt/helpserver/installer/pom.xml b/sdnr/wt/helpserver/installer/pom.xml
index 01f6b3f6e..557e7bf4e 100755
--- a/sdnr/wt/helpserver/installer/pom.xml
+++ b/sdnr/wt/helpserver/installer/pom.xml
@@ -1,114 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>odlparent-lite</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-helpserver-installer</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-helpserver-installer</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>pom</packaging>
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
+ <relativePath />
+ </parent>
- <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
+ <properties>
+ <application.name>sdnr-wt-helpserver</application.name>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
- <properties>
- <application.name>sdnr-wt-helpserver</application.name>
- <include.transitive.dependencies>false</include.transitive.dependencies>
- </properties>
+ <dependencies>
- <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>${application.name}-feature</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>features</classifier>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>${application.name}-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>${application.name}-feature</artifactId>
- <version>${project.version}</version>
- <type>xml</type>
- <classifier>features</classifier>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>${application.name}-provider</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>maven-repo-zip</id>
- <goals>
- <goal>single</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <attach>true</attach>
- <finalName>stage/${application.name}-${project.version}</finalName>
- <descriptors>
- <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
- </descriptors>
- <appendAssemblyId>true</appendAssemblyId>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <!-- <execution> -->
- <!-- <id>copy-dependencies</id> -->
- <!-- <goals> -->
- <!-- <goal>copy-dependencies</goal> -->
- <!-- </goals> -->
- <!-- <phase>prepare-package</phase> -->
- <!-- <configuration> -->
- <!-- <transitive>true</transitive> -->
- <!-- <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> -->
- <!-- <overWriteReleases>false</overWriteReleases> -->
- <!-- <overWriteSnapshots>true</overWriteSnapshots> -->
- <!-- <overWriteIfNewer>true</overWriteIfNewer> -->
- <!-- <useRepositoryLayout>true</useRepositoryLayout> -->
- <!-- <addParentPoms>false</addParentPoms> -->
- <!-- <copyPom>false</copyPom> -->
- <!-- <includeArtifactIds>sdnr-wt-apigateway-provider,${application.name}</includeArtifactIds> -->
- <!-- <scope>provided</scope> -->
- <!-- </configuration> -->
- <!-- </execution> -->
- <execution>
- <id>copy-nested-dependencies</id>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <phase>prepare-package</phase>
- <configuration>
- <transitive>true</transitive>
- <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- <useRepositoryLayout>true</useRepositoryLayout>
- <addParentPoms>false</addParentPoms>
- <copyPom>false</copyPom>
- <!--<includeArtifactIds>sdnr-wt-apigateway-provider,${application.name}</includeArtifactIds> -->
- <!--<scope>provided</scope> -->
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>maven-repo-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <attach>true</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ <appendAssemblyId>true</appendAssemblyId>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <!-- <execution> -->
+ <!-- <id>copy-dependencies</id> -->
+ <!-- <goals> -->
+ <!-- <goal>copy-dependencies</goal> -->
+ <!-- </goals> -->
+ <!-- <phase>prepare-package</phase> -->
+ <!-- <configuration> -->
+ <!-- <transitive>true</transitive> -->
+ <!-- <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> -->
+ <!-- <overWriteReleases>false</overWriteReleases> -->
+ <!-- <overWriteSnapshots>true</overWriteSnapshots> -->
+ <!-- <overWriteIfNewer>true</overWriteIfNewer> -->
+ <!-- <useRepositoryLayout>true</useRepositoryLayout> -->
+ <!-- <addParentPoms>false</addParentPoms> -->
+ <!-- <copyPom>false</copyPom> -->
+ <!-- <includeArtifactIds>sdnr-wt-apigateway-provider,${application.name}</includeArtifactIds> -->
+ <!-- <scope>provided</scope> -->
+ <!-- </configuration> -->
+ <!-- </execution> -->
+ <execution>
+ <id>copy-nested-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <transitive>true</transitive>
+ <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <useRepositoryLayout>true</useRepositoryLayout>
+ <addParentPoms>false</addParentPoms>
+ <copyPom>false</copyPom>
+ <!--<includeArtifactIds>sdnr-wt-apigateway-provider,${application.name}</includeArtifactIds> -->
+ <!--<scope>provided</scope> -->
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/sdnr/wt/helpserver/pom.xml b/sdnr/wt/helpserver/pom.xml
index 4532c3465..fd0a68cbb 100755
--- a/sdnr/wt/helpserver/pom.xml
+++ b/sdnr/wt/helpserver/pom.xml
@@ -22,29 +22,29 @@
-->
<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">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>odlparent-lite</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-helpserver-top</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-helpserver-top</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>pom</packaging>
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
- <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
- <modules>
- <module>feature</module>
- <module>provider</module>
- <module>installer</module>
- </modules>
+ <modules>
+ <module>feature</module>
+ <module>provider</module>
+ <module>installer</module>
+ </modules>
- <properties>
- <feature-name>sdnr-wt-helpserver</feature-name>
- </properties>
+ <properties>
+ <feature-name>sdnr-wt-helpserver</feature-name>
+ </properties>
</project>
diff --git a/sdnr/wt/helpserver/provider/pom.xml b/sdnr/wt/helpserver/provider/pom.xml
index 0e237a61f..2fae07cda 100644
--- a/sdnr/wt/helpserver/provider/pom.xml
+++ b/sdnr/wt/helpserver/provider/pom.xml
@@ -11,27 +11,24 @@
OR CONDITIONS OF ANY KIND, either express or implied. * See the License for
the specific language governing permissions and * limitations under the License.
* ============LICENSE_END========================================================= -->
-<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">
- <modelVersion>4.0.0</modelVersion>
+<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/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>binding-parent</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
+ <modelVersion>4.0.0</modelVersion>
<groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
<artifactId>sdnr-wt-helpserver-provider</artifactId>
<version>0.7.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
<name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
-
+ <packaging>bundle</packaging>
<properties>
<checkstyle.skip>true</checkstyle.skip>
- </properties>
-
+ </properties>
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
+ <relativePath />
+ </parent>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
@@ -60,7 +57,6 @@
</dependency>
</dependencies>
-
<build>
<plugins>
<!-- fixed bug for sonarcube -->
diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/meta.json b/sdnr/wt/helpserver/provider/src/main/resources/help/meta.json
index c8dc5ce78..53dbbfb68 100644
--- a/sdnr/wt/helpserver/provider/src/main/resources/help/meta.json
+++ b/sdnr/wt/helpserver/provider/src/main/resources/help/meta.json
@@ -61,7 +61,7 @@
},
"label": "Config"
},
- "performanceApp": {
+ "performanceHistoryApp": {
"versions": {
"0.4.0": {
"date": "2018-02-24",
@@ -76,7 +76,7 @@
},
"label": "Performance"
},
- "pnfInventory": {
+ "inventoryApp": {
"versions": {
"0.4.0": {
"date": "2018-02-24",
@@ -121,28 +121,52 @@
},
"label": "SDN-R"
},
- "mediatorserver":{
- "nodes":{
- "installation":{
- "versions":{
- "0.4.0":{"date":"","path":"mediatorserver/installation/README.md","label":""},
- "current":{"date":"","path":"mediatorserver/installation/README.md","label":""}
+ "mediatorserver": {
+ "nodes": {
+ "installation": {
+ "versions": {
+ "0.4.0": {
+ "date": "",
+ "path": "mediatorserver/installation/README.md",
+ "label": ""
+ },
+ "current": {
+ "date": "",
+ "path": "mediatorserver/installation/README.md",
+ "label": ""
+ }
},
- "label":"Installation"
+ "label": "Installation"
},
- "mediator":{
- "versions":{
- "0.4.0":{"date":"","path":"mediatorserver/mediator/README.md","label":""},
- "current":{"date":"","path":"mediatorserver/mediator/README.md","label":""}
+ "mediator": {
+ "versions": {
+ "0.4.0": {
+ "date": "",
+ "path": "mediatorserver/mediator/README.md",
+ "label": ""
+ },
+ "current": {
+ "date": "",
+ "path": "mediatorserver/mediator/README.md",
+ "label": ""
+ }
},
- "label":"Mediator"
+ "label": "Mediator"
}
},
- "versions":{
- "0.4.0":{"date":"","path":"mediatorserver/README.md","label":""},
- "current":{"date":"","path":"mediatorserver/README.md","label":""}
+ "versions": {
+ "0.4.0": {
+ "date": "",
+ "path": "mediatorserver/README.md",
+ "label": ""
+ },
+ "current": {
+ "date": "",
+ "path": "mediatorserver/README.md",
+ "label": ""
+ }
},
- "label":"MediatorServer"
+ "label": "MediatorServer"
},
"faq": {
"versions": {
@@ -174,4 +198,4 @@
},
"label": "Abbreviations"
}
-}
+} \ No newline at end of file
diff --git a/sdnr/wt/pom.xml b/sdnr/wt/pom.xml
index 8c8bc4556..d8c3f41d4 100644
--- a/sdnr/wt/pom.xml
+++ b/sdnr/wt/pom.xml
@@ -41,5 +41,6 @@
<module>apigateway</module>
<module>websocketmanager2</module>
<module>helpserver</module>
+ <module>data-provider</module>
</modules>
</project>
diff --git a/sdnr/wt/websocketmanager2/feature/pom.xml b/sdnr/wt/websocketmanager2/feature/pom.xml
index 3ce6d3fb1..f7c33dd0a 100644
--- a/sdnr/wt/websocketmanager2/feature/pom.xml
+++ b/sdnr/wt/websocketmanager2/feature/pom.xml
@@ -22,44 +22,43 @@
-->
<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">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>single-feature-parent</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-websocketmanager2-feature</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>feature</packaging>
+ <name>ccsdk-features-sdnr-wt :: ${project.artifactId} :: feature</name>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-websocketmanager2-feature</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>feature</packaging>
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>single-feature-parent</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
- <name>ccsdk-features-sdnr-wt :: ${project.artifactId} :: feature</name>
-
- <dependencyManagement>
- <dependencies>
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>mdsal-artifacts</artifactId>
- <version>${odl.controller.mdsal.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <dependencyManagement>
<dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sdnr-wt-websocketmanager2-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sdnr-wt-websocketmanager2-provider</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>mdsal-artifacts</artifactId>
+ <version>${odl.controller.mdsal.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
</dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sdnr-wt-websocketmanager2-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sdnr-wt-websocketmanager2-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
diff --git a/sdnr/wt/websocketmanager2/installer/pom.xml b/sdnr/wt/websocketmanager2/installer/pom.xml
index dfedca560..e363be323 100755
--- a/sdnr/wt/websocketmanager2/installer/pom.xml
+++ b/sdnr/wt/websocketmanager2/installer/pom.xml
@@ -22,112 +22,111 @@
-->
<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">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>odlparent-lite</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-websocketmanager2-installer</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-websocketmanager2-installer</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>pom</packaging>
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
- <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
+ <properties>
+ <application.name>sdnr-wt-websocketmanager2</application.name>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
- <properties>
- <application.name>sdnr-wt-websocketmanager2</application.name>
- <include.transitive.dependencies>false</include.transitive.dependencies>
- </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>${application.name}-feature</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>features</classifier>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>${application.name}-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>${application.name}-feature</artifactId>
- <version>${project.version}</version>
- <type>xml</type>
- <classifier>features</classifier>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>${application.name}-provider</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>maven-repo-zip</id>
- <goals>
- <goal>single</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <attach>true</attach>
- <finalName>stage/${application.name}-${project.version}</finalName>
- <descriptors>
- <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
- </descriptors>
- <appendAssemblyId>true</appendAssemblyId>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <!-- <execution> -->
- <!-- <id>copy-dependencies</id> -->
- <!-- <goals> -->
- <!-- <goal>copy-dependencies</goal> -->
- <!-- </goals> -->
- <!-- <phase>prepare-package</phase> -->
- <!-- <configuration> -->
- <!-- <transitive>false</transitive> -->
- <!-- <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> -->
- <!-- <overWriteReleases>false</overWriteReleases> -->
- <!-- <overWriteSnapshots>true</overWriteSnapshots> -->
- <!-- <overWriteIfNewer>true</overWriteIfNewer> -->
- <!-- <useRepositoryLayout>true</useRepositoryLayout> -->
- <!-- <addParentPoms>false</addParentPoms> -->
- <!-- <copyPom>false</copyPom> -->
- <!-- <includeArtifactIds>${application.name}-model,${application.name}-provider,${application.name}</includeArtifactIds> -->
- <!-- <scope>provided</scope> -->
- <!-- </configuration> -->
- <!-- </execution> -->
- <execution>
- <id>copy-nested-dependencies</id>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <phase>prepare-package</phase>
- <configuration>
- <transitive>true</transitive>
- <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- <useRepositoryLayout>true</useRepositoryLayout>
- <addParentPoms>false</addParentPoms>
- <copyPom>false</copyPom>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>maven-repo-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <attach>true</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ <appendAssemblyId>true</appendAssemblyId>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+<!-- <execution> -->
+<!-- <id>copy-dependencies</id> -->
+<!-- <goals> -->
+<!-- <goal>copy-dependencies</goal> -->
+<!-- </goals> -->
+<!-- <phase>prepare-package</phase> -->
+<!-- <configuration> -->
+<!-- <transitive>false</transitive> -->
+<!-- <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> -->
+<!-- <overWriteReleases>false</overWriteReleases> -->
+<!-- <overWriteSnapshots>true</overWriteSnapshots> -->
+<!-- <overWriteIfNewer>true</overWriteIfNewer> -->
+<!-- <useRepositoryLayout>true</useRepositoryLayout> -->
+<!-- <addParentPoms>false</addParentPoms> -->
+<!-- <copyPom>false</copyPom> -->
+<!-- <includeArtifactIds>${application.name}-model,${application.name}-provider,${application.name}</includeArtifactIds> -->
+<!-- <scope>provided</scope> -->
+<!-- </configuration> -->
+<!-- </execution> -->
+ <execution>
+ <id>copy-nested-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <transitive>true</transitive>
+ <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <useRepositoryLayout>true</useRepositoryLayout>
+ <addParentPoms>false</addParentPoms>
+ <copyPom>false</copyPom>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/sdnr/wt/websocketmanager2/model/pom.xml b/sdnr/wt/websocketmanager2/model/pom.xml
index fb8261858..fed8b2e54 100644
--- a/sdnr/wt/websocketmanager2/model/pom.xml
+++ b/sdnr/wt/websocketmanager2/model/pom.xml
@@ -22,19 +22,16 @@
-->
<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">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>binding-parent</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
-
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-websocketmanager2-model</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-websocketmanager2-model</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+ <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
</project>
diff --git a/sdnr/wt/websocketmanager2/pom.xml b/sdnr/wt/websocketmanager2/pom.xml
index 9c3798611..f02ce1177 100755
--- a/sdnr/wt/websocketmanager2/pom.xml
+++ b/sdnr/wt/websocketmanager2/pom.xml
@@ -22,30 +22,30 @@
-->
<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">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>odlparent-lite</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-websocketmanager2-top</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-websocketmanager2-top</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>pom</packaging>
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
- <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
+ <properties>
+ <feature-name>sdnr-wt-websocketmanager2</feature-name>
+ </properties>
- <modules>
- <module>model</module>
- <module>provider</module>
- <module>feature</module>
- <module>installer</module>
- </modules>
+ <modules>
+ <module>model</module>
+ <module>provider</module>
+ <module>feature</module>
+ <module>installer</module>
+ </modules>
- <properties>
- <feature-name>sdnr-wt-websocketmanager2</feature-name>
- </properties>
</project>
diff --git a/sdnr/wt/websocketmanager2/provider/pom.xml b/sdnr/wt/websocketmanager2/provider/pom.xml
index 20cf96445..11d212f3f 100644
--- a/sdnr/wt/websocketmanager2/provider/pom.xml
+++ b/sdnr/wt/websocketmanager2/provider/pom.xml
@@ -11,120 +11,116 @@
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. ============LICENSE_END========================================================= -->
<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">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-websocketmanager2-provider</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
+ <packaging>bundle</packaging>
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+ <properties>
+ <maven.javadoc.skip>true</maven.javadoc.skip>
+ <checkstyle.skip>true</checkstyle.skip>
+ </properties>
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+ </license>
+ </licenses>
+<!-- <dependencyManagement> -->
+<!-- <dependencies> -->
+<!-- <dependency> -->
+<!-- <groupId>org.opendaylight.controller</groupId> -->
+<!-- <artifactId>mdsal-artifacts</artifactId> -->
+<!-- <version>1.6.1</version> -->
+<!-- <type>pom</type> -->
+<!-- <scope>import</scope> -->
+<!-- </dependency> -->
+<!-- </dependencies> -->
+<!-- </dependencyManagement> -->
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>binding-parent</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
-
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-websocketmanager2-provider</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
- <licenses>
- <license>
- <name>Apache License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0</url>
- </license>
- </licenses>
-
- <properties>
- <maven.javadoc.skip>true</maven.javadoc.skip>
- <checkstyle.skip>true</checkstyle.skip>
- </properties>
-
- <!-- <dependencyManagement> -->
- <!-- <dependencies> -->
- <!-- <dependency> -->
- <!-- <groupId>org.opendaylight.controller</groupId> -->
- <!-- <artifactId>mdsal-artifacts</artifactId> -->
- <!-- <version>1.6.1</version> -->
- <!-- <type>pom</type> -->
- <!-- <scope>import</scope> -->
- <!-- </dependency> -->
- <!-- </dependencies> -->
- <!-- </dependencyManagement> -->
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sdnr-wt-websocketmanager2-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty.websocket</groupId>
- <artifactId>websocket-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty.websocket</groupId>
- <artifactId>websocket-servlet</artifactId>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-transport</artifactId>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sdnr-wt-websocketmanager2-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.websocket</groupId>
+ <artifactId>websocket-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.websocket</groupId>
+ <artifactId>websocket-servlet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-transport</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId>
<!-- <version>${netty.version}</version> -->
- </dependency>
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- </dependency>
- <dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-actor_2.12</artifactId>
- </dependency>
- <dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-cluster_2.12</artifactId>
- </dependency>
- <dependency>
- <groupId>org.java-websocket</groupId>
- <artifactId>Java-WebSocket</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.typesafe.akka</groupId>
+ <artifactId>akka-actor_2.12</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.typesafe.akka</groupId>
+ <artifactId>akka-cluster_2.12</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.java-websocket</groupId>
+ <artifactId>Java-WebSocket</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<!-- <version>2.23.4</version> -->
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- <dependency> -->
- <!-- <groupId>org.eclipse.jetty.websocket</groupId> -->
- <!-- <artifactId>websocket-api</artifactId> -->
- <!-- <version>9.3.24.v20180605</version> -->
- <!-- </dependency> -->
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
+<!-- <dependency> -->
+<!-- <groupId>org.eclipse.jetty.websocket</groupId> -->
+<!-- <artifactId>websocket-api</artifactId> -->
+<!-- <version>9.3.24.v20180605</version> -->
+<!-- </dependency> -->
<!-- To run websockets in embedded server -->
<!-- <dependency> -->
<!-- <groupId>org.eclipse.jetty.websocket</groupId> -->
@@ -137,18 +133,18 @@
<!-- <version>9.3.24.v20180605</version> -->
<!-- <scope>test</scope> -->
<!-- </dependency> -->
- </dependencies>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ </build>
</project>
diff --git a/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManagerProvider.java b/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManagerProvider.java
index 2c54d2a78..881ee1a82 100644
--- a/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManagerProvider.java
+++ b/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManagerProvider.java
@@ -17,16 +17,22 @@
******************************************************************************/
package org.onap.ccsdk.features.sdnr.wt.websocketmanager2;
+import com.google.common.util.concurrent.ListenableFuture;
import javax.servlet.ServletException;
import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketEventInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketEventOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketmanagerService;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
import org.osgi.service.http.HttpService;
import org.osgi.service.http.NamespaceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class WebSocketManagerProvider extends Blueprint {
+public class WebSocketManagerProvider extends Blueprint implements WebsocketmanagerService {
private static final Logger LOG = LoggerFactory.getLogger(WebSocketManagerProvider.class);
private static final String APPLICATION_NAME = WebSocketManagerProvider.class.getName();
@@ -97,4 +103,14 @@ public class WebSocketManagerProvider extends Blueprint {
public void setWsServlet(WebSocketManager wsServlet) {
this.wsServlet = wsServlet;
}
+
+ @Override
+ public ListenableFuture<RpcResult<WebsocketEventOutput>> websocketEvent(WebsocketEventInput input) {
+ if (wsServlet != null) {
+ return wsServlet.websocketEvent(input);
+ } else {
+ RpcResultBuilder<WebsocketEventOutput> result = RpcResultBuilder.failed();
+ return result.withError(ErrorType.APPLICATION, "Not intialized").buildFuture();
+ }
+ }
}
diff --git a/sdnr/wt/websocketmanager2/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml b/sdnr/wt/websocketmanager2/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml
deleted file mode 100644
index 5e95b7b74..000000000
--- a/sdnr/wt/websocketmanager2/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START========================================================================
- ONAP : ccsdk feature sdnr wt
- =================================================================================================
- Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- =================================================================================================
- Licensed 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.
- ============LICENSE_END==========================================================================
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <reference id="rpcProviderRegistry" interface="org.opendaylight.mdsal.binding.api.RpcProviderService" odl:type="default" />
-
- <bean id="provider" class="org.onap.ccsdk.features.sdnr.wt.websocketmanager2.WebSocketManagerProvider" init-method="init" destroy-method="close">
- <property name="rpcProviderRegistry" ref="rpcProviderRegistry" />
- </bean>
-
- <reference id="onBindService" availability="mandatory" activation="eager" interface="org.osgi.service.http.HttpService">
- <reference-listener ref="provider" bind-method="onBindService" unbind-method="onUnbindService" />
- </reference>
-
-</blueprint>
diff --git a/sdnr/wt/websocketmanager2/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/websocketmanager2/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
index 5e95b7b74..32b19a646 100644
--- a/sdnr/wt/websocketmanager2/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
+++ b/sdnr/wt/websocketmanager2/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
@@ -30,4 +30,8 @@
<reference-listener ref="provider" bind-method="onBindService" unbind-method="onUnbindService" />
</reference>
+ <service id="registerWebsocketmanagerService"
+ interface="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketmanagerService"
+ ref="provider" />
+
</blueprint>