summaryrefslogtreecommitdiffstats
path: root/aai-core/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'aai-core/src/test')
-rw-r--r--aai-core/src/test/java/org/onap/aai/parsers/uri/URIParserTest.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/aai-core/src/test/java/org/onap/aai/parsers/uri/URIParserTest.java b/aai-core/src/test/java/org/onap/aai/parsers/uri/URIParserTest.java
index 111772d2..74914cce 100644
--- a/aai-core/src/test/java/org/onap/aai/parsers/uri/URIParserTest.java
+++ b/aai-core/src/test/java/org/onap/aai/parsers/uri/URIParserTest.java
@@ -22,23 +22,42 @@ package org.onap.aai.parsers.uri;
import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import java.io.UnsupportedEncodingException;
import java.net.URI;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
import javax.annotation.PostConstruct;
+import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.UriBuilder;
import javax.xml.bind.JAXBException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InOrder;
import org.onap.aai.AAISetup;
+import org.onap.aai.edges.enums.EdgeType;
import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.ModelType;
+import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
import org.onap.aai.setup.SchemaVersion;
+
public class URIParserTest extends AAISetup {
private Loader loader;
@@ -112,4 +131,26 @@ public class URIParserTest extends AAISetup {
new URIToDBKey(loader, uri);
}
+
+ @Test
+ public void verifyParsableInvokation() throws UnsupportedEncodingException, AAIException {
+ ArgumentCaptor<Introspector> cloudInfrastructureArgument = ArgumentCaptor.forClass(Introspector.class);
+ ArgumentCaptor<Introspector> containersArgument = ArgumentCaptor.forClass(Introspector.class);
+ ArgumentCaptor<Introspector> objectArgument = ArgumentCaptor.forClass(Introspector.class);
+ URI uri = UriBuilder.fromPath("cloud-infrastructure/complexes/complex/key1/ctag-pools/ctag-pool/key2/key3")
+ .build();
+ Parsable parsable = mock(Parsable.class);
+
+ URIParser uriParser = new URIParser(loader, uri);
+ uriParser.parse(parsable);
+
+ verify(parsable).processNamespace(cloudInfrastructureArgument.capture());
+ verify(parsable, times(2)).processContainer(containersArgument.capture(),eq(EdgeType.TREE),eq(new MultivaluedHashMap<>()),eq(false));
+ verify(parsable, times(2)).processObject(objectArgument.capture(),eq(EdgeType.TREE),eq(new MultivaluedHashMap<>()));
+ assertEquals("cloud-infrastructure", cloudInfrastructureArgument.getValue().getName());
+ assertEquals("complexes", containersArgument.getAllValues().get(0).getName());
+ assertEquals("ctag-pools", containersArgument.getAllValues().get(1).getName());
+ assertEquals("complex", objectArgument.getAllValues().get(0).getName());
+ assertEquals("ctag-pool", objectArgument.getAllValues().get(1).getName());
+ }
}