AAI-1523 checkstyle warnings for aai-core parsers
[aai/aai-common.git] / aai-core / src / test / java / org / onap / aai / parsers / uri / URIToRelationshipObjectTest.java
index 29ba1c2..4d0ec6c 100644 (file)
@@ -41,113 +41,113 @@ import static org.junit.Assert.assertTrue;
 
 public class URIToRelationshipObjectTest extends AAISetup {
 
-       private SchemaVersion latest ;
-       private Loader loader;
+    private SchemaVersion latest ;
+    private Loader loader;
 
-       @Rule
-       public ExpectedException thrown = ExpectedException.none();
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
 
-       @PostConstruct
-       public void createLoader(){
-               latest = schemaVersions.getDefaultVersion();
-               loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, latest);
-       }
-       /**
-        * Uri.
-        *
-        * @throws JAXBException the JAXB exception
-        * @throws AAIException the AAI exception
-        * @throws IllegalArgumentException the illegal argument exception
-        * @throws UnsupportedEncodingException the unsupported encoding exception
-        * @throws URISyntaxException 
-        * @throws MalformedURLException the malformed URL exception
-        */
-       @Test
+    @PostConstruct
+    public void createLoader(){
+        latest = schemaVersions.getDefaultVersion();
+        loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, latest);
+    }
+    /**
+     * Uri.
+     *
+     * @throws JAXBException the JAXB exception
+     * @throws AAIException the AAI exception
+     * @throws IllegalArgumentException the illegal argument exception
+     * @throws UnsupportedEncodingException the unsupported encoding exception
+     * @throws URISyntaxException 
+     * @throws MalformedURLException the malformed URL exception
+     */
+    @Test
     public void uri() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException, URISyntaxException {
-               
-               URI uri = UriBuilder.fromPath("/aai/" + loader.getVersion() + "/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3").build();
-               URIToRelationshipObject parse = new URIToRelationshipObject(loader, uri);
-               Introspector result = parse.getResult();
-               String expected = "\\{\"related-to\":\"l-interface\",\"related-link\":\"/aai/" + latest + "/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3\",\"relationship-data\":\\[\\{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"mycloudregionowner\"\\},\\{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"mycloudregionid\"\\},\\{\"relationship-key\":\"tenant.tenant-id\",\"relationship-value\":\"key1\"\\},\\{\"relationship-key\":\"vserver.vserver-id\",\"relationship-value\":\"key2\"\\},\\{\"relationship-key\":\"l-interface.interface-name\",\"relationship-value\":\"key3\"\\}\\]\\}";
-               assertTrue("blah", result.marshal(false).matches(expected));
-               
-       }
-       
-       /**
-        * Uri no version.
-        *
-        * @throws JAXBException the JAXB exception
-        * @throws AAIException the AAI exception
-        * @throws IllegalArgumentException the illegal argument exception
-        * @throws UnsupportedEncodingException the unsupported encoding exception
-        * @throws URISyntaxException 
-        * @throws MalformedURLException the malformed URL exception
-        */
-       @Test
+        
+        URI uri = UriBuilder.fromPath("/aai/" + loader.getVersion() + "/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3").build();
+        URIToRelationshipObject parse = new URIToRelationshipObject(loader, uri);
+        Introspector result = parse.getResult();
+        String expected = "\\{\"related-to\":\"l-interface\",\"related-link\":\"/aai/" + latest + "/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3\",\"relationship-data\":\\[\\{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"mycloudregionowner\"\\},\\{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"mycloudregionid\"\\},\\{\"relationship-key\":\"tenant.tenant-id\",\"relationship-value\":\"key1\"\\},\\{\"relationship-key\":\"vserver.vserver-id\",\"relationship-value\":\"key2\"\\},\\{\"relationship-key\":\"l-interface.interface-name\",\"relationship-value\":\"key3\"\\}\\]\\}";
+        assertTrue("blah", result.marshal(false).matches(expected));
+        
+    }
+    
+    /**
+     * Uri no version.
+     *
+     * @throws JAXBException the JAXB exception
+     * @throws AAIException the AAI exception
+     * @throws IllegalArgumentException the illegal argument exception
+     * @throws UnsupportedEncodingException the unsupported encoding exception
+     * @throws URISyntaxException 
+     * @throws MalformedURLException the malformed URL exception
+     */
+    @Test
     public void uriNoVersion() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException, URISyntaxException {
-               URI uri = UriBuilder.fromPath("/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3").build();
-               URIToRelationshipObject parse = new URIToRelationshipObject(loader, uri);
-               Introspector result = parse.getResult();
-               String expected = "\\{\"related-to\":\"l-interface\",\"related-link\":\"/aai/" + latest + "/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3\",\"relationship-data\":\\[\\{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"mycloudregionowner\"\\},\\{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"mycloudregionid\"\\},\\{\"relationship-key\":\"tenant.tenant-id\",\"relationship-value\":\"key1\"\\},\\{\"relationship-key\":\"vserver.vserver-id\",\"relationship-value\":\"key2\"\\},\\{\"relationship-key\":\"l-interface.interface-name\",\"relationship-value\":\"key3\"\\}\\]\\}";
-               assertTrue("blah", result.marshal(false).matches(expected));
+        URI uri = UriBuilder.fromPath("/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3").build();
+        URIToRelationshipObject parse = new URIToRelationshipObject(loader, uri);
+        Introspector result = parse.getResult();
+        String expected = "\\{\"related-to\":\"l-interface\",\"related-link\":\"/aai/" + latest + "/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3\",\"relationship-data\":\\[\\{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"mycloudregionowner\"\\},\\{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"mycloudregionid\"\\},\\{\"relationship-key\":\"tenant.tenant-id\",\"relationship-value\":\"key1\"\\},\\{\"relationship-key\":\"vserver.vserver-id\",\"relationship-value\":\"key2\"\\},\\{\"relationship-key\":\"l-interface.interface-name\",\"relationship-value\":\"key3\"\\}\\]\\}";
+        assertTrue("blah", result.marshal(false).matches(expected));
 
-               
-       }
+        
+    }
 
