@Before public void setUp() throws Exception { functions = new Functions(FunctionsTest.class); }
@Before public void setUp() throws Exception { functions = new Functions(FunctionsTest.class); }
@Before public void setUp() throws Exception { functions = new Functions(FunctionsTest.class); }
@Before public void setUp() throws Exception { functions = new Functions(FunctionsTest.class); }
@Before public void setUp() throws Exception { functions = new Functions(FunctionsTest.class); }
@Before public void setUp() throws Exception { JSONObject config = createConfig(); JsonContainerConfig containerConfig = new JsonContainerConfig(config, Expressions.forTesting(new Functions())); mockFetcher = mock(HttpFetcher.class); fetcher = new DefaultServiceFetcher(containerConfig, mockFetcher); }
@Before public void setUp() throws Exception { JSONObject config = createConfig(); JsonContainerConfig containerConfig = new JsonContainerConfig(config, Expressions.forTesting(new Functions())); mockFetcher = mock(HttpFetcher.class); fetcher = new DefaultServiceFetcher(containerConfig, mockFetcher); }
@Before public void setUp() throws Exception { JSONObject config = createConfig(); JsonContainerConfig containerConfig = new JsonContainerConfig(config, Expressions.forTesting(new Functions())); mockFetcher = mock(HttpFetcher.class); fetcher = new DefaultServiceFetcher(containerConfig, mockFetcher); }
@Before public void setUp() { Functions functions = new Functions(OpensocialFunctions.class); expressions = Expressions.forTesting(functions); context = expressions.newELContext(new RootELResolver(vars)); }
@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() ); }
@Before public void setUp() { Functions functions = new Functions(OpensocialFunctions.class); expressions = Expressions.forTesting(functions); context = expressions.newELContext(new RootELResolver(vars)); }
@Before public void setUp() { Functions functions = new Functions(OpensocialFunctions.class); expressions = Expressions.forTesting(functions); context = expressions.newELContext(new RootELResolver(vars)); }
@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() ); }
@Before public void setUp() { Functions functions = new Functions(OpensocialFunctions.class); expressions = Expressions.forTesting(functions); context = expressions.newELContext(new RootELResolver(vars)); }
@Before public void setUp() { Functions functions = new Functions(OpensocialFunctions.class); expressions = Expressions.forTesting(functions); context = expressions.newELContext(new RootELResolver(vars)); }
@Test public void testReadConfigNoEndpoints() throws Exception { JSONObject config = createConfig(); config.getJSONObject("default"). getJSONObject(DefaultServiceFetcher.GADGETS_FEATURES_CONFIG) .remove(DefaultServiceFetcher.OSAPI_FEATURE_CONFIG); JsonContainerConfig containerConfig = new JsonContainerConfig(config, Expressions.forTesting(new Functions())); fetcher = new DefaultServiceFetcher(containerConfig, mockFetcher); EasyMock.expect(mockFetcher.fetch(EasyMock.isA(HttpRequest.class))).andReturn( new HttpResponse("")).anyTimes(); replay(); Multimap<String, String> services = fetcher.getServicesForContainer("default", "dontcare"); verify(); assertEquals(configuredServices, services); }
@Test public void testReadConfigNoEndpoints() throws Exception { JSONObject config = createConfig(); config.getJSONObject("default"). getJSONObject(DefaultServiceFetcher.GADGETS_FEATURES_CONFIG) .remove(DefaultServiceFetcher.OSAPI_FEATURE_CONFIG); JsonContainerConfig containerConfig = new JsonContainerConfig(config, Expressions.forTesting(new Functions())); fetcher = new DefaultServiceFetcher(containerConfig, mockFetcher); EasyMock.expect(mockFetcher.fetch(EasyMock.isA(HttpRequest.class))).andReturn( new HttpResponse("")).anyTimes(); replay(); Multimap<String, String> services = fetcher.getServicesForContainer("default", "dontcare"); verify(); assertEquals(configuredServices, services); }
@Test public void testReadConfigNoEndpoints() throws Exception { JSONObject config = createConfig(); config.getJSONObject("default"). getJSONObject(DefaultServiceFetcher.GADGETS_FEATURES_CONFIG) .remove(DefaultServiceFetcher.OSAPI_FEATURE_CONFIG); JsonContainerConfig containerConfig = new JsonContainerConfig(config, Expressions.forTesting(new Functions())); fetcher = new DefaultServiceFetcher(containerConfig, mockFetcher); EasyMock.expect(mockFetcher.fetch(EasyMock.isA(HttpRequest.class))).andReturn( new HttpResponse("")).anyTimes(); replay(); Multimap<String, String> services = fetcher.getServicesForContainer("default", "dontcare"); verify(); assertEquals(configuredServices, services); }