aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-03-06 20:31:13 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-06 20:31:13 +0000
commit16f322b6f8d5ab0d0d7b55d2e626e18afcba53f1 (patch)
treec75fd916d42224cef96019b1d6cb5d613d22882e
parent02c5ac21fde242f7bd12525fc244bdbe64f1a4e6 (diff)
parent46b1c7615d317a74c2c159779f2a5a711292defd (diff)
Merge "SDN-R apigateway add junit test"
-rw-r--r--sdnr/wt/apigateway/feature/pom.xml2
-rwxr-xr-xsdnr/wt/apigateway/installer/pom.xml1
-rwxr-xr-xsdnr/wt/apigateway/pom.xml65
-rw-r--r--sdnr/wt/apigateway/provider/pom.xml125
-rw-r--r--sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestMediatorServerServlet.java104
-rw-r--r--sdnr/wt/apigateway/provider/tmp3.cfg5
6 files changed, 158 insertions, 144 deletions
diff --git a/sdnr/wt/apigateway/feature/pom.xml b/sdnr/wt/apigateway/feature/pom.xml
index f8ec8b23d..9cde0962e 100644
--- a/sdnr/wt/apigateway/feature/pom.xml
+++ b/sdnr/wt/apigateway/feature/pom.xml
@@ -51,7 +51,7 @@
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>mdsal-artifacts</artifactId>
- <version>1.8.1</version>
+ <version>${odl.controller.mdsal.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
diff --git a/sdnr/wt/apigateway/installer/pom.xml b/sdnr/wt/apigateway/installer/pom.xml
index 1d1802691..7ab192b91 100755
--- a/sdnr/wt/apigateway/installer/pom.xml
+++ b/sdnr/wt/apigateway/installer/pom.xml
@@ -13,6 +13,7 @@
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
<version>1.2.1-SNAPSHOT</version>
+ <relativePath />
</parent>
<properties>
diff --git a/sdnr/wt/apigateway/pom.xml b/sdnr/wt/apigateway/pom.xml
index 33ce77264..e59e17cbd 100755
--- a/sdnr/wt/apigateway/pom.xml
+++ b/sdnr/wt/apigateway/pom.xml
@@ -1,28 +1,51 @@
<?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>
+<!--
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-apigateway-top</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.feature.sdnr.wt
+ * ================================================================================
+ * Copyright (C) 2018 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=========================================================
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>odlparent-lite</artifactId>
- <version>1.2.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
+-->
+<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>
- <modules>
- <module>feature</module>
- <module>provider</module>
- <module>installer</module>
- </modules>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-apigateway-top</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
- <properties>
- <feature-name>sdnr-wt-apigateway</feature-name>
- </properties>
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>1.2.1-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <modules>
+ <module>feature</module>
+ <module>provider</module>
+ <module>installer</module>
+ </modules>
+
+ <properties>
+ <feature-name>sdnr-wt-apigateway</feature-name>
+ </properties>
</project>
diff --git a/sdnr/wt/apigateway/provider/pom.xml b/sdnr/wt/apigateway/provider/pom.xml
index d375ee5cd..5f53dbb48 100644
--- a/sdnr/wt/apigateway/provider/pom.xml
+++ b/sdnr/wt/apigateway/provider/pom.xml
@@ -1,70 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- * ============LICENSE_START=======================================================
- * ONAP : CCSDK.sdnr.wt.apigateway.provider * ================================================================================
- * Copyright (C) 2018 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========================================================= -->
+<!-- * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.sdnr.wt.apigateway.provider * ================================================================================
+ * Copyright (C) 2018 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========================================================= -->
<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">
+ 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">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-apigateway-provider</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- <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.2.1-SNAPSHOT</version>
- <relativePath />
- </parent>
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.7.25</version>
- </dependency>
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- <version>20131018</version>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>2.23.4</version>
- <scope>test</scope>
- </dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-apigateway-provider</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ <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.2.1-SNAPSHOT</version>
+ <relativePath />
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
- </dependencies>
- <build>
- <plugins>
- <!-- fixed bug for sonarcube -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <useSystemClassLoader>false</useSystemClassLoader>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ </dependencies>
+ <build>
+ <plugins>
+ <!-- fixed bug for sonarcube -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <useSystemClassLoader>false</useSystemClassLoader>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestMediatorServerServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestMediatorServerServlet.java
index d4197c6db..7fa20f788 100644
--- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestMediatorServerServlet.java
+++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestMediatorServerServlet.java
@@ -1,71 +1,69 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP : CCSDK.apps.sdnr.wt.apigateway
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= ONAP :
+ * CCSDK.apps.sdnr.wt.apigateway
+ * ================================================================================ 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
+ * 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=========================================================
+ * 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 java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
-
import javax.servlet.ServletException;
-
import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.apigateway.MyProperties;
import org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper.HelpMsServlet;
import org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper.HelpServletBase;
-public class TestMediatorServerServlet extends HelpServletBase{
+public class TestMediatorServerServlet extends HelpServletBase {
+
+ private static final int PORT = 40004;
+
+ public TestMediatorServerServlet() {
+ super("/ms", PORT);
+ }
+
+ @Test
+ public void test() throws ServletException, IOException {
+
+ String tmpFilename = "tmp3.cfg";
+ File tmpFile = new File(tmpFilename);
+ if (tmpFile.exists()) {
+ tmpFile.delete();
+ }
+ MyProperties.Instantiate(tmpFile, true);
+ String query = "{\"query\":{\"match_all\":{}}}";
+ HelpMsServlet servlet = new HelpMsServlet();
+ this.setServlet(servlet);
+ // test diabled message
+ servlet.setOfflineStatus(true);
+ servlet.setBaseUrl("http://localhost:" + PORT);
+ String expectedResponse = "offline";
+ testrequest(HTTPMETHOD_GET, query, expectedResponse, false);
+ testrequest(HTTPMETHOD_POST, query, expectedResponse, false);
+ testrequest(HTTPMETHOD_PUT, query, expectedResponse, false);
+ testrequest(HTTPMETHOD_DELETE, query, expectedResponse, false);
+
+ servlet.setOfflineStatus(false);
+ testrequest(HTTPMETHOD_GET, query, HelpMsServlet.RESPONSE_GET, true);
+ testrequest(HTTPMETHOD_POST, query, HelpMsServlet.RESPONSE_POST, true);
+ testrequest(HTTPMETHOD_PUT, query, HelpMsServlet.RESPONSE_PUT, true);
+ testrequest(HTTPMETHOD_DELETE, query, HelpMsServlet.RESPONSE_DELETE, true);
+ testrequest(HTTPMETHOD_OPTIONS, query, "", false);
- private static final int PORT = 40004;
+ if (tmpFile.exists()) {
+ tmpFile.delete();
+ }
- public TestMediatorServerServlet() {
- super("/ms",PORT);
- }
-
- @Test
- public void test() throws ServletException, IOException {
-
- String tmpFilename = "tmp3.cfg";
- File tmpFile = new File(tmpFilename);
- if (tmpFile.exists())
- tmpFile.delete();
- MyProperties.Instantiate(tmpFile,true);
- String query = "{\"query\":{\"match_all\":{}}}";
- HelpMsServlet servlet = new HelpMsServlet();
- this.setServlet(servlet);
- // test diabled message
- servlet.setOfflineStatus(true);
- servlet.setBaseUrl("http://localhost:"+PORT);
- String expectedResponse = "offline";
- testrequest(HTTPMETHOD_GET, query, expectedResponse, false);
- testrequest(HTTPMETHOD_POST, query, expectedResponse, false);
- testrequest(HTTPMETHOD_PUT, query, expectedResponse, false);
- testrequest(HTTPMETHOD_DELETE, query, expectedResponse, false);
-
- servlet.setOfflineStatus(false);
- testrequest(HTTPMETHOD_GET, query, HelpMsServlet.RESPONSE_GET, true);
- testrequest(HTTPMETHOD_POST, query, HelpMsServlet.RESPONSE_POST, true);
- testrequest(HTTPMETHOD_PUT, query, HelpMsServlet.RESPONSE_PUT, true);
- testrequest(HTTPMETHOD_DELETE, query, HelpMsServlet.RESPONSE_DELETE, true);
- testrequest(HTTPMETHOD_OPTIONS, query, "", false);
-
- }
+ }
}
diff --git a/sdnr/wt/apigateway/provider/tmp3.cfg b/sdnr/wt/apigateway/provider/tmp3.cfg
deleted file mode 100644
index c8f5897b7..000000000
--- a/sdnr/wt/apigateway/provider/tmp3.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-aai=off
-aaiHeaders=["X-FromAppId:SDNR","Authorization:Basic QUFJOkFBSQ=="]
-database=http://localhost:9200
-insecure=0
-cors=0 \ No newline at end of file