@Test public void shouldGetVdbImport() throws Exception { loadVdbs(); // get Properties settings = _uriBuilder.createSettings( SettingNames.VDB_NAME, TestUtilities.ALL_ELEMENTS_EXAMPLE_VDB_NAME); _uriBuilder.addSetting(settings, SettingNames.IMPORT_NAME, "x"); URI uri = _uriBuilder.buildVdbImportUri(LinkType.SELF, settings); this.response = request(uri).get(); final String entity = this.response.readEntity(String.class); assertThat(entity, is(notNullValue())); // System.out.println("Response from uri " + uri + ":\n" + entity); RestVdbImport vdbImport = KomodoJsonMarshaller.unmarshall(entity, RestVdbImport.class); assertNotNull(vdbImport); assertEquals(KomodoType.VDB_IMPORT, vdbImport.getkType()); assertEquals("x", vdbImport.getName()); assertEquals(2, vdbImport.getVersion()); assertEquals(false, vdbImport.isImportDataPolicies()); Collection<RestLink> links = vdbImport.getLinks(); assertEquals(3, links.size()); }
@Test public void shouldGetVdbImports() throws Exception { loadVdbs(); // get URI uri = _uriBuilder.generateVdbChildGroupUri( TestUtilities.ALL_ELEMENTS_EXAMPLE_VDB_NAME, LinkType.IMPORTS); this.response = request(uri).get(); final String entity = this.response.readEntity(String.class); assertThat(entity, is(notNullValue())); // System.out.println("Response:\n" + entity); RestVdbImport[] imports = KomodoJsonMarshaller.unmarshallArray(entity, RestVdbImport[].class); assertNotNull(imports); assertEquals(1, imports.length); RestVdbImport vdbImport = imports[0]; assertEquals(KomodoType.VDB_IMPORT, vdbImport.getkType()); assertEquals("x", vdbImport.getName()); assertEquals(2, vdbImport.getVersion()); assertEquals(false, vdbImport.isImportDataPolicies()); Collection<RestLink> links = vdbImport.getLinks(); assertEquals(3, links.size()); }