use of org.codice.ddf.catalog.async.data.api.internal.ProcessRequest in project ddf by codice.
the class MetacardBackupPluginTest method generateProcessRequest.
private ProcessRequest generateProcessRequest(Class<? extends ProcessResourceItem> clazz, boolean validCard) {
List<ProcessResourceItem> processCreateItems = new ArrayList<>();
for (String id : METACARD_IDS) {
Metacard metacard = new MetacardImpl();
metacard.setAttribute(new AttributeImpl(Core.ID, id));
metacard.setAttribute(new AttributeImpl(Core.METADATA, XML_METADATA));
if (!validCard) {
metacard.setAttribute(new AttributeImpl(Core.METACARD_TAGS, "INVALID"));
}
ProcessResourceItem processResourceItem;
if (clazz.getName().contains("ProcessCreateItem")) {
processResourceItem = mock(ProcessCreateItem.class);
} else {
processResourceItem = mock(ProcessUpdateItem.class);
}
when(processResourceItem.getMetacard()).thenReturn(metacard);
processCreateItems.add(processResourceItem);
}
ProcessRequest localCreateRequest = mock(ProcessRequest.class);
when(localCreateRequest.getProcessItems()).thenReturn(processCreateItems);
return localCreateRequest;
}
Aggregations