public GadgetsHandlerApi.MetadataResponse call() throws Exception { try { return handlerService.getMetadata(metadataRequest); } catch (Exception e) { sendError(metadataRequest.getUrl(), e, FAILURE_METADATA); return null; } } };
public GadgetsHandlerApi.MetadataResponse call() throws Exception { try { return handlerService.getMetadata(metadataRequest); } catch (Exception e) { sendError(metadataRequest.getUrl(), e, FAILURE_METADATA); return null; } } };
public CallableData call() throws Exception { try { return new CallableData(url, handlerService.getMetadata(metadataRequest)); } catch (Exception e) { return new CallableData(url, handlerService.createErrorResponse(null, e, FAILURE_METADATA)); } } };
@Test(expected = ProcessingException.class) public void testGetMetadataNoContainer() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest(FakeProcessor.SPEC_URL, null, null, createAuthContext(null, null), ImmutableList.of("*")); replay(); gadgetHandler.getMetadata(request); }
@Test(expected = ProcessingException.class) public void testGetMetadataNoUrl() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest(null, CONTAINER, null, createAuthContext(null, null), ImmutableList.of("*")); replay(); gadgetHandler.getMetadata(request); }
@Test(expected = ProcessingException.class) public void testGetMetadataNoContainer() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest( FakeProcessor.SPEC_URL, null, null, createTokenData(null, null), ImmutableList.of("*")); replay(); GadgetsHandlerApi.MetadataResponse response = gadgetHandler.getMetadata(request); }
@Test(expected = ProcessingException.class) public void testGetMetadataNoUrl() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest(null, CONTAINER, null, createAuthContext(null, null), ImmutableList.of("*")); replay(); gadgetHandler.getMetadata(request); }
@Test(expected = ProcessingException.class) public void testFeatureAdminDeniedGadget() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest(FakeProcessor.SPEC_URL4, CONTAINER, "default", createAuthContext(null, null), ImmutableList.of("*")); setupMockGadgetAdminStore(false); setupMockRegistry(Lists.newArrayList("example-feature", "example-feature2")); gadgetHandlerWithAdmin.getMetadata(request); }
@Test(expected = ProcessingException.class) public void testGetMetadataNoUrl() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest( null, CONTAINER, null, createTokenData(null, null), ImmutableList.of("*")); replay(); GadgetsHandlerApi.MetadataResponse response = gadgetHandler.getMetadata(request); }
@Test(expected = ProcessingException.class) public void testFeatureAdminDeniedGadget() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest(FakeProcessor.SPEC_URL4, CONTAINER, "default", createAuthContext(null, null), ImmutableList.of("*")); setupMockGadgetAdminStore(false); setupMockRegistry(Lists.newArrayList("example-feature", "example-feature2")); gadgetHandlerWithAdmin.getMetadata(request); }
@Test(expected = ProcessingException.class) public void testGetMetadataNoView() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest(FakeProcessor.SPEC_URL3, CONTAINER, "invalid_view", createAuthContext(null, null), ImmutableList.of("*")); replay(); gadgetHandler.getMetadata(request); }
@Test(expected = ProcessingException.class) public void testGetMetadataNoView() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest(FakeProcessor.SPEC_URL3, CONTAINER, "invalid_view", createAuthContext(null, null), ImmutableList.of("*")); replay(); gadgetHandler.getMetadata(request); }
@Test(expected = ProcessingException.class) public void testGetMetadataNoFields() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest(FakeProcessor.SPEC_URL, CONTAINER, null, createAuthContext(null, null), null); replay(); gadgetHandler.getMetadata(request); }
@Test(expected = ProcessingException.class) public void testGetMetadataNoFields() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest(FakeProcessor.SPEC_URL, CONTAINER, null, createAuthContext(null, null), null); replay(); gadgetHandler.getMetadata(request); }
@Test public void testGetMetadataNoToken() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest(FakeProcessor.SPEC_URL, CONTAINER, "default", null, ImmutableList.of("*")); setupMockGadgetAdminStore(true); setupMockRegistry(Lists.newArrayList("auth-refresh")); GadgetsHandlerApi.MetadataResponse response = gadgetHandler.getMetadata(request); assertEquals(FakeIframeUriManager.IFRAME_URIS_STRINGS, response.getIframeUrls()); verify(); }
@Test(expected = ProcessingException.class) public void testGetMetadataNoFields() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest( FakeProcessor.SPEC_URL, CONTAINER, null, createTokenData(null, null), null); replay(); GadgetsHandlerApi.MetadataResponse response = gadgetHandler.getMetadata(request); }
@Test public void testGetMetadataNoToken() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest(FakeProcessor.SPEC_URL, CONTAINER, "default", null, ImmutableList.of("*")); setupMockGadgetAdminStore(true); setupMockRegistry(Lists.newArrayList("auth-refresh")); GadgetsHandlerApi.MetadataResponse response = gadgetHandler.getMetadata(request); assertEquals(FakeIframeUriManager.IFRAME_URIS_STRINGS, response.getIframeUrls()); verify(); }
@Test(expected = ProcessingException.class) public void testGetMetadataBadGadget() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest(Uri.parse("unknown"), CONTAINER, null, createAuthContext(null, null), null); replay(); gadgetHandler.getMetadata(request); }
@Test(expected = ProcessingException.class) public void testGetMetadataBadGadget() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest(Uri.parse("unknown"), CONTAINER, null, createAuthContext(null, null), null); replay(); gadgetHandler.getMetadata(request); }
@Test public void testGetMetadataNoToken() throws Exception { GadgetsHandlerApi.MetadataRequest request = createMetadataRequest( FakeProcessor.SPEC_URL, CONTAINER, "view", null, ImmutableList.of("*")); replay(); GadgetsHandlerApi.MetadataResponse response = gadgetHandler.getMetadata(request); assertEquals(FakeIframeUriManager.DEFAULT_IFRAME_URI.toString(), response.getIframeUrl()); verify(); }