use of ddf.action.Action in project ddf by codice.
the class AbstractMetacardActionProviderTest method getActionsWithMetacardThatHasNullId.
@Test
public void getActionsWithMetacardThatHasNullId() throws Exception {
MetacardActionProvider actionProvider = createMetacardActionProvider();
when(metacard.getId()).thenReturn(null);
Action action = actionProvider.getAction(metacard);
assertThat(action, is(nullValue()));
verify(actionProvider, never()).getMetacardAction(any(), any());
}
use of ddf.action.Action in project ddf by codice.
the class AbstractMetacardActionProviderTest method getActionsWithNull.
@Test
public void getActionsWithNull() throws Exception {
MetacardActionProvider actionProvider = createMetacardActionProvider();
Action action = actionProvider.getAction(null);
assertThat(action, is(nullValue()));
verify(actionProvider, never()).getMetacardAction(any(), any());
}
use of ddf.action.Action in project ddf by codice.
the class AbstractMetacardActionProviderTest method getActionsWhenHostNotSet.
@Test
public void getActionsWhenHostNotSet() throws Exception {
MetacardActionProvider actionProvider = createMetacardActionProvider();
when(actionProvider.canHandleMetacard(metacard)).thenReturn(true);
when(actionProvider.createMetacardAction(eq(ACTION_ID), eq(TITLE), eq(DESCRIPTION), any())).thenReturn(action);
when(actionProvider.getMetacardActionUrl(SOURCE_ID, metacard)).thenReturn(url);
System.clearProperty(SystemBaseUrl.HOST);
Action action = actionProvider.getAction(metacard);
assertThat(action, is(this.action));
verify(actionProvider).createMetacardAction(ACTION_ID, TITLE, DESCRIPTION, url);
}
use of ddf.action.Action in project ddf by codice.
the class TestKMLTransformerImpl method setUp.
@BeforeClass
public static void setUp() throws IOException {
when(mockContext.getBundle()).thenReturn(mockBundle);
URL url = TestKMLTransformerImpl.class.getResource(DEFAULT_STYLE_LOCATION);
when(mockBundle.getResource(any(String.class))).thenReturn(url);
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
ActionProvider mockActionProvider = mock(ActionProvider.class);
Action mockAction = mock(Action.class);
when(mockActionProvider.getAction(any(Metacard.class))).thenReturn(mockAction);
when(mockAction.getUrl()).thenReturn(new URL(ACTION_URL));
kmlTransformer = new KMLTransformerImpl(mockContext, DEFAULT_STYLE_LOCATION, new KmlStyleMap(), mockActionProvider);
}
use of ddf.action.Action in project ddf by codice.
the class TestRegistryReportActionProvider method testBlankSourceId.
@Test
public void testBlankSourceId() {
metacard.setSourceId("");
configureActionProvider();
Action action = actionProvider.getActions(metacard).get(0);
assertThat(action.getUrl().toString(), is(SAMPLE_PROTOCOL + SAMPLE_IP + ":" + SAMPLE_PORT + SAMPLE_SERVICES_ROOT + SAMPLE_PATH + metacard.getAttribute(RegistryObjectMetacardType.REGISTRY_ID).getValue().toString() + PATH_AND_FORMAT));
}
Aggregations