diff options
Diffstat (limited to 'aai-resources/src/test')
42 files changed, 1274 insertions, 283 deletions
diff --git a/aai-resources/src/test/java/org/onap/aai/AAISetup.java b/aai-resources/src/test/java/org/onap/aai/AAISetup.java index acef23b..9a12007 100644 --- a/aai-resources/src/test/java/org/onap/aai/AAISetup.java +++ b/aai-resources/src/test/java/org/onap/aai/AAISetup.java @@ -19,38 +19,32 @@ */ package org.onap.aai; -import static org.junit.Assert.assertNotNull; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; - import org.apache.commons.io.IOUtils; import org.junit.BeforeClass; -import org.onap.aai.config.ConfigConfiguration; -import org.onap.aai.config.SpringContextAware; -import org.onap.aai.config.IntrospectionConfig; +import org.junit.ClassRule; +import org.junit.Rule; +import org.onap.aai.config.*; +import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.introspection.LoaderFactory; -import org.onap.aai.logging.LoggingContext; +import org.onap.aai.introspection.MoxyLoader; import org.onap.aai.nodes.NodeIngestor; -import org.onap.aai.config.RestBeanConfig; import org.onap.aai.rest.db.HttpEntry; -import org.onap.aai.setup.SchemaLocationsBean; +import org.onap.aai.serialization.db.EdgeSerializer; +import org.onap.aai.setup.AAIConfigTranslator; import org.onap.aai.setup.SchemaVersion; import org.onap.aai.setup.SchemaVersions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; -import org.onap.aai.introspection.MoxyLoader; - -import org.junit.ClassRule; -import org.junit.Rule; -import org.onap.aai.edges.EdgeIngestor; -import org.onap.aai.setup.AAIConfigTranslator; -import org.onap.aai.serialization.db.EdgeSerializer; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringMethodRule; +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +import static org.junit.Assert.assertNotNull; + @ContextConfiguration(classes = { ConfigConfiguration.class, AAIConfigTranslator.class, @@ -58,7 +52,8 @@ import org.springframework.test.context.junit4.rules.SpringMethodRule; EdgeIngestor.class, EdgeSerializer.class, SpringContextAware.class, - IntrospectionConfig.class, + IntrospectionConfig.class, + XmlFormatTransformerConfiguration.class, RestBeanConfig.class }) @TestPropertySource(properties = { @@ -95,7 +90,6 @@ public abstract class AAISetup { public static void setupBundleconfig() throws Exception { System.setProperty("AJSC_HOME", "./"); System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/"); - LoggingContext.init(); } public String getPayload(String filename) throws IOException { diff --git a/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java b/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java index 6b49b78..bd93f73 100644 --- a/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java +++ b/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java @@ -19,17 +19,12 @@ */ package org.onap.aai; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import org.javatuples.Pair; import org.mockito.Mockito; import org.onap.aai.config.SpringContextAware; -import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.exceptions.AAIException; import org.onap.aai.introspection.Introspector; import org.onap.aai.introspection.Loader; -import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; import org.onap.aai.parsers.query.QueryParser; import org.onap.aai.parsers.uri.URIToObject; import org.onap.aai.rest.db.DBRequest; @@ -37,6 +32,10 @@ import org.onap.aai.rest.db.HttpEntry; import org.onap.aai.restcore.HttpMethod; import org.onap.aai.restcore.RESTAPI; import org.onap.aai.serialization.engines.TransactionalGraphEngine; +import org.onap.aai.setup.SchemaVersion; +import org.onap.aai.setup.SchemaVersions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.ws.rs.core.*; import java.io.UnsupportedEncodingException; @@ -51,7 +50,7 @@ import static org.mockito.Mockito.when; public class HttpTestUtil extends RESTAPI { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(HttpTestUtil.class); + private static final Logger logger = LoggerFactory.getLogger(HttpTestUtil.class); protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json"); @@ -100,7 +99,7 @@ public class HttpTestUtil extends RESTAPI { schemaVersions = SpringContextAware.getBean(SchemaVersions.class); } - public Response doPut(String uri, String payload) throws AAIException { + public Response doPut(String uri, String payload) { this.init(); Response response = null; @@ -116,7 +115,7 @@ public class HttpTestUtil extends RESTAPI { SchemaVersion version = null; - if(arr != null && arr.length > 1){ + if(arr.length > 1){ if(arr[0].matches("^v\\d+")){ version = new SchemaVersion(arr[0]); uri = uri.replaceAll("^v\\d+", ""); @@ -128,10 +127,8 @@ public class HttpTestUtil extends RESTAPI { } Mockito.when(uriInfo.getPath()).thenReturn(uri); - DBConnectionType type = DBConnectionType.REALTIME; - //HttpEntry httpEntry = new HttpEntry(version, ModelType.MOXY, QueryStyle.TRAVERSAL, type); HttpEntry resourceHttpEntry = SpringContextAware.getBean("traversalHttpEntry", HttpEntry.class); - resourceHttpEntry.setHttpEntryProperties(version, type); + resourceHttpEntry.setHttpEntryProperties(version); Loader loader = resourceHttpEntry.getLoader(); dbEngine = resourceHttpEntry.getDbEngine(); @@ -210,7 +207,7 @@ public class HttpTestUtil extends RESTAPI { SchemaVersion version = null; - if(arr != null && arr.length > 1){ + if(arr.length > 1){ if(arr[0].matches("^v\\d+")){ version = new SchemaVersion(arr[0]); uri = uri.replaceAll("^v\\d+", ""); @@ -221,10 +218,8 @@ public class HttpTestUtil extends RESTAPI { version = schemaVersions.getDefaultVersion(); } - DBConnectionType type = DBConnectionType.REALTIME; - // HttpEntry httpEntry = new HttpEntry(version, ModelType.MOXY, QueryStyle.TRAVERSAL, type); HttpEntry resourceHttpEntry = SpringContextAware.getBean("traversalHttpEntry", HttpEntry.class); - resourceHttpEntry.setHttpEntryProperties(version, type); + resourceHttpEntry.setHttpEntryProperties(version); Loader loader = resourceHttpEntry.getLoader(); dbEngine = resourceHttpEntry.getDbEngine(); @@ -293,7 +288,7 @@ public class HttpTestUtil extends RESTAPI { SchemaVersion version = null; - if(arr != null && arr.length > 1){ + if(arr.length > 1){ if(arr[0].matches("^v\\d+")){ version = new SchemaVersion(arr[0]); if(!uri.contains("relationship-list/relationship")){ @@ -307,10 +302,8 @@ public class HttpTestUtil extends RESTAPI { } Mockito.when(uriInfo.getPath()).thenReturn(uri); - DBConnectionType type = DBConnectionType.REALTIME; - // HttpEntry httpEntry = new HttpEntry(version, ModelType.MOXY, QueryStyle.TRAVERSAL, type); HttpEntry resourceHttpEntry = SpringContextAware.getBean("traversalHttpEntry", HttpEntry.class); - resourceHttpEntry.setHttpEntryProperties(version, type); + resourceHttpEntry.setHttpEntryProperties(version); Loader loader = resourceHttpEntry.getLoader(); dbEngine = resourceHttpEntry.getDbEngine(); diff --git a/aai-resources/src/test/java/org/onap/aai/IncreaseNodesToolTest.java b/aai-resources/src/test/java/org/onap/aai/IncreaseNodesToolTest.java index 53b162f..47dfdbe 100644 --- a/aai-resources/src/test/java/org/onap/aai/IncreaseNodesToolTest.java +++ b/aai-resources/src/test/java/org/onap/aai/IncreaseNodesToolTest.java @@ -21,16 +21,18 @@ package org.onap.aai; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphTransaction; - import org.junit.Before; import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; import org.mockito.Mock; import org.mockito.Mockito; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; public class IncreaseNodesToolTest extends AAISetup { @@ -46,6 +48,9 @@ public class IncreaseNodesToolTest extends AAISetup { @Mock Vertex mockVertex; + @Captor + ArgumentCaptor<String> nodeTypeCapture; + @Mock GraphTraversal<org.apache.tinkerpop.gremlin.structure.Vertex, org.apache.tinkerpop.gremlin.structure.Vertex> graphTraversalVertex; private IncreaseNodesTool increaseNodesTool; @@ -61,13 +66,13 @@ public class IncreaseNodesToolTest extends AAISetup { when(janusGraph.newTransaction()).thenReturn(janusGraphtransaction); when(janusGraphtransaction.traversal()).thenReturn(graphTraversalSource); - when(graphTraversalSource.addV()).thenReturn(graphTraversalVertex); + when(graphTraversalSource.addV(nodeTypeCapture.capture())).thenReturn(graphTraversalVertex); when(graphTraversalVertex.next()).thenReturn(mockVertex); increaseNodesTool.run(janusGraph,args); Mockito.verify(janusGraph).newTransaction(); - Mockito.verify(graphTraversalSource,times(5)).addV(); + Mockito.verify(graphTraversalSource,times(5)).addV(nodeTypeCapture.capture()); } @Test diff --git a/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java b/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java index 8ec82ff..09bb7a5 100644 --- a/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java +++ b/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java @@ -19,8 +19,8 @@ */ package org.onap.aai; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.http.client.HttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContextBuilder; @@ -46,7 +46,7 @@ import java.security.KeyStore; @TestConfiguration public class ResourcesTestConfiguration { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(ResourcesTestConfiguration.class); + private static final Logger logger = LoggerFactory.getLogger(ResourcesTestConfiguration.class); @Autowired private Environment env; diff --git a/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java b/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java index c755838..ff985a9 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java @@ -26,7 +26,7 @@ import org.janusgraph.core.JanusGraphTransaction; import org.junit.*; import org.onap.aai.ResourcesApp; import org.onap.aai.ResourcesTestConfiguration; -import org.onap.aai.config.PropertyPasswordConfiguration; +import org.onap.aai.restclient.PropertyPasswordConfiguration; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.exceptions.AAIException; import org.onap.aai.nodes.NodeIngestor; diff --git a/aai-resources/src/test/java/org/onap/aai/rest/BulkAddConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/BulkAddConsumerTest.java index 6e98a39..5366802 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/BulkAddConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/BulkAddConsumerTest.java @@ -29,11 +29,11 @@ import javax.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; import org.junit.Test; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class BulkAddConsumerTest extends BulkProcessorTestAbstraction { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(BulkAddConsumerTest.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(BulkAddConsumerTest.class.getName()); @Test diff --git a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java index 1d8702a..d2dff7d 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java @@ -33,13 +33,13 @@ import org.junit.Test; import org.onap.aai.dbmap.AAIGraph; import org.skyscreamer.jsonassert.JSONAssert; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.mock.web.MockHttpServletRequest; public class BulkProcessConsumerTest extends BulkProcessorTestAbstraction { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(BulkProcessConsumerTest.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(BulkProcessConsumerTest.class.getName()); private LegacyMoxyConsumer legacyMoxyConsumer; @Test diff --git a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java index e735041..d5c112b 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java @@ -42,8 +42,8 @@ import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public abstract class BulkProcessorTestAbstraction extends AAISetup { @@ -73,7 +73,7 @@ public abstract class BulkProcessorTestAbstraction extends AAISetup { protected String uri; private boolean initialized = false; - private static final EELFLogger logger = EELFManager.getInstance().getLogger(BulkProcessorTestAbstraction.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(BulkProcessorTestAbstraction.class.getName()); @BeforeClass public static void setupRest(){ diff --git a/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java b/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java index 0e1cbe4..af7d022 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java @@ -24,7 +24,7 @@ import org.junit.Before; import org.junit.Test; import org.onap.aai.ResourcesApp; import org.onap.aai.ResourcesTestConfiguration; -import org.onap.aai.config.PropertyPasswordConfiguration; +import org.onap.aai.restclient.PropertyPasswordConfiguration; import org.onap.aai.config.SpringContextAware; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.embedded.LocalServerPort; diff --git a/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java index 3f50ba3..9d2a519 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java @@ -19,8 +19,8 @@ */ package org.onap.aai.rest; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -62,7 +62,7 @@ public class ExampleConsumerTest extends AAISetup { private List<MediaType> outputMediaTypes; - private static final EELFLogger logger = EELFManager.getInstance().getLogger(LegacyMoxyConsumerTest.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(LegacyMoxyConsumerTest.class.getName()); @BeforeClass public static void setupRest(){ 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 028f596..748b032 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 @@ -19,8 +19,10 @@ */ package org.onap.aai.rest; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.json.JSONArray; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; @@ -45,8 +47,7 @@ import javax.ws.rs.core.*; import java.io.IOException; import java.util.*; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.*; import static org.mockito.Matchers.anyObject; import static org.mockito.Mockito.when; @@ -77,7 +78,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { private boolean initialized = false; - private static final EELFLogger logger = EELFManager.getInstance().getLogger(LegacyMoxyConsumerTest.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(LegacyMoxyConsumerTest.class.getName()); @BeforeClass public static void setupRest(){ @@ -172,7 +173,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { int code = response.getStatus(); if(!VALID_HTTP_STATUS_CODES.contains(code)){ - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); } assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); @@ -194,7 +195,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { code = response.getStatus(); if(!VALID_HTTP_STATUS_CODES.contains(code)){ - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); } String pserverEntity = response.getEntity().toString(); @@ -220,7 +221,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { code = response.getStatus(); if(!VALID_HTTP_STATUS_CODES.contains(code)){ - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); } assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); @@ -300,7 +301,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { assertNotNull("Response from the legacy moxy consumer returned null", response); int code = response.getStatus(); if(!VALID_HTTP_STATUS_CODES.contains(code)){ - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); } assertEquals("Expected to return status created from the response", @@ -320,8 +321,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { code = response.getStatus(); if(!VALID_HTTP_STATUS_CODES.contains(code)){ - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); } assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); @@ -359,7 +359,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { ); int code = response.getStatus(); - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code); } @@ -384,7 +384,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { int code = response.getStatus(); assertNotNull("Response from the legacy moxy consumer returned null", response); assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), code); - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); response = legacyMoxyConsumer.updateRelationship( payload, @@ -398,7 +398,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { code = response.getStatus(); assertNotNull("Response from the legacy moxy consumer returned null", response); assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), code); - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); mockReq = new MockHttpServletRequest("GET", uri); response = legacyMoxyConsumer.getLegacy( "", @@ -459,7 +459,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { ); int code = response.getStatus(); - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code); response = legacyMoxyConsumer.updateRelationship( @@ -472,7 +472,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { ); code = response.getStatus(); - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code); mockReq = new MockHttpServletRequest("GET", uri); @@ -504,7 +504,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { ); code = response.getStatus(); - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code); response = legacyMoxyConsumer.deleteRelationship( @@ -560,7 +560,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { int code = response.getStatus(); if(!VALID_HTTP_STATUS_CODES.contains(code)){ - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); } assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); @@ -584,7 +584,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { code = response.getStatus(); assertNotNull("Response from the patch returned null", response); - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); assertEquals(Response.Status.OK.getStatusCode(), code); } @@ -625,7 +625,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { assertNotNull("Response from the legacy moxy consumer returned null", response); int code = response.getStatus(); if(!VALID_HTTP_STATUS_CODES.contains(code)){ - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); } assertEquals("Expected to return status created from the response", Response.Status.CREATED.getStatusCode(), response.getStatus()); @@ -676,7 +676,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { ); int code = response.getStatus(); - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code); } @@ -827,7 +827,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { assertNotNull("Response from the legacy moxy consumer returned null", response); int code = response.getStatus(); if(!VALID_HTTP_STATUS_CODES.contains(code)){ - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); } assertEquals("Expected to return status created from the response", @@ -852,7 +852,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { code = response.getStatus(); if(!VALID_HTTP_STATUS_CODES.contains(code)){ - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); } assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); @@ -890,7 +890,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { assertNotNull("Response from the legacy moxy consumer returned null", response); int code = response.getStatus(); if(!VALID_HTTP_STATUS_CODES.contains(code)){ - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); } assertEquals("Expected to return status created from the response", @@ -915,7 +915,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { code = response.getStatus(); if(!VALID_HTTP_STATUS_CODES.contains(code)){ - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); } assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); @@ -983,9 +983,420 @@ public class LegacyMoxyConsumerTest extends AAISetup { int code = response.getStatus(); if(!VALID_HTTP_STATUS_CODES.contains(code)){ - System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); } assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); } + + @Test + public void testGetWithSkipRelatedToParam() throws IOException, JSONException { + String pserverData = getResourcePayload("pserver1"); + String vserverData = getResourcePayload("vserver1"); + + String hostname = "pserver-hostname-test01"; + String cloudRegionId ="testAIC01"; + String tenant ="tenant01"; + String vserver ="vserver01"; + + String pserverUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true", hostname); + String vserverUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s?skip-related-to=true", cloudRegionId); + + // PUT the resources + putResourceWithQueryParam(pserverUri, pserverData); + putResourceWithQueryParam(vserverUri, vserverData); + + String pserverMockRequestUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true", hostname); + String vserverMockRequestUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s?skip-related-to=true", + cloudRegionId, tenant, vserver); + + // === GET - related-to-property should not exist === + // pserver + Response pserverResponse = getMockResponse(pserverMockRequestUri); + assertTrue(isRelatedToPropertiesFieldNullInResponse(pserverResponse, "pserver")); + + // vserver + Response vserverResponse = getMockResponse(vserverMockRequestUri); + assertTrue(isRelatedToPropertiesFieldNullInResponse(vserverResponse, "vserver")); + // === + + // === Clean up (DELETE) === + // vserver + String deleteUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s", + cloudRegionId, tenant, vserver); + Response response = deleteServerObject(vserverMockRequestUri, deleteUri, "vserver"); + int code = response.getStatus(); + if(!VALID_HTTP_STATUS_CODES.contains(code)){ + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); + } + assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); + + // pserver + deleteUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname); + response = deleteServerObject(pserverMockRequestUri, deleteUri, "pserver"); + code = response.getStatus(); + if(!VALID_HTTP_STATUS_CODES.contains(code)){ + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); + } + assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); + } + + @Test + public void testGetWithoutSkipRelatedToParam() throws IOException, JSONException { + String pserverData = getResourcePayload("pserver2"); + String vserverData = getResourcePayload("vserver2"); + + String hostname = "pserver-hostname-test02"; + String cloudRegionId ="testAIC02"; + String tenant ="tenant02"; + String vserver ="vserver02"; + + String pserverUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname); + String vserverUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s", cloudRegionId); + + // PUT the resources + doSetupResource(pserverUri, pserverData); + doSetupResource(vserverUri, vserverData); + + String pserverMockRequestUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname); + String vserverMockRequestUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s", + cloudRegionId, tenant, vserver); + + // === GET - related-to-property should not exist === + // pserver + Response pserverResponse = getMockResponse(pserverMockRequestUri); + assertFalse(isRelatedToPropertiesFieldNullInResponse(pserverResponse, "pserver")); + + // vserver + Response vserverResponse = getMockResponse(vserverMockRequestUri); + assertFalse(isRelatedToPropertiesFieldNullInResponse(vserverResponse, "vserver")); + // === + + // === Clean up (DELETE) === + // vserver + String deleteUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s", + cloudRegionId, tenant, vserver); + Response response = deleteServerObject(vserverMockRequestUri, deleteUri, "vserver"); + int code = response.getStatus(); + if(!VALID_HTTP_STATUS_CODES.contains(code)){ + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); + } + assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); + + // pserver + deleteUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname); + response = deleteServerObject(pserverMockRequestUri, deleteUri, "pserver"); + code = response.getStatus(); + if(!VALID_HTTP_STATUS_CODES.contains(code)){ + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); + } + assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); + } + + @Test + public void testGetWithSkipRelatedToParamAndFormatResource() throws IOException, JSONException { + String pserverData = getResourcePayload("pserver3"); + String vserverData = getResourcePayload("vserver3"); + + String hostname = "pserver-hostname-test03"; + String cloudRegionId ="testAIC03"; + String tenant ="tenant03"; + String vserver ="vserver03"; + + String pserverUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true&format=resource", hostname); + String vserverUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s?skip-related-to=true&format=resource", cloudRegionId); + + // PUT the resources + putResourceWithQueryParam(pserverUri, pserverData); + putResourceWithQueryParam(vserverUri, vserverData); + + String pserverMockRequestUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true&format=resource", hostname); + String vserverMockRequestUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s?skip-related-to=true&format=resource", + cloudRegionId, tenant, vserver); + + // === GET - related-to-property should not exist === + // pserver + Response pserverResponse = getMockResponse(pserverMockRequestUri); + assertTrue(isRelatedToPropertiesFieldNullInResponse(pserverResponse, "pserver")); + + // vserver + Response vserverResponse = getMockResponse(vserverMockRequestUri); + assertTrue(isRelatedToPropertiesFieldNullInResponse(vserverResponse, "vserver")); + // === + + // === Clean up (DELETE) === + // vserver + String deleteUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s", + cloudRegionId, tenant, vserver); + String vserverMockRequestUriNoFormat = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s", + cloudRegionId, tenant, vserver); + Response response = deleteServerObject(vserverMockRequestUriNoFormat, deleteUri, "vserver"); + int code = response.getStatus(); + if(!VALID_HTTP_STATUS_CODES.contains(code)){ + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); + } + assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); + + // pserver + deleteUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname); + response = deleteServerObject(pserverMockRequestUri, deleteUri, "pserver"); + code = response.getStatus(); + if(!VALID_HTTP_STATUS_CODES.contains(code)){ + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); + } + assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); + + } + + @Test + public void testGetWithSkipRelatedToParamAndFormatResourceAndUrl() throws IOException, JSONException { + String pserverData = getResourcePayload("pserver4"); + String vserverData = getResourcePayload("vserver4"); + + String hostname = "pserver-hostname-test04"; + String cloudRegionId ="testAIC04"; + String tenant ="tenant04"; + String vserver ="vserver04"; + + String pserverUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true&format=resource_and_url", hostname); + String vserverUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s?skip-related-to=true&format=resource_and_url", cloudRegionId); + + // PUT the resources + putResourceWithQueryParam(pserverUri, pserverData); + putResourceWithQueryParam(vserverUri, vserverData); + + String pserverMockRequestUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true&format=resource_and_url", hostname); + String vserverMockRequestUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s?skip-related-to=true&format=resource_and_url", + cloudRegionId, tenant, vserver); + + // === GET - related-to-property should not exist === + // pserver + Response pserverResponse = getMockResponse(pserverMockRequestUri); + assertTrue(isRelatedToPropertiesFieldNullInResponse(pserverResponse, "pserver")); + + // vserver + Response vserverResponse = getMockResponse(vserverMockRequestUri); + assertTrue(isRelatedToPropertiesFieldNullInResponse(vserverResponse, "vserver")); + // === + + // === Clean up (DELETE) === + // vserver + String deleteUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s", + cloudRegionId, tenant, vserver); + String vserverMockRequestUriNoFormat = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s", + cloudRegionId, tenant, vserver); + Response response = deleteServerObject(vserverMockRequestUriNoFormat, deleteUri, "vserver"); + int code = response.getStatus(); + if(!VALID_HTTP_STATUS_CODES.contains(code)){ + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); + } + assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); + + // pserver + deleteUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname); + response = deleteServerObject(pserverMockRequestUri, deleteUri, "pserver"); + code = response.getStatus(); + if(!VALID_HTTP_STATUS_CODES.contains(code)){ + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); + } + assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); + } + + @Test + public void testGetVserversWithSkipRelatedToParam() throws IOException, JSONException { + String pserverData = getResourcePayload("pserver5"); + String vserverData = getResourcePayload("vserver5"); + + String hostname = "pserver-hostname-test05"; + String cloudRegionId ="testAIC05"; + String tenant ="tenant05"; + String vserver ="vserver05"; + + String pserverUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true", hostname); + String vserverUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s?skip-related-to=true", cloudRegionId); + + // PUT the resources + putResourceWithQueryParam(pserverUri, pserverData); + putResourceWithQueryParam(vserverUri, vserverData); + + String pserverMockRequestUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true", hostname); + String vserverMockRequestUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers?vserver-selflink=somelink05&skip-related-to=true", + cloudRegionId, tenant, vserver); + + // === GET - related-to-property should not exist === + // pserver + Response pserverResponse = getMockResponse(pserverMockRequestUri); + assertTrue(isRelatedToPropertiesFieldNullInResponse(pserverResponse, "pserver")); + + // vserver + Response vserverResponse = getMockResponse(vserverMockRequestUri); + assertTrue(isRelatedToPropertiesFieldNullInResponse(vserverResponse, "vserver")); + // === + + // === Clean up (DELETE) === + // vserver + String deleteUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s", + cloudRegionId, tenant, vserver); + String vserverMockRequestUriNoFormat = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s", + cloudRegionId, tenant, vserver); + Response response = deleteServerObject(vserverMockRequestUriNoFormat, deleteUri, "vserver"); + int code = response.getStatus(); + if(!VALID_HTTP_STATUS_CODES.contains(code)){ + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); + } + assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); + + // pserver + deleteUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname); + response = deleteServerObject(pserverMockRequestUri, deleteUri, "pserver"); + code = response.getStatus(); + if(!VALID_HTTP_STATUS_CODES.contains(code)){ + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); + } + assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); + } + + private Response deleteServerObject(String mockUri, String deleteUri, String nodeType) throws IOException, JSONException { + Response response = getMockResponse(mockUri); + String serverEntity = response.getEntity().toString(); + JSONObject serverJsonObject = new JSONObject(serverEntity); + boolean noResultsArray = false; + String resourceVersion = ""; + try { + JSONArray resultsJsonArray = (JSONArray) serverJsonObject.get("results"); + if (resultsJsonArray != null) { + JSONObject servers = (JSONObject) resultsJsonArray.get(0); + JSONObject server = (JSONObject) servers.get(nodeType); + resourceVersion = server.getString("resource-version"); + } + } catch (Exception e) { + noResultsArray = true; + } + if (noResultsArray) + resourceVersion = serverJsonObject.getString("resource-version"); + queryParameters.clear(); + queryParameters.add("resource-version", resourceVersion); + + MockHttpServletRequest mockReq = new MockHttpServletRequest("DELETE", deleteUri); + Response deleteResponse = legacyMoxyConsumer.delete( + schemaVersions.getDefaultVersion().toString(), + deleteUri, + httpHeaders, + uriInfo, + resourceVersion, + mockReq + ); + return deleteResponse; + } + + private void putResourceWithQueryParam(String uri, String payload) { + + String[] uriSplit = uri.split("\\?"); + if (uriSplit[1] != null && !uriSplit[1].isEmpty()) { + String[] params; + if (!uriSplit[1].contains("&")) { + String param = uriSplit[1]; + params = new String[]{param}; + } else { + params = uriSplit[1].split("&"); + } + for (String param : params) { + String[] splitParam = param.split("="); + String key = splitParam[0]; + String value = splitParam[1]; + uriInfo.getQueryParameters().add(key, value); + } + } + uri = uriSplit[0]; + + when(uriInfo.getPath()).thenReturn(uri); + when(uriInfo.getPath(false)).thenReturn(uri); + + MockHttpServletRequest mockReq = new MockHttpServletRequest("PUT", uri); + Response response = legacyMoxyConsumer.update( + payload, + schemaVersions.getDefaultVersion().toString(), + uri, + httpHeaders, + uriInfo, + mockReq + ); + + assertNotNull("Response from the legacy moxy consumer returned null", response); + int code = response.getStatus(); + if(!VALID_HTTP_STATUS_CODES.contains(code)){ + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); + } + + assertEquals("Expected to return status created from the response", + Response.Status.CREATED.getStatusCode(), response.getStatus()); + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); + } + + private Response getMockResponse(String mockUri) throws IOException, JSONException { + MockHttpServletRequest mockReq = new MockHttpServletRequest("GET", mockUri); + Response response = legacyMoxyConsumer.getLegacy( + "", + null, + null, + schemaVersions.getDefaultVersion().toString(), + mockUri, + "10000", + "false", + httpHeaders, + uriInfo, + mockReq + ); + String responseEntity = response.getEntity().toString(); + int code = response.getStatus(); + if(!VALID_HTTP_STATUS_CODES.contains(code)){ + logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); + } + return response; + } + + private boolean isRelatedToPropertiesFieldNullInResponse(Response response, String nodeType) throws IOException, JSONException { + String responseEntity = response.getEntity().toString(); + boolean noResultsArray = false; + JSONObject responseJsonObj = new JSONObject(responseEntity); + try { + JSONArray resultsJsonArray = (JSONArray) responseJsonObj.get("results"); + if (resultsJsonArray != null) { + JSONObject servers = (JSONObject) resultsJsonArray.get(0); + JSONObject server = (JSONObject) servers.get(nodeType); + JSONObject relationshipList = (JSONObject) server.get("relationship-list"); + if (relationshipList != null) { + JSONArray relationship = (JSONArray) relationshipList.get("relationship"); + if (relationship != null) { + JSONObject relationshipObj = relationship.getJSONObject(0); + JSONArray relatedToProperty = (JSONArray) relationshipObj.get("related-to-property"); + if (relatedToProperty != null) + return false; + } + } + } + } catch (Exception e) { + noResultsArray = true; + } + + if (noResultsArray) { + try { + JSONObject relationshipList = (JSONObject) responseJsonObj.get("relationship-list"); + if (relationshipList != null) { + JSONArray relationship = (JSONArray) relationshipList.get("relationship"); + if (relationship != null) { + JSONObject relationshipObj = relationship.getJSONObject(0); + JSONArray relatedToProperty = (JSONArray) relationshipObj.get("related-to-property"); + if (relatedToProperty != null) + return false; + } + } + } catch (JSONException je) { + logger.info("JSON Exception Error: " + je); + } catch (Exception e) { + logger.info("JSON Exception Error: " + e); + } + } + return true; + } } diff --git a/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java index 2edec7b..c6885c7 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java @@ -19,8 +19,8 @@ */ package org.onap.aai.rest; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.json.JSONException; import org.junit.Before; import org.junit.BeforeClass; @@ -65,7 +65,7 @@ public class URLFromVertexIdConsumerTest extends AAISetup { private List<MediaType> outputMediaTypes; - private static final EELFLogger logger = EELFManager.getInstance().getLogger(LegacyMoxyConsumerTest.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(LegacyMoxyConsumerTest.class.getName()); private boolean initialized = false; @BeforeClass public static void setupRest(){ diff --git a/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java index 8d3f5a8..e4e7340 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java @@ -19,8 +19,8 @@ */ package org.onap.aai.rest; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.json.JSONException; import org.junit.Before; import org.junit.BeforeClass; @@ -64,7 +64,7 @@ public class VertexIdConsumerTest extends AAISetup { private List<MediaType> outputMediaTypes; - private static final EELFLogger logger = EELFManager.getInstance().getLogger(LegacyMoxyConsumerTest.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(LegacyMoxyConsumerTest.class.getName()); private boolean initialized = false; @BeforeClass diff --git a/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java index e317297..8c24fb4 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java @@ -19,6 +19,8 @@ */ package org.onap.aai.rest.bulk; +import com.google.gson.JsonArray; +import com.google.gson.JsonParser; import org.apache.tinkerpop.gremlin.structure.Property; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.VertexProperty; @@ -33,6 +35,7 @@ import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.rest.BulkConsumer; import org.onap.aai.rest.BulkProcessorTestAbstraction; import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.test.context.TestPropertySource; import javax.ws.rs.HttpMethod; import javax.ws.rs.core.Response; @@ -44,9 +47,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.when; +@TestPropertySource(properties = { + "delta.events.enabled=true", +}) public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstraction { - private BulkSingleTransactionConsumer bulkSingleTransactionConsumer = new BulkSingleTransactionConsumer(); + private BulkSingleTransactionConsumer bulkSingleTransactionConsumer = new BulkSingleTransactionConsumer("/aai"); @Rule public TestName name = new TestName(); @@ -220,6 +226,8 @@ public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstract assertThat("Response contains 204 status.", response.getEntity().toString(), containsString("\"response-status-code\":204")); + + } @Test @@ -244,8 +252,10 @@ public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstract .replaceAll("<methodName>", name.getMethodName()); Response response = executeRequest(payload); + System.out.println(response.getEntity().toString()); + assertEquals("Request failed", - Response.Status.BAD_REQUEST.getStatusCode(), + Response.Status.PRECONDITION_FAILED.getStatusCode(), response.getStatus()); assertEquals("1 vertex exists after payload due to failure", @@ -253,13 +263,17 @@ public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstract AAIGraph.getInstance().getGraph().newTransaction().traversal(). V().has(AAIProperties.SOURCE_OF_TRUTH, sot).count().next()); + assertThat("Response contains resource version msg for failed transaction.", + response.getEntity().toString(), + containsString("Precondition Failed:resource-version MISMATCH for delete of generic-vnf")); + assertThat("Response contains correct index of failed operation.", response.getEntity().toString(), - containsString("Operation 3 failed with status code (412) and msg")); + containsString("Operation 3")); - assertThat("Response contains resource version msg for failed transaction.", + assertThat("Response contains correct status code.", response.getEntity().toString(), - containsString("Precondition Failed:resource-version MISMATCH for delete of generic-vnf")); + containsString("failed with status code (412")); } @@ -342,7 +356,81 @@ public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstract } + @Test + public void putComplexWithRelToNonExistentPserverBetween() throws IOException { + + String payload = getBulkPayload("single-transaction/put-complex-with-rel-to-non-existent").replaceAll("<methodName>", name.getMethodName()); + Response response = executeRequest(payload); + + assertEquals("Request success", + Response.Status.NOT_FOUND.getStatusCode(), + response.getStatus()); + assertEquals("0 vertex from this test in graph", + Long.valueOf(0L), + AAIGraph.getInstance().getGraph().newTransaction().traversal(). + V().has(AAIProperties.SOURCE_OF_TRUTH, sot).count().next()); + assertEquals("Request fails with 404", + Response.Status.NOT_FOUND.getStatusCode(), + response.getStatus()); + + assertThat("Response contains correct index of failed operation.", + response.getEntity().toString(), + containsString("Operation 0")); + + assertThat("Response contains correct status code.", + response.getEntity().toString(), + containsString("failed with status code (404")); + + assertThat("Response contains correct msg.", + response.getEntity().toString(), + containsString("target node:Node of type pserver. Could not find")); + assertThat("Response contains correct Error Code.", + response.getEntity().toString(), + containsString("ERR.5.4.6129")); + + } + + + @Test + public void deleteChildRecreateChildTest() throws IOException { + JsonArray requests = new JsonParser().parse( + getBulkPayload("single-transaction/delete-child-recreate-child").replaceAll("<methodName>", name.getMethodName())) + .getAsJsonObject().getAsJsonArray("array"); + String payload = requests.get(0).toString(); + Response response = executeRequest(payload); + System.out.println(response.getEntity().toString()); + assertEquals("Request success", + Response.Status.CREATED.getStatusCode(), + response.getStatus()); + + payload = requests.get(1).toString(); + response = executeRequest(payload); + System.out.println(response.getEntity().toString()); + assertEquals("Request success", + Response.Status.CREATED.getStatusCode(), + response.getStatus()); + } + + @Test + public void deleteNodeRecreateNodeTest() throws IOException { + JsonArray requests = new JsonParser().parse( + getBulkPayload("single-transaction/delete-node-recreate-node").replaceAll("<methodName>", name.getMethodName())) + .getAsJsonObject().getAsJsonArray("array"); + String payload = requests.get(0).toString(); + Response response = executeRequest(payload); + System.out.println(response.getEntity().toString()); + assertEquals("Request success", + Response.Status.CREATED.getStatusCode(), + response.getStatus()); + + payload = requests.get(1).toString(); + response = executeRequest(payload); + System.out.println(response.getEntity().toString()); + assertEquals("Request success", + Response.Status.CREATED.getStatusCode(), + response.getStatus()); + } protected Response executeRequest(String finalPayload) { @@ -364,6 +452,6 @@ public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstract @Override protected String getUri() { - return "/aai/" + schemaVersions.getDefaultVersion().toString() + "/bulk-single-transaction-multi-operation"; + return "/aai/" + schemaVersions.getDefaultVersion().toString() + "/bulk/single-transaction"; } }
\ No newline at end of file diff --git a/aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerSpringTest.java b/aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerSpringTest.java index c629ca7..cdd3a51 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerSpringTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerSpringTest.java @@ -19,8 +19,8 @@ */ package org.onap.aai.rest.retired; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Test; import org.onap.aai.rest.AbstractSpringRestTest; import org.springframework.http.HttpMethod; @@ -33,7 +33,7 @@ import java.util.Map; import static org.junit.Assert.assertEquals; public class RetiredConsumerSpringTest extends AbstractSpringRestTest { - private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(RetiredConsumerSpringTest.class); + private static final Logger LOGGER = LoggerFactory.getLogger(RetiredConsumerSpringTest.class); private Map<String, HttpStatus> httpStatusMap; diff --git a/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java b/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java index aa60d94..9f55961 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java @@ -19,8 +19,8 @@ */ package org.onap.aai.rest.util; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; @@ -60,7 +60,7 @@ public class EchoResponseTest extends AAISetup { private List<MediaType> outputMediaTypes; - private static final EELFLogger logger = EELFManager.getInstance().getLogger(EchoResponseTest.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(EchoResponseTest.class.getName()); @Before public void setup(){ diff --git a/aai-resources/src/test/resources/logback.xml b/aai-resources/src/test/resources/logback.xml index 0258f1d..8f0e0d7 100644 --- a/aai-resources/src/test/resources/logback.xml +++ b/aai-resources/src/test/resources/logback.xml @@ -31,14 +31,30 @@ <property name="AJSC_HOME" value="${AJSC_HOME:-.}" /> <jmxConfigurator /> <property name="logDirectory" value="${AJSC_HOME}/logs" /> - <property name="eelfLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> - <property name="eelfAuditLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> - <property name="eelfMetricLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{targetVirtualEntity}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> - <!-- <property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> --> - <property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%ecompResponseCode|%ecompResponseDescription|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> - <property name="eelfTransLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{partnerName}:%m%n"/> - - <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> + <!-- Old patterns + <property name="eelfLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%ecompServiceName|%X{partnerName}|%ecompStatusCode|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <property name="eelfAuditLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%ecompServiceName|%X{partnerName}|%ecompStatusCode|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <property name="eelfMetricLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%ecompServiceName|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompStatusCode|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{targetVirtualEntity}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%ecompServiceName|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%ecompResponseCode|%ecompResponseDescription|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <property name="eelfTransLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%ecompServiceName|%X{partnerName}|%ecompStatusCode|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{partnerName}:%m%n"/> + --> + <property name="p_tim" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC}"/> + <property name="p_lvl" value="%level"/> + <property name="p_log" value="%logger"/> + <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/> + <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_thr" value="%thread"/> + <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/> + <!-- Patterns from onap demo --> + <property name="errorPattern" value="%X{LogTimestamp}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" /> + <property name="debugPattern" value="%X{LogTimestamp}|%X{RequestID}|%msg\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t|%n" /> + + <property name="auditPattern" value="%X{EntryTimestamp}|%X{LogTimestamp}|%X{RequestID}|%X{ServiceInstanceID}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||${p_mak}|${p_mdc}|||%msg%n" /> + <property name="metricPattern" value="%X{InvokeTimestamp}|%X{LogTimestamp}|%X{RequestID}|%X{ServiceInstanceID}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|${p_mak}|${p_mdc}|||%msg%n" /> + <property name="transLogPattern" value="%X{LogTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{RequestID}|%X{ServiceInstanceID}|%-10t|%X{ServerFQDN}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%replace(%replace(%X{ResponseDesc}){'\\|', '!'}){'\r|\n', '^'}|%X{InstanceUUID}|%level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{clientIpAddress}||%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{PartnerName}:%m%n"/> + <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> @@ -65,71 +81,63 @@ <includeCallerData>true</includeCallerData> <appender-ref ref="SANE" /> </appender> - - <appender name="METRIC" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> - <level>INFO</level> - <onMatch>ACCEPT</onMatch> - <onMismatch>DENY</onMismatch> - </filter> + <appender name="METRIC" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${logDirectory}/rest/metrics.log</file> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/rest/metrics.log.%d{yyyy-MM-dd} - </fileNamePattern> + <rollingPolicy + class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/metrics.log.%d{yyyy-MM-dd}</fileNamePattern> </rollingPolicy> - <encoder class="org.onap.aai.logging.EcompEncoder"> - <pattern>${eelfMetricLogPattern}</pattern> + <encoder> + <pattern>${metricPattern}</pattern> </encoder> </appender> + <appender name="asyncMETRIC" class="ch.qos.logback.classic.AsyncAppender"> <queueSize>1000</queueSize> <includeCallerData>true</includeCallerData> - <appender-ref ref="METRIC" /> + <appender-ref ref="METRIC"/> </appender> <appender name="DEBUG" - class="ch.qos.logback.core.rolling.RollingFileAppender"> + class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>DEBUG</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <file>${logDirectory}/rest/debug.log</file> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/rest/debug.log.%d{yyyy-MM-dd} - </fileNamePattern> + <rollingPolicy + class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/debug.log.%d{yyyy-MM-dd}</fileNamePattern> </rollingPolicy> - <encoder class="org.onap.aai.logging.EcompEncoder"> - <pattern>${eelfLogPattern}</pattern> + <encoder> + <pattern>${debugPattern}</pattern> </encoder> </appender> <appender name="asyncDEBUG" class="ch.qos.logback.classic.AsyncAppender"> <queueSize>1000</queueSize> - <includeCallerData>true</includeCallerData> <appender-ref ref="DEBUG" /> + <includeCallerData>true</includeCallerData> </appender> - <appender name="ERROR" - class="ch.qos.logback.core.rolling.RollingFileAppender"> + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/rest/error.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/error.log.%d{yyyy-MM-dd}</fileNamePattern> + </rollingPolicy> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>WARN</level> </filter> - <file>${logDirectory}/rest/error.log</file> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/rest/error.log.%d{yyyy-MM-dd} - </fileNamePattern> - </rollingPolicy> - <encoder class="org.onap.aai.logging.EcompEncoder"> - <pattern>${eelfErrorLogPattern}</pattern> + <encoder> + <pattern>${errorPattern}</pattern> </encoder> </appender> <appender name="asyncERROR" class="ch.qos.logback.classic.AsyncAppender"> <queueSize>1000</queueSize> - <includeCallerData>true</includeCallerData> - <appender-ref ref="ERROR" /> + <appender-ref ref="ERROR"/> </appender> <appender name="AUDIT" @@ -139,8 +147,8 @@ <fileNamePattern>${logDirectory}/rest/audit.log.%d{yyyy-MM-dd} </fileNamePattern> </rollingPolicy> - <encoder class="org.onap.aai.logging.EcompEncoder"> - <pattern>${eelfAuditLogPattern}</pattern> + <encoder> + <pattern>${auditPattern}</pattern> </encoder> </appender> @@ -162,8 +170,8 @@ <fileNamePattern>${logDirectory}/rest/translog.log.%d{yyyy-MM-dd} </fileNamePattern> </rollingPolicy> - <encoder class="org.onap.aai.logging.EcompEncoder"> - <pattern>${eelfTransLogPattern}</pattern> + <encoder> + <pattern>${transLogPattern}</pattern> </encoder> </appender> @@ -183,9 +191,10 @@ <fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/error.log.%d{yyyy-MM-dd} </fileNamePattern> </rollingPolicy> - <encoder class="org.onap.aai.logging.EcompEncoder"> - <pattern>${eelfLogPattern}</pattern> + <encoder> + <pattern>${errorPattern}</pattern> </encoder> + </appender> <appender name="dmaapAAIEventConsumerDebug" @@ -200,8 +209,24 @@ <fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/debug.log.%d{yyyy-MM-dd} </fileNamePattern> </rollingPolicy> - <encoder class="org.onap.aai.logging.EcompEncoder"> - <pattern>${eelfLogPattern}</pattern> + <encoder> + <pattern>${debugPattern}</pattern> + </encoder> + </appender> + <appender name="dmaapAAIEventConsumerInfo" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>INFO</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + <File>${logDirectory}/dmaapAAIEventConsumer/dmaap-transaction.log</File> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/dmaap-transaction.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder> + <pattern>${auditPattern}</pattern> </encoder> </appender> <appender name="dmaapAAIEventConsumerMetric" @@ -216,8 +241,8 @@ <fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/metrics.log.%d{yyyy-MM-dd} </fileNamePattern> </rollingPolicy> - <encoder class="org.onap.aai.logging.EcompEncoder"> - <pattern>${eelfMetricLogPattern}</pattern> + <encoder> + <pattern>${metricPattern}</pattern> </encoder> </appender> <appender name="external" @@ -230,139 +255,50 @@ <fileNamePattern>${logDirectory}/external/external.log.%d{yyyy-MM-dd} </fileNamePattern> </rollingPolicy> - <encoder class="org.onap.aai.logging.EcompEncoder"> - <pattern>${eelfLogPattern}</pattern> + <encoder> + <pattern>${debugPattern}</pattern> </encoder> </appender> - <logger name="org.onap.aai" level="DEBUG" additivity="true"> - <appender-ref ref="asyncDEBUG" /> - <appender-ref ref="asyncERROR" /> - <appender-ref ref="asyncMETRIC" /> - <appender-ref ref="asyncSANE" /> - </logger> + <!-- logback internals logging --> + <logger name="ch.qos.logback.classic" level="WARN" /> + <logger name="ch.qos.logback.core" level="WARN" /> + + <logger name="com.att.aft.dme2" level="WARN" /> + <logger name="com.jayway.jsonpath" level="WARN" /> + + <logger name="org.apache" level="OFF" /> + <logger name="org.apache.commons" level="WARN" /> + <logger name="org.apache.zookeeper" level="OFF" /> + <logger name="org.codehaus.groovy" level="WARN" /> + <logger name="org.eclipse.jetty" level="WARN" /> <!-- Spring related loggers --> <logger name="org.springframework" level="WARN" /> <logger name="org.springframework.beans" level="WARN" /> <logger name="org.springframework.web" level="WARN" /> - <logger name="com.blog.spring.jms" level="WARN" /> - <logger name="com.jayway.jsonpath" level="WARN" /> - - <!-- AJSC Services (bootstrap services) --> - <logger name="ajsc" level="WARN" /> - <logger name="ajsc.RouteMgmtService" level="WARN" /> - <logger name="ajsc.ComputeService" level="WARN" /> - <logger name="ajsc.VandelayService" level="WARN" /> - <logger name="ajsc.FilePersistenceService" level="WARN" /> - <logger name="ajsc.UserDefinedJarService" level="WARN" /> - <logger name="ajsc.UserDefinedBeansDefService" level="WARN" /> - <logger name="ajsc.LoggingConfigurationService" level="WARN" /> - - <!-- AJSC related loggers (DME2 Registration, csi logging, restlet, servlet - logging) --> - <logger name="org.codehaus.groovy" level="WARN" /> - <logger name="com.att.scamper" level="WARN" /> - <logger name="ajsc.utils" level="WARN" /> - <logger name="ajsc.utils.DME2Helper" level="WARN" /> - <logger name="ajsc.filters" level="WARN" /> - <logger name="ajsc.beans.interceptors" level="WARN" /> - <logger name="ajsc.restlet" level="WARN" /> - <logger name="ajsc.servlet" level="WARN" /> - <logger name="com.att.ajsc" level="WARN" /> - <logger name="com.att.ajsc.csi.logging" level="WARN" /> - <logger name="com.att.ajsc.filemonitor" level="WARN" /> - <logger name="com.netflix.loadbalancer" level="WARN" /> - - <logger name="org.apache.zookeeper" level="WARN" /> - - <!-- Other Loggers that may help troubleshoot --> - <logger name="net.sf" level="WARN" /> - <logger name="org.apache.commons.httpclient" level="WARN" /> - <logger name="org.apache.commons" level="WARN" /> - <logger name="org.apache.coyote" level="WARN" /> - <logger name="org.apache.jasper" level="WARN" /> - - <!-- Camel Related Loggers (including restlet/servlet/jaxrs/cxf logging. - May aid in troubleshooting) --> - <logger name="org.apache.camel" level="WARN" /> - <logger name="org.apache.cxf" level="WARN" /> - <logger name="org.apache.camel.processor.interceptor" level="WARN" /> - <logger name="org.apache.cxf.jaxrs.interceptor" level="WARN" /> - <logger name="org.apache.cxf.service" level="WARN" /> - <logger name="org.restlet" level="WARN" /> - <logger name="org.apache.camel.component.restlet" level="WARN" /> - - <logger name="org.hibernate.validator" level="WARN" /> - <logger name="org.hibernate" level="WARN" /> - <logger name="org.hibernate.ejb" level="OFF" /> - - <!-- logback internals logging --> - <logger name="ch.qos.logback.classic" level="WARN" /> - <logger name="ch.qos.logback.core" level="WARN" /> + <logger name="org.janusgraph" level="WARN" /> + <logger name="org.zookeeper" level="OFF" /> - <logger name="org.eclipse.jetty" level="WARN" /> - <!-- logback jms appenders & loggers definition starts here --> - <appender name="auditLogs" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.classic.filter.ThresholdFilter" /> - <file>${logDirectory}/perf-audit/Audit-${lrmRVer}-${lrmRO}-${Pid}.log - </file> - <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> - <fileNamePattern>${logDirectory}/perf-audit/Audit-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip - </fileNamePattern> - <minIndex>1</minIndex> - <maxIndex>9</maxIndex> - </rollingPolicy> - <triggeringPolicy - class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>5MB</maxFileSize> - </triggeringPolicy> - <encoder> - <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern> - </encoder> - </appender> - <appender name="perfLogs" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.classic.filter.ThresholdFilter" /> - <file>${logDirectory}/perf-audit/Perform-${lrmRVer}-${lrmRO}-${Pid}.log - </file> - <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> - <fileNamePattern>${logDirectory}/perf-audit/Perform-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip - </fileNamePattern> - <minIndex>1</minIndex> - <maxIndex>9</maxIndex> - </rollingPolicy> - <triggeringPolicy - class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>5MB</maxFileSize> - </triggeringPolicy> - <encoder> - <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern> - </encoder> - </appender> - <logger name="AuditRecord" level="INFO" additivity="false"> - <appender-ref ref="auditLogs" /> + <logger name="org.onap.aai" level="DEBUG" additivity="false"> + <appender-ref ref="asyncDEBUG" /> + <appender-ref ref="asyncSANE" /> + <appender-ref ref="STDOUT" /> </logger> - <logger name="AuditRecord_DirectCall" level="INFO" additivity="false"> - <appender-ref ref="auditLogs" /> + <logger name="org.onap.aai.aailog.logs.AaiScheduledTaskAuditLog" level="INFO"> + <appender-ref ref="asyncAUDIT"/> </logger> - <logger name="PerfTrackerRecord" level="INFO" additivity="false"> - <appender-ref ref="perfLogs" /> + <logger name="org.onap.logging.filter.base.AbstractAuditLogFilter" level="INFO"> + <appender-ref ref="asyncAUDIT"/> </logger> - <!-- logback jms appenders & loggers definition ends here --> - - <logger name="org.onap.aai.interceptors.post" level="DEBUG" - additivity="false"> - <appender-ref ref="asynctranslog" /> + <logger name="org.onap.aai.aailog.logs.AaiDBMetricLog" level="INFO"> + <appender-ref ref="asyncMETRIC"/> </logger> - - <logger name="org.onap.aai.interceptors.pre.SetLoggingContext" level="DEBUG"> - <appender-ref ref="asyncAUDIT"/> + <logger name="org.onap.aai.logging.ErrorLogHelper" level="WARN"> + <appender-ref ref="asyncERROR"/> </logger> - - <logger name="org.onap.aai.interceptors.post.ResetLoggingContext" level="DEBUG"> - <appender-ref ref="asyncAUDIT"/> + <logger name="org.onap.aai.interceptors.post" level="DEBUG" additivity="false"> + <appender-ref ref="asynctranslog" /> </logger> <logger name="org.onap.aai.dmaap" level="DEBUG" additivity="false"> @@ -371,10 +307,9 @@ <appender-ref ref="dmaapAAIEventConsumerMetric" /> </logger> - <logger name="org.apache" level="WARN" /> - <logger name="org.zookeeper" level="WARN" /> - <logger name="org.janusgraph" level="WARN" /> - <logger name="com.att.aft.dme2" level="WARN" /> + <logger name="com.att.nsa.mr" level="INFO" > + <appender-ref ref="dmaapAAIEventConsumerInfo" /> + </logger> <!-- ============================================================================ --> <!-- General EELF logger --> diff --git a/aai-resources/src/test/resources/payloads/bulk/single-transaction/delete-child-recreate-child.json b/aai-resources/src/test/resources/payloads/bulk/single-transaction/delete-child-recreate-child.json new file mode 100644 index 0000000..ca7decc --- /dev/null +++ b/aai-resources/src/test/resources/payloads/bulk/single-transaction/delete-child-recreate-child.json @@ -0,0 +1,46 @@ +{ + "array": [ + { + "operations": [ + { + "action": "put", + "uri": "/network/pnfs/pnf/pnf-1", + "body": { + "pnf-name": "pnf-1", + "p-interfaces": { + "p-interface": [ + { + "speed-value": "10", + "interface-name": "pint-a", + "speed-units": "Mbps", + "prov-status": "PROV", + "interface-name2": "0-0-2" + } + ] + } + } + } + ] + }, + { + "operations": [ + { + "action": "delete", + "uri": "/network/pnfs/pnf/pnf-1/p-interfaces/p-interface/pint-a?resource-version=38cf3090-6a0c-4e9d-8142-4332a7352846", + "body": {} + }, + { + "action": "put", + "uri": "/network/pnfs/pnf/pnf-1/p-interfaces/p-interface/pint-a", + "body": { + "speed-value": "100", + "interface-name": "pint-a", + "speed-units": "Gbps", + "prov-status": "PREPROV", + "interface-name2": "0-0-22" + } + } + ] + } + ] +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/bulk/single-transaction/delete-node-recreate-node.json b/aai-resources/src/test/resources/payloads/bulk/single-transaction/delete-node-recreate-node.json new file mode 100644 index 0000000..c81547e --- /dev/null +++ b/aai-resources/src/test/resources/payloads/bulk/single-transaction/delete-node-recreate-node.json @@ -0,0 +1,41 @@ +{ + "array": [ + { + "operations": [ + { + "action": "put", + "uri": "/network/logical-links/logical-link/ll", + "body": { + "speed-value": "10", + "link-type": "INL", + "link-name": "ll", + "speed-units": "Mbps", + "prov-status": "PROV", + "routing-protocol": "802.3ah" + } + } + ] + }, + { + "operations": [ + { + "action": "delete", + "uri": "/network/logical-links/logical-link/ll?resource-version=38cf3090-6a0c-4e9d-8142-4332a7352846", + "body": {} + }, + { + "action": "put", + "uri": "/network/logical-links/logical-link/ll", + "body": { + "speed-value": "100", + "link-type": "INL", + "link-name": "ll", + "speed-units": "Gbps", + "prov-status": "PREPROV", + "routing-protocol": "802.3ah" + } + } + ] + } + ] +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/bulk/single-transaction/put-complex-with-rel-to-non-existent.json b/aai-resources/src/test/resources/payloads/bulk/single-transaction/put-complex-with-rel-to-non-existent.json new file mode 100644 index 0000000..4c6d1b8 --- /dev/null +++ b/aai-resources/src/test/resources/payloads/bulk/single-transaction/put-complex-with-rel-to-non-existent.json @@ -0,0 +1,28 @@ +{ + "operations": [ + { + "action": "put", + "uri": "/cloud-infrastructure/complexes/complex/complex-<methodName>", + "body": { + "physical-location-id": "complex-<methodName>", + "data-center-code": "code", + "identity-url": "N/A", + "physical-location-type": "type", + "street1": "street", + "city": "city", + "state": "state", + "postal-code": "12345", + "country": "NONE", + "region": "Earth", + "relationship-list": { + "relationship": [ + { + "related-to": "pserver", + "related-link": "/aai/v13/cloud-infrastructure/pservers/pserver/pserver-<methodName>" + } + ] + } + } + } + ] +} diff --git a/aai-resources/src/test/resources/payloads/bulk/single-transaction/put-pserver-complex-rel-between-del-existing-gvnf.json b/aai-resources/src/test/resources/payloads/bulk/single-transaction/put-pserver-complex-rel-between-del-existing-gvnf.json index 52c9599..6d4602b 100644 --- a/aai-resources/src/test/resources/payloads/bulk/single-transaction/put-pserver-complex-rel-between-del-existing-gvnf.json +++ b/aai-resources/src/test/resources/payloads/bulk/single-transaction/put-pserver-complex-rel-between-del-existing-gvnf.json @@ -2,7 +2,7 @@ "operations": [ { "action": "put", - "uri": "/cloud-infrastructure/pservers/pserver/pserver-<methodName>", + "uri": "aai/v15/cloud-infrastructure/pservers/pserver/pserver-<methodName>", "body": { "hostname": "pserver-<methodName>", "fqdn": "pserver-<methodName>-fqdn" @@ -10,7 +10,7 @@ }, { "action": "put", - "uri": "/cloud-infrastructure/complexes/complex/complex-<methodName>", + "uri": "/aai/v15/cloud-infrastructure/complexes/complex/complex-<methodName>", "body": { "physical-location-id": "complex-<methodName>", "data-center-code": "code", @@ -27,7 +27,7 @@ }, { "action": "put", - "uri": "/cloud-infrastructure/complexes/complex/complex-<methodName>/relationship-list/relationship", + "uri": "/aai/v15/cloud-infrastructure/complexes/complex/complex-<methodName>/relationship-list/relationship", "body": { "related-to": "pserver", "related-link": "/aai/v13/cloud-infrastructure/pservers/pserver/pserver-<methodName>" @@ -36,7 +36,7 @@ }, { "action": "delete", - "uri": "/network/generic-vnfs/generic-vnf/gvnf-<methodName>?resource-version=0", + "uri": "/aai/v15/network/generic-vnfs/generic-vnf/gvnf-<methodName>?resource-version=0", "body": {} } ] diff --git a/aai-resources/src/test/resources/payloads/extensions/cloud-region.json b/aai-resources/src/test/resources/payloads/extensions/cloud-region.json new file mode 100644 index 0000000..993d3df --- /dev/null +++ b/aai-resources/src/test/resources/payloads/extensions/cloud-region.json @@ -0,0 +1,27 @@ +{ + "cloud-owner": "Sample-att-aic", + "cloud-region-id": "Sample-AAIAIC25", + "tenants": { + "tenant": [ + { + "tenant-id" : "Sample-TenantId", + "tenant-name" : "Sample-TenantName" + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-link": "/aai/v12/cloud-infrastructure/complexes/complex/complex1", + "related-to": "complex", + "relationship-data": [ + { + "relationship-key": "complex.physical-location-id", + "relationship-value": "complex1" + } + ], + "relationship-label": "org.onap.relationships.inventory.LocatedIn" + } + ] + } +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/extensions/complex.json b/aai-resources/src/test/resources/payloads/extensions/complex.json new file mode 100644 index 0000000..5bafe7e --- /dev/null +++ b/aai-resources/src/test/resources/payloads/extensions/complex.json @@ -0,0 +1,9 @@ +{ + "physical-location-id" : "complex1", + "physical-location-type" : "uug", + "street1" : "kDv5Ge6dr", + "city" : "KpEa5IjqY0u82", + "postal-code" : "6CRqacfEW2", + "country" : "P0ho", + "region" : "Sk2QevPYRBjT" +} diff --git a/aai-resources/src/test/resources/payloads/extensions/generic-vnf.json b/aai-resources/src/test/resources/payloads/extensions/generic-vnf.json new file mode 100644 index 0000000..3465c66 --- /dev/null +++ b/aai-resources/src/test/resources/payloads/extensions/generic-vnf.json @@ -0,0 +1,28 @@ +{ + "vnf-id": "Sample-Vnf-Id", + "vnf-name": "example-vnf-name-val-15051", + "vnf-name2": "example-vnf-name2-val-19349", + "vnf-type": "example-vnf-type-val-21675", + "vf-modules": { + "vf-module": [ + { + "vf-module-id": "SampleVfModule1", + "vf-module-name": "example-vf-module-name-val-31932", + "heat-stack-id": "example-heat-stack-id-val-98980", + "relationship-list": { + "relationship": [ + { + "related-to": "vnfc", + "relationship-data": [ + { + "relationship-key": "vnfc.vnfc-name", + "relationship-value": "Sample-VserverName1" + } + ] + } + ] + } + } + ] + } +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/extensions/pserver.json b/aai-resources/src/test/resources/payloads/extensions/pserver.json new file mode 100644 index 0000000..2f2a5f3 --- /dev/null +++ b/aai-resources/src/test/resources/payloads/extensions/pserver.json @@ -0,0 +1,4 @@ +{ + "hostname": "extension-pserver", + "purpose": "gamma-vce" +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/extensions/skeleton-pserver.json b/aai-resources/src/test/resources/payloads/extensions/skeleton-pserver.json new file mode 100644 index 0000000..008a39b --- /dev/null +++ b/aai-resources/src/test/resources/payloads/extensions/skeleton-pserver.json @@ -0,0 +1,63 @@ +{ + "hostname": "SkeletonPserver.aic.att.com", + "pserver-id": "auto-generated-skeleton", + "in-maint": false, + "relationship-list": { + "relationship": [ + { + "related-to": "vserver", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "Sample-att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "Sample-AAIAIC25" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "Sample-TenantId" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "Sample-VserverId" + } + ], + "related-to-property": [ + { + "property-key": "vserver.vserver-name", + "property-value": "Sample-VserverName" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "Sample-att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "Sample-AAIAIC25" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "complex", + "relationship-data": [ + { + "relationship-key": "complex.physical-location-id", + "relationship-value": "complex1" + } + ] + } + ] + } +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/extensions/tenant.json b/aai-resources/src/test/resources/payloads/extensions/tenant.json new file mode 100644 index 0000000..8e70472 --- /dev/null +++ b/aai-resources/src/test/resources/payloads/extensions/tenant.json @@ -0,0 +1,4 @@ +{ + "tenant-id" : "Sample-TenantId", + "tenant-name" : "Sample-TenantName" +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/extensions/vf-module.json b/aai-resources/src/test/resources/payloads/extensions/vf-module.json new file mode 100644 index 0000000..6880d13 --- /dev/null +++ b/aai-resources/src/test/resources/payloads/extensions/vf-module.json @@ -0,0 +1,3 @@ +{ + "vf-module-id": "SampleVfModule1" +} diff --git a/aai-resources/src/test/resources/payloads/extensions/vnfc.json b/aai-resources/src/test/resources/payloads/extensions/vnfc.json new file mode 100644 index 0000000..d5adae8 --- /dev/null +++ b/aai-resources/src/test/resources/payloads/extensions/vnfc.json @@ -0,0 +1,7 @@ +{ + "vnfc-name": "Sample-VserverName1", + "nfc-naming-code": "Sample-code", + "nfc-function": "Sample-function", + "vnfc-function-code": "Sample-code", + "vnfc-type": "Sample-function" +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/extensions/vserver-without-vf-module.json b/aai-resources/src/test/resources/payloads/extensions/vserver-without-vf-module.json new file mode 100644 index 0000000..54e3fd6 --- /dev/null +++ b/aai-resources/src/test/resources/payloads/extensions/vserver-without-vf-module.json @@ -0,0 +1,19 @@ +{ + "vserver-id": "Sample-VserverId", + "vserver-name": "Sample-VserverName", + "vserver-selflink": "http://testvserverLink.com/Sample-VserverLink", + "in-maint": false, + "relationship-list": { + "relationship": [ + { + "related-to": "pserver", + "relationship-data": [ + { + "relationship-key": "pserver.hostname", + "relationship-value": "SkeletonPserver.aic.att.com" + } + ] + } + ] + } +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/extensions/vserver.json b/aai-resources/src/test/resources/payloads/extensions/vserver.json new file mode 100644 index 0000000..5f83734 --- /dev/null +++ b/aai-resources/src/test/resources/payloads/extensions/vserver.json @@ -0,0 +1,32 @@ +{ + "vserver-id": "Sample-VserverId", + "vserver-name": "Sample-VserverName", + "vserver-selflink": "http://testvserverLink.com/Sample-VserverLink", + "in-maint": false, + "relationship-list": { + "relationship": [ + { + "related-to": "vf-module", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "Sample-Vnf-Id" + }, + { + "relationship-key": "vf-module.vf-module-id", + "relationship-value": "SampleVfModule1" + } + ] + }, + { + "related-to": "pserver", + "relationship-data": [ + { + "relationship-key": "pserver.hostname", + "relationship-value": "SkeletonPserver.aic.att.com" + } + ] + } + ] + } +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/resource/pserver1.json b/aai-resources/src/test/resources/payloads/resource/pserver1.json new file mode 100644 index 0000000..741183c --- /dev/null +++ b/aai-resources/src/test/resources/payloads/resource/pserver1.json @@ -0,0 +1,28 @@ +{ + "hostname": "pserver-hostname-test01", + "ptnii-equip-name": "example-ptnii-equip-name-val-36969", + "number-of-cpus": 62220, + "disk-in-gigabytes": 872, + "ram-in-megabytes": 35331, + "equip-type": "example-equip-type-val-22986", + "equip-vendor": "example-equip-vendor-val-37452", + "equip-model": "example-equip-model-val-14665", + "fqdn": "example-fqdn-val-33429", + "pserver-selflink": "example-pserver-selflink-val-10125", + "ipv4-oam-address": "example-ipv4-oam-address-val-3155", + "serial-number": "example-serial-number-val-12010", + "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-77686", + "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-17856", + "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-33665", + "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-6210", + "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-40977", + "inv-status": "example-inv-status-val-3682", + "pserver-id": "example-pserver-id-val-82142", + "internet-topology": "example-internet-topology-val-56425", + "in-maint": true, + "pserver-name2": "example-pserver-name2-val-53802", + "purpose": "example-purpose-val-90218", + "prov-status": "example-prov-status-val-11642", + "management-option": "example-management-option-val-91111", + "host-profile": "example-host-profile-val-36247" +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/resource/pserver2.json b/aai-resources/src/test/resources/payloads/resource/pserver2.json new file mode 100644 index 0000000..6b2676c --- /dev/null +++ b/aai-resources/src/test/resources/payloads/resource/pserver2.json @@ -0,0 +1,28 @@ +{ + "hostname": "pserver-hostname-test02", + "ptnii-equip-name": "example-ptnii-equip-name-val-36969", + "number-of-cpus": 62220, + "disk-in-gigabytes": 872, + "ram-in-megabytes": 35331, + "equip-type": "example-equip-type-val-22986", + "equip-vendor": "example-equip-vendor-val-37452", + "equip-model": "example-equip-model-val-14665", + "fqdn": "example-fqdn-val-33429", + "pserver-selflink": "example-pserver-selflink-val-10125", + "ipv4-oam-address": "example-ipv4-oam-address-val-3155", + "serial-number": "example-serial-number-val-12010", + "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-77686", + "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-17856", + "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-33665", + "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-6210", + "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-40977", + "inv-status": "example-inv-status-val-3682", + "pserver-id": "example-pserver-id-val-82142", + "internet-topology": "example-internet-topology-val-56425", + "in-maint": true, + "pserver-name2": "example-pserver-name2-val-53802", + "purpose": "example-purpose-val-90218", + "prov-status": "example-prov-status-val-11642", + "management-option": "example-management-option-val-91111", + "host-profile": "example-host-profile-val-36247" +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/resource/pserver3.json b/aai-resources/src/test/resources/payloads/resource/pserver3.json new file mode 100644 index 0000000..5f92770 --- /dev/null +++ b/aai-resources/src/test/resources/payloads/resource/pserver3.json @@ -0,0 +1,28 @@ +{ + "hostname": "pserver-hostname-test03", + "ptnii-equip-name": "example-ptnii-equip-name-val-36969", + "number-of-cpus": 62220, + "disk-in-gigabytes": 872, + "ram-in-megabytes": 35331, + "equip-type": "example-equip-type-val-22986", + "equip-vendor": "example-equip-vendor-val-37452", + "equip-model": "example-equip-model-val-14665", + "fqdn": "example-fqdn-val-33429", + "pserver-selflink": "example-pserver-selflink-val-10125", + "ipv4-oam-address": "example-ipv4-oam-address-val-3155", + "serial-number": "example-serial-number-val-12010", + "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-77686", + "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-17856", + "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-33665", + "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-6210", + "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-40977", + "inv-status": "example-inv-status-val-3682", + "pserver-id": "example-pserver-id-val-82142", + "internet-topology": "example-internet-topology-val-56425", + "in-maint": true, + "pserver-name2": "example-pserver-name2-val-53802", + "purpose": "example-purpose-val-90218", + "prov-status": "example-prov-status-val-11642", + "management-option": "example-management-option-val-91111", + "host-profile": "example-host-profile-val-36247" +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/resource/pserver4.json b/aai-resources/src/test/resources/payloads/resource/pserver4.json new file mode 100644 index 0000000..ee9b25c --- /dev/null +++ b/aai-resources/src/test/resources/payloads/resource/pserver4.json @@ -0,0 +1,28 @@ +{ + "hostname": "pserver-hostname-test04", + "ptnii-equip-name": "example-ptnii-equip-name-val-36969", + "number-of-cpus": 62220, + "disk-in-gigabytes": 872, + "ram-in-megabytes": 35331, + "equip-type": "example-equip-type-val-22986", + "equip-vendor": "example-equip-vendor-val-37452", + "equip-model": "example-equip-model-val-14665", + "fqdn": "example-fqdn-val-33429", + "pserver-selflink": "example-pserver-selflink-val-10125", + "ipv4-oam-address": "example-ipv4-oam-address-val-3155", + "serial-number": "example-serial-number-val-12010", + "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-77686", + "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-17856", + "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-33665", + "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-6210", + "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-40977", + "inv-status": "example-inv-status-val-3682", + "pserver-id": "example-pserver-id-val-82142", + "internet-topology": "example-internet-topology-val-56425", + "in-maint": true, + "pserver-name2": "example-pserver-name2-val-53802", + "purpose": "example-purpose-val-90218", + "prov-status": "example-prov-status-val-11642", + "management-option": "example-management-option-val-91111", + "host-profile": "example-host-profile-val-36247" +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/resource/pserver5.json b/aai-resources/src/test/resources/payloads/resource/pserver5.json new file mode 100644 index 0000000..7e7d1e0 --- /dev/null +++ b/aai-resources/src/test/resources/payloads/resource/pserver5.json @@ -0,0 +1,28 @@ +{ + "hostname": "pserver-hostname-test05", + "ptnii-equip-name": "example-ptnii-equip-name-val-36969", + "number-of-cpus": 62220, + "disk-in-gigabytes": 872, + "ram-in-megabytes": 35331, + "equip-type": "example-equip-type-val-22986", + "equip-vendor": "example-equip-vendor-val-37452", + "equip-model": "example-equip-model-val-14665", + "fqdn": "example-fqdn-val-33429", + "pserver-selflink": "example-pserver-selflink-val-10125", + "ipv4-oam-address": "example-ipv4-oam-address-val-3155", + "serial-number": "example-serial-number-val-12010", + "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-77686", + "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-17856", + "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-33665", + "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-6210", + "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-40977", + "inv-status": "example-inv-status-val-3682", + "pserver-id": "example-pserver-id-val-82142", + "internet-topology": "example-internet-topology-val-56425", + "in-maint": true, + "pserver-name2": "example-pserver-name2-val-53802", + "purpose": "example-purpose-val-90218", + "prov-status": "example-prov-status-val-11642", + "management-option": "example-management-option-val-91111", + "host-profile": "example-host-profile-val-36247" +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/resource/vserver.json b/aai-resources/src/test/resources/payloads/resource/vserver.json new file mode 100644 index 0000000..c2b38f5 --- /dev/null +++ b/aai-resources/src/test/resources/payloads/resource/vserver.json @@ -0,0 +1,19 @@ +{ + "cloud-owner": "test-aic", + "cloud-region-id": "testAIC1", + "tenants": {"tenant": [ { + "tenant-id": "tenant1", + "tenant-name": "tenant1", + "vservers": {"vserver": [ { + "vserver-id": "vserver1234", + "vserver-name": "vserver1234", + "vserver-selflink": "somelink", + "in-maint": false, + "is-closed-loop-disabled": false, + "relationship-list": {"relationship": [ { + "related-to": "pserver", + "related-link": "/aai/v15/cloud-infrastructure/pservers/pserver/pserver-hostname-test" + }]} + }]} + }]} +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/resource/vserver1.json b/aai-resources/src/test/resources/payloads/resource/vserver1.json new file mode 100644 index 0000000..1c2716a --- /dev/null +++ b/aai-resources/src/test/resources/payloads/resource/vserver1.json @@ -0,0 +1,19 @@ +{ + "cloud-owner": "test-aic", + "cloud-region-id": "testAIC01", + "tenants": {"tenant": [ { + "tenant-id": "tenant01", + "tenant-name": "tenant01", + "vservers": {"vserver": [ { + "vserver-id": "vserver01", + "vserver-name": "vserver01", + "vserver-selflink": "somelink", + "in-maint": false, + "is-closed-loop-disabled": false, + "relationship-list": {"relationship": [ { + "related-to": "pserver", + "related-link": "/aai/v15/cloud-infrastructure/pservers/pserver/pserver-hostname-test01" + }]} + }]} + }]} +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/resource/vserver2.json b/aai-resources/src/test/resources/payloads/resource/vserver2.json new file mode 100644 index 0000000..834c64f --- /dev/null +++ b/aai-resources/src/test/resources/payloads/resource/vserver2.json @@ -0,0 +1,19 @@ +{ + "cloud-owner": "test-aic", + "cloud-region-id": "testAIC02", + "tenants": {"tenant": [ { + "tenant-id": "tenant02", + "tenant-name": "tenant02", + "vservers": {"vserver": [ { + "vserver-id": "vserver02", + "vserver-name": "vserver02", + "vserver-selflink": "somelink", + "in-maint": false, + "is-closed-loop-disabled": false, + "relationship-list": {"relationship": [ { + "related-to": "pserver", + "related-link": "/aai/v15/cloud-infrastructure/pservers/pserver/pserver-hostname-test02" + }]} + }]} + }]} +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/resource/vserver3.json b/aai-resources/src/test/resources/payloads/resource/vserver3.json new file mode 100644 index 0000000..6e57e95 --- /dev/null +++ b/aai-resources/src/test/resources/payloads/resource/vserver3.json @@ -0,0 +1,19 @@ +{ + "cloud-owner": "test-aic", + "cloud-region-id": "testAIC03", + "tenants": {"tenant": [ { + "tenant-id": "tenant03", + "tenant-name": "tenant03", + "vservers": {"vserver": [ { + "vserver-id": "vserver03", + "vserver-name": "vserver03", + "vserver-selflink": "somelink", + "in-maint": false, + "is-closed-loop-disabled": false, + "relationship-list": {"relationship": [ { + "related-to": "pserver", + "related-link": "/aai/v15/cloud-infrastructure/pservers/pserver/pserver-hostname-test03" + }]} + }]} + }]} +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/resource/vserver4.json b/aai-resources/src/test/resources/payloads/resource/vserver4.json new file mode 100644 index 0000000..e8d825f --- /dev/null +++ b/aai-resources/src/test/resources/payloads/resource/vserver4.json @@ -0,0 +1,19 @@ +{ + "cloud-owner": "test-aic", + "cloud-region-id": "testAIC04", + "tenants": {"tenant": [ { + "tenant-id": "tenant04", + "tenant-name": "tenant04", + "vservers": {"vserver": [ { + "vserver-id": "vserver04", + "vserver-name": "vserver04", + "vserver-selflink": "somelink", + "in-maint": false, + "is-closed-loop-disabled": false, + "relationship-list": {"relationship": [ { + "related-to": "pserver", + "related-link": "/aai/v15/cloud-infrastructure/pservers/pserver/pserver-hostname-test04" + }]} + }]} + }]} +}
\ No newline at end of file diff --git a/aai-resources/src/test/resources/payloads/resource/vserver5.json b/aai-resources/src/test/resources/payloads/resource/vserver5.json new file mode 100644 index 0000000..973c0ee --- /dev/null +++ b/aai-resources/src/test/resources/payloads/resource/vserver5.json @@ -0,0 +1,19 @@ +{ + "cloud-owner": "test-aic", + "cloud-region-id": "testAIC05", + "tenants": {"tenant": [ { + "tenant-id": "tenant05", + "tenant-name": "tenant05", + "vservers": {"vserver": [ { + "vserver-id": "vserver05", + "vserver-name": "vserver05", + "vserver-selflink": "somelink05", + "in-maint": false, + "is-closed-loop-disabled": false, + "relationship-list": {"relationship": [ { + "related-to": "pserver", + "related-link": "/aai/v15/cloud-infrastructure/pservers/pserver/pserver-hostname-test05" + }]} + }]} + }]} +}
\ No newline at end of file |