use of org.osgi.service.event.Event in project ddf by codice.
the class RegistryPublicationHandlerTest method setup.
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mcard = new MetacardImpl();
mcard.setAttribute(Metacard.TAGS, RegistryConstants.REGISTRY_TAG);
rph = new RegistryPublicationHandler(service, executorService);
eventProperties = new Hashtable<>();
eventProperties.put("ddf.catalog.event.metacard", mcard);
event = new Event("myevent", eventProperties);
}
use of org.osgi.service.event.Event in project ddf by codice.
the class RegistryPublicationManagerTest method testHandleEventDelete.
@Test
public void testHandleEventDelete() throws Exception {
publicationManager.handleEvent(getRegistryEvent(CREATED_TOPIC));
assertThat(publicationManager.getPublications().size(), is(1));
Event event = getRegistryEvent(DELETED_TOPIC);
publicationManager.handleEvent(event);
assertThat(publicationManager.getPublications().size(), is(0));
}
use of org.osgi.service.event.Event in project ddf by codice.
the class FederationAdminTest method testHandleEventDelete.
@Test
public void testHandleEventDelete() throws Exception {
performCreateEvent();
Dictionary<String, Object> eventProperties = new Hashtable<>();
eventProperties.put("ddf.catalog.event.metacard", mcard);
Event event = new Event("ddf/catalog/event/DELETED", eventProperties);
federationAdmin.handleEvent(event);
List<Map<String, Object>> result = (List<Map<String, Object>>) federationAdmin.allRegistryMetacardsSummary().get("nodes");
assertThat(result.size(), is(0));
}
use of org.osgi.service.event.Event in project ddf by codice.
the class FederationAdminTest method performCreateEvent.
private void performCreateEvent() throws Exception {
List<Map<String, Object>> result = (List<Map<String, Object>>) federationAdmin.allRegistryMetacardsSummary().get("nodes");
assertThat(result.size(), is(0));
Date timestamp = setupSummary(false);
Dictionary<String, Object> eventProperties = new Hashtable<>();
eventProperties.put("ddf.catalog.event.metacard", mcard);
Event event = new Event("ddf/catalog/event/CREATED", eventProperties);
federationAdmin.handleEvent(event);
result = (List<Map<String, Object>>) federationAdmin.allRegistryMetacardsSummary().get("nodes");
assertThat(result.size(), is(1));
Map<String, Object> mcardMap = result.get(0);
assertSummary(mcardMap, timestamp);
}
use of org.osgi.service.event.Event in project ddf by codice.
the class AbstractEventController method adminCancelDownload.
/**
* Called by {@link ddf.catalog.event.retrievestatus.DownloadStatusInfoImpl.cancelDownload} to fire a
* cancel event.
*
* @param userId The Id assigned to the user who is downloading.
* @param downloadIdentifier The randomly generated downloadId string assigned to the download at its start.
*/
public void adminCancelDownload(String userId, String downloadIdentifier) {
String downloadId = userId + downloadIdentifier;
Map<String, Object> propMap = new HashMap<>();
propMap.put(ActivityEvent.DOWNLOAD_ID_KEY, downloadId);
Event event = new Event(ActivityEvent.EVENT_TOPIC_DOWNLOAD_CANCEL, propMap);
eventAdmin.postEvent(event);
}
Aggregations