summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdeliveries/src/main/scripts/localize.sh29
-rwxr-xr-xdeliveries/src/main/scripts/localize_asdc.sh4
-rwxr-xr-xdeliveries/src/main/scripts/localize_cache.sh4
-rwxr-xr-xdeliveries/src/main/scripts/localize_log4j.sh4
-rwxr-xr-xdeliveries/src/main/scripts/localize_logback.sh4
-rwxr-xr-xdeliveries/src/main/scripts/localize_portal.sh4
-rwxr-xr-xdeliveries/src/main/scripts/localize_quartz.sh4
-rwxr-xr-xdeliveries/src/main/scripts/localize_system.sh4
-rwxr-xr-xdeliveries/src/main/scripts/localize_war.sh12
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controllers/HealthCheckController.java7
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java37
-rw-r--r--vid-app-common/src/test/resources/git.properties3
-rw-r--r--vid-ext-services-simulator/src/main/resources/preset_registration/changeManagement/get_sdc_catalog_services_83d587e1.json38
-rw-r--r--vid-ext-services-simulator/src/main/resources/preset_registration/general/ecompportal_getSessionSlotCheckInterval.json6
-rw-r--r--vid-ext-services-simulator/src/main/resources/preset_registration/service-design-and-creation.json18
15 files changed, 131 insertions, 47 deletions
diff --git a/deliveries/src/main/scripts/localize.sh b/deliveries/src/main/scripts/localize.sh
index 3966f702..aca557f3 100755
--- a/deliveries/src/main/scripts/localize.sh
+++ b/deliveries/src/main/scripts/localize.sh
@@ -1,18 +1,23 @@
#!/bin/bash
-#Extract the WAR so it can be customized by the localization script
-cd /tmp/vid/stage
-jar -xf vid.war
+fillTemplateProperties() {
+ source /tmp/vid/localize_war.sh $1 || {
+ echo "ERROR: Localization script failed"
+ exit 2
+ }
+}
-source /tmp/vid/localize_war.sh || {
- echo "ERROR: Localization script failed"
- exit 2
+deployWarOnTomcatManually() {
+ cd /usr/local/tomcat/webapps/
+ mkdir vid
+ cd vid
+ jar -xf /tmp/vid/stage/vid.war
}
-#Create the customized WAR and deploy it to Tomcat
-mkdir -p /tmp/vid/deployed
-cd /tmp/vid/stage
-jar -cvf /tmp/vid/deployed/vid.war .
-cd
-mv -f /tmp/vid/deployed/vid.war /usr/local/tomcat/webapps
+deployWarOnTomcatManually
+
+TEMPLATES_BASE_DIR=/usr/local/tomcat/webapps/vid/WEB-INF
+
+fillTemplateProperties ${TEMPLATES_BASE_DIR}
+
catalina.sh run
diff --git a/deliveries/src/main/scripts/localize_asdc.sh b/deliveries/src/main/scripts/localize_asdc.sh
index 549c17af..af483186 100755
--- a/deliveries/src/main/scripts/localize_asdc.sh
+++ b/deliveries/src/main/scripts/localize_asdc.sh
@@ -1,7 +1,7 @@
#!/bin/bash
-FINAL_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/asdc.properties
-TEMPLATE_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/asdc_template.properties
+FINAL_CONFIG_FILE=$1/conf/asdc.properties
+TEMPLATE_CONFIG_FILE=$1/conf/asdc_template.properties
echo "Localizing the ASDC client configuration"
diff --git a/deliveries/src/main/scripts/localize_cache.sh b/deliveries/src/main/scripts/localize_cache.sh
index d25949cc..2d676c37 100755
--- a/deliveries/src/main/scripts/localize_cache.sh
+++ b/deliveries/src/main/scripts/localize_cache.sh
@@ -1,7 +1,7 @@
#!/bin/bash
-FINAL_CONFIG_FILE=/tmp/vid/stage/WEB-INF/classes/cache.ccf
-TEMPLATE_CONFIG_FILE=/tmp/vid/stage/WEB-INF/classes/cache_template.ccf
+FINAL_CONFIG_FILE=$1/classes/cache.ccf
+TEMPLATE_CONFIG_FILE=$1/classes/cache_template.ccf
echo "Localizing the VID cache configuration"
diff --git a/deliveries/src/main/scripts/localize_log4j.sh b/deliveries/src/main/scripts/localize_log4j.sh
index d2ab2bba..121f5673 100755
--- a/deliveries/src/main/scripts/localize_log4j.sh
+++ b/deliveries/src/main/scripts/localize_log4j.sh
@@ -1,7 +1,7 @@
#!/bin/bash
-FINAL_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/log4j.properties
-TEMPLATE_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/log4j_template.properties
+FINAL_CONFIG_FILE=$1/conf/log4j.properties
+TEMPLATE_CONFIG_FILE=$1/conf/log4j_template.properties
echo "Localizing the VID log4j configuration"
diff --git a/deliveries/src/main/scripts/localize_logback.sh b/deliveries/src/main/scripts/localize_logback.sh
index 43798eb8..a0f17733 100755
--- a/deliveries/src/main/scripts/localize_logback.sh
+++ b/deliveries/src/main/scripts/localize_logback.sh
@@ -1,7 +1,7 @@
#!/bin/bash
-FINAL_CONFIG_FILE=/tmp/vid/stage/WEB-INF/classes/logback.xml
-TEMPLATE_CONFIG_FILE=/tmp/vid/stage/WEB-INF/classes/logback_template.xml
+FINAL_CONFIG_FILE=$1/classes/logback.xml
+TEMPLATE_CONFIG_FILE=$1/classes/logback_template.xml
echo "Localizing the VID logback configuration"
diff --git a/deliveries/src/main/scripts/localize_portal.sh b/deliveries/src/main/scripts/localize_portal.sh
index f29d485e..947e0e1d 100755
--- a/deliveries/src/main/scripts/localize_portal.sh
+++ b/deliveries/src/main/scripts/localize_portal.sh
@@ -1,7 +1,7 @@
#!/bin/bash
-FINAL_CONFIG_FILE=/tmp/vid/stage/WEB-INF/classes/portal.properties
-TEMPLATE_CONFIG_FILE=/tmp/vid/stage/WEB-INF/classes/portal_template.properties
+FINAL_CONFIG_FILE=$1/classes/portal.properties
+TEMPLATE_CONFIG_FILE=$1/classes/portal_template.properties
echo "Localizing the VID portal configuration"
diff --git a/deliveries/src/main/scripts/localize_quartz.sh b/deliveries/src/main/scripts/localize_quartz.sh
index c284e6c2..c22d8793 100755
--- a/deliveries/src/main/scripts/localize_quartz.sh
+++ b/deliveries/src/main/scripts/localize_quartz.sh
@@ -1,7 +1,7 @@
#!/bin/bash
-FINAL_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/quartz.properties
-TEMPLATE_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/quartz_template.properties
+FINAL_CONFIG_FILE=$1/conf/quartz.properties
+TEMPLATE_CONFIG_FILE=$1/conf/quartz_template.properties
echo "Localizing the VID quartz configuration"
diff --git a/deliveries/src/main/scripts/localize_system.sh b/deliveries/src/main/scripts/localize_system.sh
index a739335b..0947d49e 100755
--- a/deliveries/src/main/scripts/localize_system.sh
+++ b/deliveries/src/main/scripts/localize_system.sh
@@ -1,7 +1,7 @@
#!/bin/bash
-FINAL_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/system.properties
-TEMPLATE_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/system_template.properties
+FINAL_CONFIG_FILE=$1/conf/system.properties
+TEMPLATE_CONFIG_FILE=$1/conf/system_template.properties
echo "Localizing the VID system configuration"
diff --git a/deliveries/src/main/scripts/localize_war.sh b/deliveries/src/main/scripts/localize_war.sh
index f0669e0e..99cb177e 100755
--- a/deliveries/src/main/scripts/localize_war.sh
+++ b/deliveries/src/main/scripts/localize_war.sh
@@ -1,31 +1,31 @@
#!/bin/bash
-source /tmp/vid/localize_logback.sh || {
+source /tmp/vid/localize_logback.sh $1 || {
echo "ERROR: Localizing logback.xml failed"
exit 1
}
-source /tmp/vid/localize_portal.sh || {
+source /tmp/vid/localize_portal.sh $1 || {
echo "ERROR: Localizing portal.properties failed"
exit 1
}
-source /tmp/vid/localize_quartz.sh || {
+source /tmp/vid/localize_quartz.sh $1 || {
echo "ERROR: Localizing quartz.properties failed"
exit 1
}
-source /tmp/vid/localize_system.sh || {
+source /tmp/vid/localize_system.sh $1 || {
echo "ERROR: Localizing system.properties failed"
exit 1
}
-source /tmp/vid/localize_cache.sh || {
+source /tmp/vid/localize_cache.sh $1 || {
echo "ERROR: Localizing cache.ccf failed"
exit 1
}
-source /tmp/vid/localize_asdc.sh || {
+source /tmp/vid/localize_asdc.sh $1 || {
echo "ERROR: Localizing asdc.properties failed"
exit 1
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controllers/HealthCheckController.java b/vid-app-common/src/main/java/org/onap/vid/controllers/HealthCheckController.java
index 03dc8083..12cc68e6 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controllers/HealthCheckController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controllers/HealthCheckController.java
@@ -25,6 +25,7 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.dao.FnAppDoaImpl;
import org.onap.vid.model.GitRepositoryState;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -46,7 +47,6 @@ import java.util.Properties;
@RequestMapping("/")
public class HealthCheckController extends UnRestrictedBaseController {
-
/**
* The logger.
*/
@@ -58,6 +58,7 @@ public class HealthCheckController extends UnRestrictedBaseController {
final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
private static final String HEALTH_CHECK_PATH = "/healthCheck";
+ private static final String GIT_PROPERTIES_FILENAME = "git.properties";
/**
* Model for JSON response with health-check results.
@@ -193,10 +194,10 @@ public class HealthCheckController extends UnRestrictedBaseController {
return healthStatus;
}
- @RequestMapping(value = "/version", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ @RequestMapping(value = "/commitInfo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public GitRepositoryState getCommitInfo() throws IOException {
Properties properties = new Properties();
- properties.load(getClass().getClassLoader().getResourceAsStream("git.properties"));
+ properties.load(getClass().getClassLoader().getResourceAsStream(GIT_PROPERTIES_FILENAME));
return new GitRepositoryState(properties);
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java
index ca7a163a..6055bc39 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java
@@ -1,18 +1,32 @@
package org.onap.vid.controllers;
+import org.apache.log4j.BasicConfigurator;
+import org.junit.Before;
import org.junit.Test;
-import org.onap.vid.controllers.HealthCheckController;
import org.onap.vid.controllers.HealthCheckController.HealthStatus;
+import org.springframework.http.MediaType;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
public class HealthCheckControllerTest {
- private HealthCheckController createTestSubject() {
- return new HealthCheckController();
+ private HealthCheckController testSubject;
+ private MockMvc mockMvc;
+
+ @Before
+ public void setUp() {
+ testSubject = new HealthCheckController();
+ BasicConfigurator.configure();
+ mockMvc = MockMvcBuilders.standaloneSetup(testSubject).build();
}
@Test
public void testGetProfileCount() throws Exception {
- HealthCheckController testSubject;
String driver = "";
String URL = "";
String username = "";
@@ -20,29 +34,34 @@ public class HealthCheckControllerTest {
int result;
// default test
- testSubject = createTestSubject();
result = testSubject.getProfileCount(driver, URL, username, password);
}
@Test
public void testGethealthCheckStatusforIDNS() throws Exception {
- HealthCheckController testSubject;
HealthStatus result;
// default test
- testSubject = createTestSubject();
result = testSubject.gethealthCheckStatusforIDNS();
}
@Test
public void testGetHealthCheck() throws Exception {
- HealthCheckController testSubject;
String UserAgent = "";
String ECOMPRequestID = "";
HealthStatus result;
// default test
- testSubject = createTestSubject();
result = testSubject.getHealthCheck(UserAgent, ECOMPRequestID);
}
+
+ @Test
+ public void testCommitInfoEndpoint() throws Exception {
+ mockMvc.perform(get("/commitInfo")
+ .accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.commitId").value("123987"))
+ .andExpect(jsonPath("$.commitMessageShort").value("Test short commit message"))
+ .andExpect(jsonPath("$.commitTime").value("1999-09-12T13:48:55+0200"));
+ }
} \ No newline at end of file
diff --git a/vid-app-common/src/test/resources/git.properties b/vid-app-common/src/test/resources/git.properties
new file mode 100644
index 00000000..d504e3e8
--- /dev/null
+++ b/vid-app-common/src/test/resources/git.properties
@@ -0,0 +1,3 @@
+git.commit.id=123987
+git.commit.message.short=Test short commit message
+git.commit.time=1999-09-12T13\:48\:55+0200 \ No newline at end of file
diff --git a/vid-ext-services-simulator/src/main/resources/preset_registration/changeManagement/get_sdc_catalog_services_83d587e1.json b/vid-ext-services-simulator/src/main/resources/preset_registration/changeManagement/get_sdc_catalog_services_83d587e1.json
new file mode 100644
index 00000000..0bc179c6
--- /dev/null
+++ b/vid-ext-services-simulator/src/main/resources/preset_registration/changeManagement/get_sdc_catalog_services_83d587e1.json
@@ -0,0 +1,38 @@
+[
+ {
+ "simulatorRequest": {
+ "method": "GET",
+ "path": "/sdc/v1/catalog/services/83d587e1-742d-4cb0-b087-3963b012dfe3/toscaModel"
+ },
+ "simulatorResponse": {
+ "responseCode": 200,
+ "file": "csar15782222_instantiationTypeMacroWithPnf.zip"
+ }
+ },
+ {
+ "simulatorRequest": {
+ "method": "GET",
+ "path": "/sdc/v1/catalog/services/83d587e1-742d-4cb0-b087-3963b012dfe3/metadata"
+ },
+ "simulatorResponse": {
+ "responseCode": 200,
+ "responseHeaders": {
+ "Content-Type": "application/json"
+ },
+ "body": {
+ "uuid": "83d587e1-742d-4cb0-b087-3963b012dfe3",
+ "invariantUUID": "any-id",
+ "name": "test-pnf",
+ "version": "1.0",
+ "toscaModelURL": "./csar15782222_instantiationTypeMacroWithPnf.zip",
+ "category": "Mobility",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ }
+ }
+ }
+] \ No newline at end of file
diff --git a/vid-ext-services-simulator/src/main/resources/preset_registration/general/ecompportal_getSessionSlotCheckInterval.json b/vid-ext-services-simulator/src/main/resources/preset_registration/general/ecompportal_getSessionSlotCheckInterval.json
index a43092ef..cc7f76c5 100644
--- a/vid-ext-services-simulator/src/main/resources/preset_registration/general/ecompportal_getSessionSlotCheckInterval.json
+++ b/vid-ext-services-simulator/src/main/resources/preset_registration/general/ecompportal_getSessionSlotCheckInterval.json
@@ -2,7 +2,7 @@
{
"simulatorRequest": {
"method": "GET",
- "path": "/ecompportal_att/auxapi//getSessionSlotCheckInterval"
+ "path": "/ONAPPORTAL/auxapi/v[0-9]+/getSessionSlotCheckInterval"
},
"simulatorResponse": {
"responseCode": 200,
@@ -12,7 +12,7 @@
{
"simulatorRequest": {
"method": "POST",
- "path": "/ecompportal_att/auxapi//extendSessionTimeOuts"
+ "path": "/ONAPPORTAL/auxapi//extendSessionTimeOuts"
},
"simulatorResponse": {
"responseCode": 200,
@@ -22,7 +22,7 @@
{
"simulatorRequest": {
"method": "GET",
- "path": "/ecompportal_att/auxapi/context/get_user"
+ "path": "/ONAPPORTAL/auxapi/context/get_user"
},
"simulatorResponse": {
"responseCode": 200,
diff --git a/vid-ext-services-simulator/src/main/resources/preset_registration/service-design-and-creation.json b/vid-ext-services-simulator/src/main/resources/preset_registration/service-design-and-creation.json
index 679c5d77..04b1f995 100644
--- a/vid-ext-services-simulator/src/main/resources/preset_registration/service-design-and-creation.json
+++ b/vid-ext-services-simulator/src/main/resources/preset_registration/service-design-and-creation.json
@@ -428,6 +428,24 @@
]
}
}
+ },
+ {
+ "model": {
+ "model-invariant-id": "any-id",
+ "model-type": "resource",
+ "resource-version": "10001",
+ "model-vers": {
+ "model-ver": [
+ {
+ "model-version-id": "83d587e1-742d-4cb0-b087-3963b012dfe3",
+ "model-name": "pnf-test",
+ "model-version": "1.0",
+ "model-description": "Should ask about CorrelationId",
+ "resource-version": "200021"
+ }
+ ]
+ }
+ }
}
]
}