diff options
author | LaMont, William (wl2432) <wl2432@att.com> | 2020-06-26 17:24:51 -0400 |
---|---|---|
committer | LaMont, William (wl2432) <wl2432@att.com> | 2020-06-26 17:25:39 -0400 |
commit | 9666d712661e58fa4918f9c49d03fde6f4434e07 (patch) | |
tree | 575ea35b8ae09ec5a07acf5af212fe4fa91f94f3 /aai-resources/src | |
parent | 486d7f22a047b1465abc5a1365560ebf44c0e589 (diff) |
support for v20
Issue-ID: AAI-2965
Change-Id: I87737d2cfcf6b499af6083c2355042d66278e73c
Signed-off-by: LaMont, William (wl2432) <wl2432@att.com>
Diffstat (limited to 'aai-resources/src')
20 files changed, 62 insertions, 35 deletions
diff --git a/aai-resources/src/main/assembly/descriptor.xml b/aai-resources/src/main/assembly/descriptor.xml index 08e253f..1c3d166 100644 --- a/aai-resources/src/main/assembly/descriptor.xml +++ b/aai-resources/src/main/assembly/descriptor.xml @@ -13,6 +13,7 @@ <includes> <include>**/*</include> </includes> + <fileMode>755</fileMode> </fileSet> <fileSet> <directory>${project.basedir}/src/main/scripts</directory> @@ -20,6 +21,7 @@ <includes> <include>**/*</include> </includes> + <fileMode>777</fileMode> </fileSet> <fileSet> <directory>${project.build.directory}</directory> @@ -27,6 +29,7 @@ <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> + <fileMode>755</fileMode> </fileSet> </fileSets> </assembly> diff --git a/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java index 3f595d1..4bd1a0d 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java @@ -354,8 +354,7 @@ public abstract class BulkConsumer extends RESTAPI { throw new AAIException("AAI_6111", String.format("input payload does not follow %s interface", module)); } } - - Gson gson = new Gson(); + Gson gson = new GsonBuilder().serializeNulls().create(); String bodyStr = gson.toJson(bodyObj); bulkOperation.setRawReq(bodyStr); diff --git a/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java index e6dcc77..8939d04 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java @@ -227,7 +227,8 @@ public class LegacyMoxyConsumer extends RESTAPI { SchemaVersion version = new SchemaVersion(versionParam); final HttpEntry traversalUriHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class); - traversalUriHttpEntry.setHttpEntryProperties(version); + String serverBase = req.getRequestURL().toString().replaceAll("/(v[0-9]+|latest)/.*", "/"); + traversalUriHttpEntry.setHttpEntryProperties(version, serverBase); dbEngine = traversalUriHttpEntry.getDbEngine(); loader = traversalUriHttpEntry.getLoader(); MultivaluedMap<String, String> params = info.getQueryParameters(); @@ -438,7 +439,7 @@ public class LegacyMoxyConsumer extends RESTAPI { @Path("/{uri: .+}/relationship-list") @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) - public Response getRelationshipList (@DefaultValue("-1") @QueryParam("resultIndex") String resultIndex, @DefaultValue("-1") @QueryParam("resultSize") String resultSize, @PathParam("version")String versionParam, @PathParam("uri") @Encoded String uri, @DefaultValue("false") @QueryParam("cleanup") String cleanUp, @Context HttpHeaders headers, @Context UriInfo info) { + public Response getRelationshipList (@DefaultValue("-1") @QueryParam("resultIndex") String resultIndex, @DefaultValue("-1") @QueryParam("resultSize") String resultSize, @PathParam("version")String versionParam, @PathParam("uri") @Encoded String uri, @DefaultValue("false") @QueryParam("cleanup") String cleanUp, @Context HttpHeaders headers, @Context HttpServletRequest req,@Context UriInfo info) { return runner(AAIConstants.AAI_CRUD_TIMEOUT_ENABLED, AAIConstants.AAI_CRUD_TIMEOUT_APP, AAIConstants.AAI_CRUD_TIMEOUT_LIMIT, @@ -448,7 +449,7 @@ public class LegacyMoxyConsumer extends RESTAPI { new AaiCallable<Response>() { @Override public Response process() { - return getRelationshipList(versionParam, uri, cleanUp, headers, info, resultIndex, resultSize); + return getRelationshipList(versionParam, req, uri, cleanUp, headers, info, resultIndex, resultSize); } } ); @@ -463,7 +464,7 @@ public class LegacyMoxyConsumer extends RESTAPI { * @param info * @return */ - public Response getRelationshipList(String versionParam, String uri, String cleanUp, HttpHeaders headers, UriInfo info, String resultIndex, String resultSize) { + public Response getRelationshipList(String versionParam, HttpServletRequest req, String uri, String cleanUp, HttpHeaders headers, UriInfo info, String resultIndex, String resultSize) { String sourceOfTruth = headers.getRequestHeaders().getFirst("X-FromAppId"); String transId = headers.getRequestHeaders().getFirst("X-TransactionId"); Response response = null; @@ -475,7 +476,8 @@ public class LegacyMoxyConsumer extends RESTAPI { SchemaVersion version = new SchemaVersion(versionParam); final HttpEntry traversalUriHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class); - traversalUriHttpEntry.setHttpEntryProperties(version); + String serverBase = req.getRequestURL().toString().replaceAll("/(v[0-9]+|latest)/.*", "/"); + traversalUriHttpEntry.setHttpEntryProperties(version, serverBase); dbEngine = traversalUriHttpEntry.getDbEngine(); loader = traversalUriHttpEntry.getLoader(); MultivaluedMap<String, String> params = info.getQueryParameters(); diff --git a/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java index 041952b..9293569 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java @@ -74,7 +74,8 @@ public class URLFromVertexIdConsumer extends RESTAPI { TransactionalGraphEngine dbEngine = null; try { HttpEntry resourceHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class); - resourceHttpEntry.setHttpEntryProperties(version); + String serverBase = req.getRequestURL().toString().replaceAll("/(v[0-9]+|latest)/.*", "/"); + resourceHttpEntry.setHttpEntryProperties(version, serverBase); dbEngine = resourceHttpEntry.getDbEngine(); DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, sourceOfTruth); @@ -88,7 +89,7 @@ public class URLFromVertexIdConsumer extends RESTAPI { result.append(uri.getRawPath()); result.insert(0, version); - result.insert(0, AAIConfig.get("aai.server.url.base")); + result.insert(0, serverBase); response = Response.ok().entity(result.toString()).status(Status.OK).type(MediaType.TEXT_PLAIN).build(); } catch (AAIException e) { //TODO check that the details here are sensible diff --git a/aai-resources/src/main/resources/application.properties b/aai-resources/src/main/resources/application.properties index 7dee2b2..e26199c 100644 --- a/aai-resources/src/main/resources/application.properties +++ b/aai-resources/src/main/resources/application.properties @@ -40,10 +40,13 @@ server.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0) server.ssl.client-auth=want server.ssl.key-store-type=JKS +null.db.serialization.enabled=true + # JMS bind address host port jms.bind.address=tcp://localhost:61647 dmaap.ribbon.listOfServers=localhost:3904 + # Schema related attributes for the oxm and edges # Any additional schema related attributes should start with prefix schema schema.configuration.location=N/A diff --git a/aai-resources/src/main/resources/etc/appprops/aaiconfig.properties b/aai-resources/src/main/resources/etc/appprops/aaiconfig.properties index f53fca0..42fbbfc 100644 --- a/aai-resources/src/main/resources/etc/appprops/aaiconfig.properties +++ b/aai-resources/src/main/resources/etc/appprops/aaiconfig.properties @@ -45,7 +45,7 @@ aai.tools.username=AAI aai.tools.password=AAI aai.server.url.base=https://localhost:8443/aai/ -aai.server.url=https://localhost:8443/aai/v19/ +aai.server.url=https://localhost:8443/aai/v20/ aai.global.callback.url=https://localhost:8443/aai/ aai.truststore.filename=aai_keystore @@ -53,18 +53,18 @@ aai.truststore.passwd.x=OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0 aai.keystore.filename=aai-client-cert.p12 aai.keystore.passwd.x= -aai.notification.current.version=v19 +aai.notification.current.version=v20 aai.notificationEvent.default.status=UNPROCESSED aai.notificationEvent.default.eventType=AAI-EVENT aai.notificationEvent.default.domain=devINT1 aai.notificationEvent.default.sourceName=aai aai.notificationEvent.default.sequenceNumber=0 aai.notificationEvent.default.severity=NORMAL -aai.notificationEvent.default.version=v19 +aai.notificationEvent.default.version=v20 # This one lets us enable/disable resource-version checking on updates/deletes aai.resourceversion.enableflag=true aai.logging.maxStackTraceEntries=10 -aai.default.api.version=v19 +aai.default.api.version=v20 # Used by Model-processing code aai.model.delete.sleep.per.vtx.msec=500 @@ -156,3 +156,5 @@ aai.implied.delete.log.enabled=false ################################################################################# aai.implied.delete.whitelist.sdnc='vce' aai.implied.delete.whitelist.ro='vserver' + +property.null.validation.enabled=true
\ No newline at end of file diff --git a/aai-resources/src/main/resources/etc/appprops/error.properties b/aai-resources/src/main/resources/etc/appprops/error.properties index b2dc448..6e5630c 100644 --- a/aai-resources/src/main/resources/etc/appprops/error.properties +++ b/aai-resources/src/main/resources/etc/appprops/error.properties @@ -125,6 +125,7 @@ AAI_6146=5:4:ERROR:6146:400:3000:Ambiguous identity map found, use a URI instead AAI_6147=5:4:ERROR:6147:400:3000:Payload Limit Reached, reduce payload:300 AAI_6148=5:4:ERROR:6148:400:3000:More than one node found %1:300 AAI_6149=5:4:ERROR:6149:404:3000:No relationship was found:300 +AAI_6150=5:4:ERROR:6150:200:3000:DB object with required field serialized with empty or null value #--- aaicsvp: 7101-7199 AAI_7101=5:4:ERROR:7101:500:3002:Unexpected error in CSV file processing:900 diff --git a/aai-resources/src/main/scripts/bulkprocess.sh b/aai-resources/src/main/scripts/bulkprocess.sh index c4bca27..7366bf2 100644 --- a/aai-resources/src/main/scripts/bulkprocess.sh +++ b/aai-resources/src/main/scripts/bulkprocess.sh @@ -29,12 +29,16 @@ inputFolder=$1 if [ -z "$1" ]; then echo "Input folder string is empty." - exit 1 + exit 1 fi -if [ ! -d "/opt/bulkprocess_load/$1" ]; then - echo "Input folder could not be found." - exit 1 +if [ ! -d "$inputFolder" ]; then + if [ ! -d "/opt/bulkprocess_load/$1" ]; then + echo "Input folder could not be found." + exit 1 + else + inputFolder="/opt/bulkprocess_load/$1" + fi fi XFROMAPPID=$2 @@ -50,7 +54,7 @@ esac XTRANSID=$3 -for input_file in $(ls -v /opt/bulkprocess_load/${inputFolder}/*); +for input_file in $(ls -v ${inputFolder}/*); do output_file=$(basename $input_file | sed 's/.json//g'); /opt/app/aai-resources/scripts/putTool.sh /bulkprocess ${input_file} -display $XFROMAPPID $XTRANSID > /tmp/${output_file}.$(date +"%Y%m%d%H%M%S").results.json; diff --git a/aai-resources/src/main/scripts/common_functions.sh b/aai-resources/src/main/scripts/common_functions.sh index 14358d9..d5bebac 100644 --- a/aai-resources/src/main/scripts/common_functions.sh +++ b/aai-resources/src/main/scripts/common_functions.sh @@ -36,7 +36,6 @@ check_user(){ # Sources the profile and sets the project home source_profile(){ - . /etc/profile.d/aai.sh PROJECT_HOME=/opt/app/aai-resources } diff --git a/aai-resources/src/main/scripts/deleteTool.sh b/aai-resources/src/main/scripts/deleteTool.sh index 3d7f923..c2dc05c 100644 --- a/aai-resources/src/main/scripts/deleteTool.sh +++ b/aai-resources/src/main/scripts/deleteTool.sh @@ -63,7 +63,7 @@ if [ "${userid}" != "aaiadmin" ]; then exit 1 fi -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties log_dir=$PROJECT_HOME/logs/misc diff --git a/aai-resources/src/main/scripts/getTool.sh b/aai-resources/src/main/scripts/getTool.sh index e2ca220..8ff502b 100644 --- a/aai-resources/src/main/scripts/getTool.sh +++ b/aai-resources/src/main/scripts/getTool.sh @@ -58,7 +58,7 @@ if [ "${userid}" != "aaiadmin" ]; then exit 1 fi -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties log_dir=$PROJECT_HOME/logs/misc diff --git a/aai-resources/src/main/scripts/install/addManualData.sh b/aai-resources/src/main/scripts/install/addManualData.sh index bd7f7bd..645f7c8 100644 --- a/aai-resources/src/main/scripts/install/addManualData.sh +++ b/aai-resources/src/main/scripts/install/addManualData.sh @@ -43,7 +43,6 @@ contains() { fi } -. /etc/profile.d/aai.sh PROJECT_HOME=/opt/app/aai-resources PROGNAME=$(basename $0) diff --git a/aai-resources/src/main/scripts/putTool.sh b/aai-resources/src/main/scripts/putTool.sh index 4e55b0c..bc84010 100644 --- a/aai-resources/src/main/scripts/putTool.sh +++ b/aai-resources/src/main/scripts/putTool.sh @@ -90,7 +90,7 @@ if [ "${userid}" != "aaiadmin" ]; then exit 1 fi -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties log_dir=$PROJECT_HOME/logs/misc diff --git a/aai-resources/src/main/scripts/rshipTool.sh b/aai-resources/src/main/scripts/rshipTool.sh index 3952d44..3ee1c04 100644 --- a/aai-resources/src/main/scripts/rshipTool.sh +++ b/aai-resources/src/main/scripts/rshipTool.sh @@ -111,7 +111,7 @@ if [ "${userid}" != "aaiadmin" ]; then exit 1 fi -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties log_dir=$PROJECT_HOME/logs/misc diff --git a/aai-resources/src/main/scripts/updateTool.sh b/aai-resources/src/main/scripts/updateTool.sh index ce0a8f6..347640e 100644 --- a/aai-resources/src/main/scripts/updateTool.sh +++ b/aai-resources/src/main/scripts/updateTool.sh @@ -94,7 +94,7 @@ if [ "${userid}" != "aaiadmin" ]; then exit 1 fi -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties log_dir=$PROJECT_HOME/logs/misc diff --git a/aai-resources/src/main/scripts/vmExportCloudRegions.sh b/aai-resources/src/main/scripts/vmExportCloudRegions.sh index 95ec969..a8d14e3 100644 --- a/aai-resources/src/main/scripts/vmExportCloudRegions.sh +++ b/aai-resources/src/main/scripts/vmExportCloudRegions.sh @@ -337,7 +337,7 @@ addValidateVserver() { COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P ) . ${COMMON_ENV_PATH}/common_functions.sh -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources PROGNAME=$(basename $0) diff --git a/aai-resources/src/main/scripts/vmUpdateExport.sh b/aai-resources/src/main/scripts/vmUpdateExport.sh index f492d2c..6bd4ca9 100644 --- a/aai-resources/src/main/scripts/vmUpdateExport.sh +++ b/aai-resources/src/main/scripts/vmUpdateExport.sh @@ -21,8 +21,7 @@ ### # -# vmUpdateExport.sh -- This tool updates the files generated in A&AI to -# match what is expected in narad +# vmUpdateExport.sh -- This tool updates the files generated in A&AI # The script takes no arguments addTemplates() { @@ -33,7 +32,7 @@ addTemplates() { COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P ) . ${COMMON_ENV_PATH}/common_functions.sh -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources PROGNAME=$(basename $0) diff --git a/aai-resources/src/main/scripts/vmValidateCloudRegions.sh b/aai-resources/src/main/scripts/vmValidateCloudRegions.sh index a8189e3..b7e30ee 100644 --- a/aai-resources/src/main/scripts/vmValidateCloudRegions.sh +++ b/aai-resources/src/main/scripts/vmValidateCloudRegions.sh @@ -56,7 +56,7 @@ renamefiles() { } -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources PROGNAME=$(basename $0) diff --git a/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java index 748b032..84ac1a8 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java @@ -43,14 +43,17 @@ import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.test.annotation.DirtiesContext; +import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.*; import java.io.IOException; import java.util.*; import static org.junit.Assert.*; import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +// TODO: Change the following test to use spring boot public class LegacyMoxyConsumerTest extends AAISetup { protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json"); @@ -594,7 +597,9 @@ public class LegacyMoxyConsumerTest extends AAISetup { when(uriInfo.getPath()).thenReturn(uri); when(uriInfo.getPath(false)).thenReturn(uri); - MockHttpServletRequest mockReqGet = new MockHttpServletRequest("GET", uri); + HttpServletRequest mockRequest = Mockito.mock(HttpServletRequest.class); + when(mockRequest.getRequestURL()).thenReturn(new StringBuffer("https://localhost:8447/aai/v15/" + uri)); + Response response = legacyMoxyConsumer.getLegacy( "", null, @@ -605,21 +610,20 @@ public class LegacyMoxyConsumerTest extends AAISetup { "false", httpHeaders, uriInfo, - mockReqGet + mockRequest ); assertNotNull("Response from the legacy moxy consumer returned null", response); assertEquals("Expected to not have the data already in memory", Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); - MockHttpServletRequest mockReq = new MockHttpServletRequest("PUT", uri); response = legacyMoxyConsumer.update( payload, schemaVersions.getDefaultVersion().toString(), uri, httpHeaders, uriInfo, - mockReq + mockRequest ); assertNotNull("Response from the legacy moxy consumer returned null", response); @@ -641,7 +645,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { "false", httpHeaders, uriInfo, - mockReqGet + mockRequest ); assertNotNull("Response from the legacy moxy consumer returned null", response); @@ -838,6 +842,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { "cloud-infrastructure/pservers/pserver/%s/relationship-list", hostname); String getRelationshipUri = String.format( "cloud-infrastructure/pservers/pserver/%s", hostname); + HttpServletRequest mockRequest = Mockito.mock(HttpServletRequest.class); + when(mockRequest.getRequestURL()).thenReturn(new StringBuffer("https://localhost:8447/aai/v15/" + getRelationshipUri)); response = legacyMoxyConsumer.getRelationshipList( "1", "1", @@ -845,6 +851,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { getRelationshipUri, "false", httpHeaders, + mockRequest, uriInfo ); @@ -902,6 +909,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { String getRelationshipUri = String.format( "cloud-infrastructure/pservers/pserver/%s", hostname); queryParameters.add("format", "resource"); + HttpServletRequest mockRequest = Mockito.mock(HttpServletRequest.class); + when(mockRequest.getRequestURL()).thenReturn(new StringBuffer("https://localhost:8447/aai/v15/" + getRelationshipUri)); response = legacyMoxyConsumer.getRelationshipList( "1", "1", @@ -909,6 +918,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { getRelationshipUri, "false", httpHeaders, + mockRequest, uriInfo ); queryParameters.remove("format"); @@ -971,6 +981,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { String getRelationshipUri = String.format( "cloud-infrastructure/pservers/pserver/%s", hostname); MockHttpServletRequest mockReq = new MockHttpServletRequest("GET_RELATIONSHIP", getRelationshipMockRequestUri); + HttpServletRequest mockRequest = Mockito.mock(HttpServletRequest.class); + when(mockRequest.getRequestURL()).thenReturn(new StringBuffer("https://localhost:8447/aai/v15/" + getRelationshipUri)); Response response = legacyMoxyConsumer.getRelationshipList( "1", "1", @@ -978,6 +990,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { getRelationshipUri, "false", httpHeaders, + mockRequest, uriInfo ); diff --git a/aai-resources/src/test/resources/etc/appprops/aaiconfig.properties b/aai-resources/src/test/resources/etc/appprops/aaiconfig.properties index 41862dc..a279738 100644 --- a/aai-resources/src/test/resources/etc/appprops/aaiconfig.properties +++ b/aai-resources/src/test/resources/etc/appprops/aaiconfig.properties @@ -54,3 +54,5 @@ aai.realtime.clients=RO,SDNC,MSO aai.run.migrations=false aai.jms.enable=false + +property.null.validation.enabled=true |