-       /**
-        * Double key relationship.
-        *
-        * @throws JAXBException the JAXB exception
-        * @throws AAIException the AAI exception
-        * @throws IllegalArgumentException the illegal argument exception
-        * @throws UnsupportedEncodingException the unsupported encoding exception
-        * @throws URISyntaxException 
-        * @throws MalformedURLException the malformed URL exception
-        */
-       @Test
-       public void doubleKeyRelationship() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException, URISyntaxException {
-               URI uri = UriBuilder.fromPath("/aai/" + latest + "/cloud-infrastructure/complexes/complex/key1/ctag-pools/ctag-pool/key2/key3/").build();
-               URIToRelationshipObject parse = new URIToRelationshipObject(loader, uri);
-               Introspector result = parse.getResult();
-               String expected = "\\{\"related-to\":\"ctag-pool\",\"related-link\":\"/aai/" + latest + "/cloud-infrastructure/complexes/complex/key1/ctag-pools/ctag-pool/key2/key3\",\"relationship-data\":\\[\\{\"relationship-key\":\"complex.physical-location-id\",\"relationship-value\":\"key1\"\\},\\{\"relationship-key\":\"ctag-pool.target-pe\",\"relationship-value\":\"key2\"\\},\\{\"relationship-key\":\"ctag-pool.availability-zone-name\",\"relationship-value\":\"key3\"\\}\\]\\}";
-               assertTrue("blah", result.marshal(false).matches(expected));
+    /**
+     * Double key relationship.
+     *
+     * @throws JAXBException the JAXB exception
+     * @throws AAIException the AAI exception
+     * @throws IllegalArgumentException the illegal argument exception
+     * @throws UnsupportedEncodingException the unsupported encoding exception
+     * @throws URISyntaxException 
+     * @throws MalformedURLException the malformed URL exception
+     */
+    @Test
+    public void doubleKeyRelationship() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException, URISyntaxException {
+        URI uri = UriBuilder.fromPath("/aai/" + latest + "/cloud-infrastructure/complexes/complex/key1/ctag-pools/ctag-pool/key2/key3/").build();
+        URIToRelationshipObject parse = new URIToRelationshipObject(loader, uri);
+        Introspector result = parse.getResult();
+        String expected = "\\{\"related-to\":\"ctag-pool\",\"related-link\":\"/aai/" + latest + "/cloud-infrastructure/complexes/complex/key1/ctag-pools/ctag-pool/key2/key3\",\"relationship-data\":\\[\\{\"relationship-key\":\"complex.physical-location-id\",\"relationship-value\":\"key1\"\\},\\{\"relationship-key\":\"ctag-pool.target-pe\",\"relationship-value\":\"key2\"\\},\\{\"relationship-key\":\"ctag-pool.availability-zone-name\",\"relationship-value\":\"key3\"\\}\\]\\}";
+        assertTrue("blah", result.marshal(false).matches(expected));
 
-       }
-       
-       /**
-        * Uri with non string key.
-        *
-        * @throws JAXBException the JAXB exception
-        * @throws AAIException the AAI exception
-        * @throws IllegalArgumentException the illegal argument exception
-        * @throws UnsupportedEncodingException the unsupported encoding exception
-        * @throws URISyntaxException 
-        * @throws MalformedURLException the malformed URL exception
-        */
-       @Test
-       public void uriWithNonStringKey() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException, URISyntaxException {
-               URI uri = UriBuilder.fromPath("/aai/" + latest + "/network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/144").build();
-               URIToRelationshipObject parse = new URIToRelationshipObject(loader, uri);
-               Introspector result = parse.getResult();
-               String expected = "\\{\"related-to\":\"cvlan-tag\",\"related-link\":\"/aai/" + latest + "/network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/144\",\"relationship-data\":\\[\\{\"relationship-key\":\"vce.vnf-id\",\"relationship-value\":\"key1\"\\},\\{\"relationship-key\":\"port-group.interface-id\",\"relationship-value\":\"key2\"\\},\\{\"relationship-key\":\"cvlan-tag.cvlan-tag\",\"relationship-value\":\"144\"\\}\\]\\}";
-               assertTrue("blah", result.marshal(false).matches(expected));
-       }
-       /**
-        * Bad URI.
-        *
-        * @throws JAXBException the JAXB exception
-        * @throws AAIException the AAI exception
-        * @throws IllegalArgumentException the illegal argument exception
-        * @throws UnsupportedEncodingException the unsupported encoding exception
-        */
-       @Test
+    }
+    
+    /**
+     * Uri with non string key.
+     *
+     * @throws JAXBException the JAXB exception
+     * @throws AAIException the AAI exception
+     * @throws IllegalArgumentException the illegal argument exception
+     * @throws UnsupportedEncodingException the unsupported encoding exception
+     * @throws URISyntaxException 
+     * @throws MalformedURLException the malformed URL exception
+     */
+    @Test
+    public void uriWithNonStringKey() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException, URISyntaxException {
+        URI uri = UriBuilder.fromPath("/aai/" + latest + "/network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/144").build();
+        URIToRelationshipObject parse = new URIToRelationshipObject(loader, uri);
+        Introspector result = parse.getResult();
+        String expected = "\\{\"related-to\":\"cvlan-tag\",\"related-link\":\"/aai/" + latest + "/network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/144\",\"relationship-data\":\\[\\{\"relationship-key\":\"vce.vnf-id\",\"relationship-value\":\"key1\"\\},\\{\"relationship-key\":\"port-group.interface-id\",\"relationship-value\":\"key2\"\\},\\{\"relationship-key\":\"cvlan-tag.cvlan-tag\",\"relationship-value\":\"144\"\\}\\]\\}";
+        assertTrue("blah", result.marshal(false).matches(expected));
+    }
+    /**
+     * Bad URI.
+     *
+     * @throws JAXBException the JAXB exception
+     * @throws AAIException the AAI exception
+     * @throws IllegalArgumentException the illegal argument exception
+     * @throws UnsupportedEncodingException the unsupported encoding exception
+     */
+    @Test
     public void badURI() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException {
-               URI uri = UriBuilder.fromPath("/aai/" + loader.getVersion() + "/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interadsfaces/l-interface/key3").build();
-               
-               thrown.expect(AAIException.class);
-               thrown.expect(hasProperty("code",  is("AAI_3000")));
-               
-               URIToObject parse = new URIToObject(loader, uri);
-               
-       }
+        URI uri = UriBuilder.fromPath("/aai/" + loader.getVersion() + "/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interadsfaces/l-interface/key3").build();
+        
+        thrown.expect(AAIException.class);
+        thrown.expect(hasProperty("code",  is("AAI_3000")));
+        
+        URIToObject parse = new URIToObject(loader, uri);
+        
+    }
 }