Search in sources :

Example 6 with RouteStore

use of co.cask.cdap.route.store.RouteStore in project cdap by caskdata.

the class RoutingToDataSetsTest method before.

@BeforeClass
public static void before() throws Exception {
    CConfiguration cConf = CConfiguration.create();
    Injector injector = Guice.createInjector(new SecurityModules().getInMemoryModules(), new DiscoveryRuntimeModule().getInMemoryModules(), new AppFabricTestModule(cConf));
    // Starting router
    DiscoveryServiceClient discoveryServiceClient = injector.getInstance(DiscoveryServiceClient.class);
    AccessTokenTransformer accessTokenTransformer = injector.getInstance(AccessTokenTransformer.class);
    RouteStore routeStore = injector.getInstance(RouteStore.class);
    SConfiguration sConf = SConfiguration.create();
    cConf.set(Constants.Router.ADDRESS, "localhost");
    port = Networks.getRandomPort();
    cConf.setInt(Constants.Router.ROUTER_PORT, port);
    nettyRouter = new NettyRouter(cConf, sConf, InetAddresses.forString("127.0.0.1"), new RouterServiceLookup(cConf, discoveryServiceClient, new RouterPathLookup(), routeStore), new SuccessTokenValidator(), accessTokenTransformer, discoveryServiceClient);
    nettyRouter.startAndWait();
    // Starting mock DataSet service
    DiscoveryService discoveryService = injector.getInstance(DiscoveryService.class);
    mockService = new MockHttpService(discoveryService, Constants.Service.DATASET_MANAGER, new MockDatasetTypeHandler(), new MockDatasetInstanceHandler());
    mockService.startAndWait();
}
Also used : DiscoveryServiceClient(org.apache.twill.discovery.DiscoveryServiceClient) RouteStore(co.cask.cdap.route.store.RouteStore) CConfiguration(co.cask.cdap.common.conf.CConfiguration) SecurityModules(co.cask.cdap.security.guice.SecurityModules) AccessTokenTransformer(co.cask.cdap.security.auth.AccessTokenTransformer) Injector(com.google.inject.Injector) SConfiguration(co.cask.cdap.common.conf.SConfiguration) AppFabricTestModule(co.cask.cdap.internal.guice.AppFabricTestModule) DiscoveryService(org.apache.twill.discovery.DiscoveryService) DiscoveryRuntimeModule(co.cask.cdap.common.guice.DiscoveryRuntimeModule) BeforeClass(org.junit.BeforeClass)

Aggregations

RouteStore (co.cask.cdap.route.store.RouteStore)6 ServiceDiscoverable (co.cask.cdap.common.service.ServiceDiscoverable)3 ApplicationId (co.cask.cdap.proto.id.ApplicationId)3 ProgramId (co.cask.cdap.proto.id.ProgramId)3 Injector (com.google.inject.Injector)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Discoverable (org.apache.twill.discovery.Discoverable)3 Test (org.junit.Test)3 CConfiguration (co.cask.cdap.common.conf.CConfiguration)2 SConfiguration (co.cask.cdap.common.conf.SConfiguration)2 DiscoveryRuntimeModule (co.cask.cdap.common.guice.DiscoveryRuntimeModule)2 AppFabricTestModule (co.cask.cdap.internal.guice.AppFabricTestModule)2 RouteConfig (co.cask.cdap.route.store.RouteConfig)2 AccessTokenTransformer (co.cask.cdap.security.auth.AccessTokenTransformer)2 SecurityModules (co.cask.cdap.security.guice.SecurityModules)2 DiscoveryServiceClient (org.apache.twill.discovery.DiscoveryServiceClient)2 ZKRouteStore (co.cask.cdap.route.store.ZKRouteStore)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1