@Test public void testUpdatedDataset() throws Exception { Dataset dataset = new Dataset(); dataset.setTitle("Foobar"); Endpoint endpoint = new Endpoint(); endpoint.setUrl(URI.create("http://localhost/nmr")); dataset.addEndpoint(endpoint); when(client.execute(argThat(HttpGetMatcher.matchUrl("http://localhost/nmr?op=capabilities")))) .thenReturn(prepareResponse(200, "tapir/capabilities1.xml")); when(client.execute(argThat(HttpGetMatcher.matchUrl("http://localhost/nmr")))) .thenReturn(prepareResponse(200, "tapir/metadata1.xml")); when(client.execute( argThat( HttpGetMatcher.matchUrl( "http://localhost/nmr?op=s&t=http%3A%2F%2Frs.gbif.org%2Ftemplates%2Ftapir%2Fdwc%2F1.4%2Fsci_name_range.xml&count=true&start=0&limit=1&lower=AAA&upper=zzz")))) .thenReturn(prepareResponse(200, "tapir/search1.xml")); SyncResult syncResult = synchroniser.syncInstallation(installation, Lists.newArrayList(dataset)); assertThat(syncResult.deletedDatasets).describedAs("Deleted datasets").isEmpty(); assertThat(syncResult.existingDatasets).hasSize(1); assertThat(syncResult.addedDatasets).isEmpty(); assertThat(syncResult.existingDatasets.get(dataset).getTitle()) .isEqualTo("ENGLISHNatural History Museum Rotterdam"); }
public static Dataset newInstance(UUID owningOrganizationKey, UUID installationKey) { Dataset d = INSTANCE.newTypedInstance(); d.setOwningOrganizationKey(owningOrganizationKey); d.setInstallationKey(installationKey); return d; }