@Test public void testReadConfigRequestMarkedInternal() throws Exception { JSONObject config = createConfig(); config.getJSONObject("default"). getJSONObject(DefaultServiceFetcher.GADGETS_FEATURES_CONFIG) .getJSONObject(DefaultServiceFetcher.OSAPI_FEATURE_CONFIG) .put(DefaultServiceFetcher.OSAPI_BASE_ENDPOINTS, new JSONArray(ImmutableList.of(endPoint1))); JsonContainerConfig containerConfig = new JsonContainerConfig(config, Expressions.forTesting(new Functions())); CapturingHttpFetcher httpFetcher = new CapturingHttpFetcher(); fetcher = new DefaultServiceFetcher(containerConfig, httpFetcher); fetcher.setSecurityTokenCodec( new BasicSecurityTokenCodec() ); Multimap<String, String> services = fetcher.getServicesForContainer("default", "dontcare"); assertEquals(configuredServices, services); assertNotNull( httpFetcher.request ); assertTrue( httpFetcher.request.isInternalRequest() ); }
@Test public void testReadConfigRequestMarkedInternal() throws Exception { JSONObject config = createConfig(); config.getJSONObject("default"). getJSONObject(DefaultServiceFetcher.GADGETS_FEATURES_CONFIG) .getJSONObject(DefaultServiceFetcher.OSAPI_FEATURE_CONFIG) .put(DefaultServiceFetcher.OSAPI_BASE_ENDPOINTS, new JSONArray(ImmutableList.of(endPoint1))); JsonContainerConfig containerConfig = new JsonContainerConfig(config, Expressions.forTesting(new Functions())); CapturingHttpFetcher httpFetcher = new CapturingHttpFetcher(); fetcher = new DefaultServiceFetcher(containerConfig, httpFetcher); fetcher.setSecurityTokenCodec( new BasicSecurityTokenCodec() ); Multimap<String, String> services = fetcher.getServicesForContainer("default", "dontcare"); assertEquals(configuredServices, services); assertNotNull( httpFetcher.request ); assertTrue( httpFetcher.request.isInternalRequest() ); }