use of ddf.catalog.operation.CreateResponse in project ddf by codice.
the class RegistryIdPostIngestPluginTest method testProcessDelete.
@Test
public void testProcessDelete() throws Exception {
CreateResponse createResponse = new CreateResponseImpl(null, null, Collections.singletonList(getDefaultMetacard()));
registryIdPostIngestPlugin.process(createResponse);
DeleteResponse deleteResponse = new DeleteResponseImpl(null, null, Collections.singletonList(getDefaultMetacard()));
registryIdPostIngestPlugin.process(deleteResponse);
assertThat(registryIdPostIngestPlugin.getRegistryIds().size(), equalTo(0));
}
use of ddf.catalog.operation.CreateResponse in project ddf by codice.
the class CachingFederationStrategyTest method testProcessCreateResponse.
@Test
public void testProcessCreateResponse() throws Exception {
CreateResponse response = mock(CreateResponseImpl.class);
assertThat(response, is(strategy.process(response)));
}
use of ddf.catalog.operation.CreateResponse in project ddf by codice.
the class FederationAdminServiceImplTest method testAddRegistryEntryMetacard.
@Test
public void testAddRegistryEntryMetacard() throws Exception {
Metacard metacard = testMetacard;
Metacard createdMetacard = testMetacard;
Subject systemSubject = security.getSystemSubject();
Map<String, Serializable> properties = new HashMap<>();
properties.put(SecurityConstants.SECURITY_SUBJECT, systemSubject);
CreateRequest request = new CreateRequestImpl(Collections.singletonList(metacard), properties, null);
CreateResponse response = new CreateResponseImpl(request, null, Collections.singletonList(createdMetacard));
when(catalogFramework.create(any(CreateRequest.class))).thenReturn(response);
String createdMetacardId = federationAdminServiceImpl.addRegistryEntry(metacard);
assertThat(createdMetacardId, is(equalTo(RegistryObjectMetacardType.REGISTRY_ID)));
verify(catalogFramework).create(any(CreateRequest.class));
}
use of ddf.catalog.operation.CreateResponse in project ddf by codice.
the class FederationAdminServiceImplTest method testAddRegistryEntryStringWithDestinations.
@Test
public void testAddRegistryEntryStringWithDestinations() throws Exception {
Metacard metacard = testMetacard;
Metacard createdMetacard = testMetacard;
Set<String> destinations = new HashSet<>();
destinations.add(TEST_DESTINATION);
Subject systemSubject = security.getSystemSubject();
Map<String, Serializable> properties = new HashMap<>();
properties.put(SecurityConstants.SECURITY_SUBJECT, systemSubject);
CreateRequest request = new CreateRequestImpl(Collections.singletonList(metacard), properties, destinations);
CreateResponse response = new CreateResponseImpl(request, null, Collections.singletonList(createdMetacard));
when(registryTransformer.transform(any(InputStream.class))).thenReturn(metacard);
when(catalogFramework.create(any(CreateRequest.class))).thenReturn(response);
String createdMetacardId = federationAdminServiceImpl.addRegistryEntry(TEST_XML_STRING, destinations);
assertThat(createdMetacardId, is(equalTo(RegistryObjectMetacardType.REGISTRY_ID)));
verify(registryTransformer).transform(any(InputStream.class));
verify(catalogFramework).create(any(CreateRequest.class));
}
use of ddf.catalog.operation.CreateResponse in project ddf by codice.
the class FederationAdminServiceImplTest method testAddRegistryEntry.
@Test
public void testAddRegistryEntry() throws Exception {
String destination = TEST_DESTINATION;
Metacard metacard = testMetacard;
Metacard createdMetacard = testMetacard;
Set<String> destinations = new HashSet<>();
destinations.add(destination);
Subject systemSubject = security.getSystemSubject();
Map<String, Serializable> properties = new HashMap<>();
properties.put(SecurityConstants.SECURITY_SUBJECT, systemSubject);
CreateRequest request = new CreateRequestImpl(Collections.singletonList(metacard), properties, destinations);
CreateResponse response = new CreateResponseImpl(request, null, Collections.singletonList(createdMetacard));
when(catalogFramework.create(any(CreateRequest.class))).thenReturn(response);
String createdMetacardId = federationAdminServiceImpl.addRegistryEntry(metacard, destinations);
assertThat(createdMetacardId, is(equalTo(RegistryObjectMetacardType.REGISTRY_ID)));
verify(catalogFramework).create(any(CreateRequest.class));
}
Aggregations