@Test public void testNullProtocol() { configureActionProvider(null, SAMPLE_IP, SAMPLE_SECURE_PORT, SAMPLE_SERVICES_ROOT); Action action = actionProvider.getActions(metacard).get(0); assertThat(action.getUrl().toString(), containsString("https")); }
@Test public void testSourceIdPresent() { configureActionProvider(); Action action = actionProvider.getActions(metacard).get(0); assertEquals(actionProvider.getTitle(), action.getTitle()); assertEquals(actionProvider.getDescription(), action.getDescription()); assertThat( action.getUrl().toString(), is( expectedDefaultAddressWith( metacard .getAttribute(RegistryObjectMetacardType.REGISTRY_ID) .getValue() .toString()))); assertEquals(ACTION_PROVIDER_ID, actionProvider.getId()); }
@Test public void testNullSourceId() { metacard.setSourceId(null); 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)); }
@Test public void testSecureMetacard() { this.configureSecureActionProvider(); Action action = actionProvider.getActions(metacard).get(0); assertEquals(actionProvider.getTitle(), action.getTitle()); assertEquals(actionProvider.getDescription(), action.getDescription()); assertEquals( SAMPLE_SECURE_PROTOCOL + SAMPLE_IP + ":" + SAMPLE_SECURE_PORT + SAMPLE_SERVICES_ROOT + SAMPLE_PATH + metacard.getAttribute(RegistryObjectMetacardType.REGISTRY_ID).getValue().toString() + PATH_AND_FORMAT + SOURCE_ID_QUERY_PARAM + SAMPLE_SOURCE_ID, action.getUrl().toString()); assertEquals(ACTION_PROVIDER_ID, actionProvider.getId()); }