com.sun.jersey.guice.spi.container.servlet.GuiceContainer Java Examples

The following examples show how to use com.sun.jersey.guice.spi.container.servlet.GuiceContainer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestRMWebServicesDelegationTokens.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  Configuration rmconf = new Configuration();
  rmconf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS,
    YarnConfiguration.DEFAULT_RM_AM_MAX_ATTEMPTS);
  rmconf.setClass(YarnConfiguration.RM_SCHEDULER, FifoScheduler.class,
    ResourceScheduler.class);
  rmconf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
  rm = new MockRM(rmconf);
  bind(ResourceManager.class).toInstance(rm);
  if (isKerberosAuth == true) {
    filter("/*").through(TestKerberosAuthFilter.class);
  } else {
    filter("/*").through(TestSimpleAuthFilter.class);
  }
  serve("/*").with(GuiceContainer.class);
}
 
Example #2
Source File: TestRMWebServicesDelegationTokens.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  Configuration rmconf = new Configuration();
  rmconf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS,
    YarnConfiguration.DEFAULT_RM_AM_MAX_ATTEMPTS);
  rmconf.setClass(YarnConfiguration.RM_SCHEDULER, FifoScheduler.class,
    ResourceScheduler.class);
  rmconf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
  rm = new MockRM(rmconf);
  bind(ResourceManager.class).toInstance(rm);
  if (isKerberosAuth == true) {
    filter("/*").through(TestKerberosAuthFilter.class);
  } else {
    filter("/*").through(TestSimpleAuthFilter.class);
  }
  serve("/*").with(GuiceContainer.class);
}
 
Example #3
Source File: AppServletModule.java    From appstart with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {
	
	// filters
	// Objectify filter
	filter("/*").through(ObjectifyFilter.class);

	// servlets
	serve("/home").with(HomeServlet.class);
	
	// Jersey restful servlet
    HashMap<String, String> params = new HashMap<String, String>();
       params.put(PackagesResourceConfig.PROPERTY_PACKAGES, "uk.co.inetria.appstart.frontend.rest");
       params.put(JSONConfiguration.FEATURE_POJO_MAPPING, "true");
       // speed up jersey startup under appengine
       params.put(ResourceConfig.FEATURE_DISABLE_WADL, "true");
       
       serve("/api/*").with(GuiceContainer.class, params);
	
	
}
 
Example #4
Source File: NewPaasGuiceServletConfig.java    From staash with Apache License 2.0 6 votes vote down vote up
@Override
protected Injector getInjector() {
    return LifecycleInjector.builder()
        .withModules(
            new MetaModule(),
            //new EurekaModule(),
            new JerseyServletModule() {
                @Override
                protected void configureServlets() {
                    // Route all requests through GuiceContainer
                    bind(GuiceContainer.class).asEagerSingleton();
                    serve("/*").with(GuiceContainer.class);
                }
            },
            new AbstractModule() {
                @Override
                protected void configure() {
                    bind(MetaCassandraBootstrap.class).asEagerSingleton();
                 }
            }
        )
        .createInjector();
}
 
Example #5
Source File: NgDemoApplicationSetup.java    From angulardemorestful with MIT License 6 votes vote down vote up
@Override
protected Injector getInjector() {
    return Guice.createInjector(new ServletModule() {

        @Override
        protected void configureServlets() {

            super.configureServlets();

            // Configuring Jersey via Guice:
            ResourceConfig resourceConfig = new PackagesResourceConfig("ngdemo/web");
            for (Class<?> resource : resourceConfig.getClasses()) {
                bind(resource);
            }

            // hook Jackson into Jersey as the POJO <-> JSON mapper
            bind(JacksonJsonProvider.class).in(Scopes.SINGLETON);

            serve("/web/*").with(GuiceContainer.class);

            filter("/web/*").through(ResponseCorsFilter.class);
        }
    }, new UserModule());
}
 
Example #6
Source File: GuiceServletConfig.java    From staash with Apache License 2.0 6 votes vote down vote up
@Override
protected Injector getInjector() {
    return LifecycleInjector.builder()
            .withModules(
                new EurekaModule(),
                 new PaasPropertiesModule(),   
                new JerseyServletModule() {
                    @Override
                    protected void configureServlets() {
                        bind(GuiceContainer.class).asEagerSingleton();
                        bind(StaashAdminResourceImpl.class);
                        bind(StaashDataResourceImpl.class);
                        serve("/*").with(GuiceContainer.class);
                    }
                }
            )
            .createInjector();
}
 
Example #7
Source File: RestModule.java    From AisAbnormal with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected void configureServlets() {
    ResourceConfig rc = new PackagesResourceConfig(
            "dk.dma.ais.abnormal.event.rest",
            "dk.dma.ais.abnormal.stat.rest",
            "dk.dma.commons.web.rest.defaults",
            "org.codehaus.jackson.jaxrs"
    );

    for ( Class<?> resource : rc.getClasses() ) {
        String packageName = resource.getPackage().getName();
        if (packageName.equals("dk.dma.commons.web.rest.defaults") || packageName.equals("org.codehaus.jackson.jaxrs")) {
            bind(resource).in(Scopes.SINGLETON);
        } else {
            bind(resource);
        }
    }

    serve("/rest/*").with( GuiceContainer.class );
}
 
Example #8
Source File: TestRMWebServicesNodeLabels.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  try {
    userName = UserGroupInformation.getCurrentUser().getShortUserName();
  } catch (IOException ioe) {
    throw new RuntimeException("Unable to get current user name "
        + ioe.getMessage(), ioe);
  }
  notUserName = userName + "abc123";
  conf = new YarnConfiguration();
  conf.set(YarnConfiguration.YARN_ADMIN_ACL, userName);
  rm = new MockRM(conf);
  bind(ResourceManager.class).toInstance(rm);
  filter("/*").through(
      TestRMWebServicesAppsModification.TestRMCustomAuthFilter.class);
  serve("/*").with(GuiceContainer.class);
}
 
Example #9
Source File: Module.java    From usergrid with Apache License 2.0 6 votes vote down vote up
protected void configureServlets() {
    //noinspection unchecked
    install( new GuicyFigModule( ServletFig.class, CoordinatorFig.class ) );
    install( new ChopClientModule() );

    // Hook Jersey into Guice Servlet
    bind( GuiceContainer.class );

    // Hook Jackson into Jersey as the POJO <-> JSON mapper
    bind( JacksonJsonProvider.class ).asEagerSingleton();

    bind( IController.class ).to( Controller.class );
    bind( RunnerRegistry.class ).to( RunnerRegistryImpl.class );
    bind( RunManager.class ).to( RunManagerImpl.class );

    bind( ResetResource.class );
    bind( StopResource.class );
    bind( StartResource.class );
    bind( StatsResource.class );
    bind( StatusResource.class );

    Map<String, String> params = new HashMap<String, String>();
    params.put( PACKAGES_KEY, getClass().getPackage().toString() );
    serve( "/*" ).with( GuiceContainer.class, params );
}
 
Example #10
Source File: AppModule.java    From jerseyoauth2 with MIT License 6 votes vote down vote up
@Override
	protected void configureServlets() {
    	bind(IUserService.class).to(DefaultPrincipalUserService.class);
    	bind(ITokenGenerator.class).to(MD5TokenGenerator.class);
    	bind(IClientIdGenerator.class).to(UUIDClientIdGenerator.class);
    	
    	bind(IConfiguration.class).to(Configuration.class);
    	bind(IRSConfiguration.class).to(Configuration.class);
    	bind(IAuthorizationFlow.class).to(TestAuthorizationFlow.class);
    	
    	bind(IClientService.class).to(DatabaseClientService.class);
    	bind(IAccessTokenStorageService.class).to(DatabaseAccessTokenStorage.class);
    	
    	serve("/oauth2/auth").with(AuthorizationServlet.class);
    	serve("/oauth2/allow").with(AllowServlet.class);
    	serve("/oauth2/accessToken").with(IssueAccessTokenServlet.class);
    	
       Map<String, String> params = new HashMap<String, String>();
       params.put(PackagesResourceConfig.PROPERTY_PACKAGES, "com.burgmeier.jerseyoauth2.sample.resources");
//see http://java.net/jira/browse/JERSEY-630	            
       params.put(PackagesResourceConfig.FEATURE_DISABLE_WADL, "true");
       params.put(ResourceConfig.PROPERTY_RESOURCE_FILTER_FACTORIES, OAuth20FilterFactory.class.getName());
       // Route all requests for rest resources through GuiceContainer
       serve("/rest/*").with(GuiceContainer.class, params);		
	}
 
Example #11
Source File: GuiceServletConfig.java    From staash with Apache License 2.0 6 votes vote down vote up
@Override
protected Injector getInjector() {
    return LifecycleInjector.builder()
            .withModules(
                new EurekaModule(),
                 new PaasPropertiesModule(),   
                new JerseyServletModule() {
                    @Override
                    protected void configureServlets() {
                        bind(GuiceContainer.class).asEagerSingleton();
                        bind(StaashAdminResourceImpl.class);
                        bind(StaashDataResourceImpl.class);
                        serve("/*").with(GuiceContainer.class);
                    }
                }
            )
            .createInjector();
}
 
Example #12
Source File: InjectedWebListener.java    From Raigad with Apache License 2.0 6 votes vote down vote up
@Override
  protected void configure() {
logger.info("** Binding OSS Config classes.");

      // Fix bug in Jersey-Guice integration exposed by child injectors
      binder().bind(GuiceContainer.class).asEagerSingleton();
      binder().bind(GuiceJobFactory.class).asEagerSingleton();
      binder().bind(IRaigadInstanceFactory.class).to(CassandraInstanceFactory.class);

      // TODO: Use config.getCredentialProvider() instead of IAMCredential
      binder().bind(ICredential.class).to(IAMCredential.class);
      binder().bind(AbstractRepository.class).annotatedWith(Names.named("s3")).to(S3Repository.class);
      binder().bind(AbstractRepositorySettingsParams.class).annotatedWith(Names.named("s3")).to(S3RepositorySettingsParams.class);
      bind(SchedulerFactory.class).to(StdSchedulerFactory.class).asEagerSingleton();
      bind(HostSupplier.class).to(EurekaHostsSupplier.class).in(Scopes.SINGLETON);
      binder().bind(IConfigSource.class).annotatedWith(Names.named("custom")).to(CompositeConfigSource.class);
  }
 
Example #13
Source File: SimpleContextListener.java    From dagger-servlet with Apache License 2.0 6 votes vote down vote up
@Override
protected Injector getInjector() {
    return Guice.createInjector(new JerseyServletModule() {
        @Override
        protected void configureServlets() {
            bind(SimpleService.class);
            bind(SimpleResource.class);

            serve("/*").with(GuiceContainer.class);
        }

        @Provides
        String provideDisplay() {
            return "SimpleDisplay";
        }
    });
}
 
Example #14
Source File: TestHsWebServices.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 1, 1);
  JobHistory jobHistoryService = new JobHistory();
  HistoryContext historyContext = (HistoryContext) jobHistoryService;
  webApp = new HsWebApp(historyContext);

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #15
Source File: StramWebServicesTest.java    From attic-apex-core with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets()
{
  LogicalPlan dag = new LogicalPlan();
  String workingDir = new File("target", StramWebServicesTest.class.getName()).getAbsolutePath();
  dag.setAttribute(LogicalPlan.APPLICATION_PATH, workingDir);
  dag.setAttribute(Context.OperatorContext.STORAGE_AGENT, new AsyncFSStorageAgent(workingDir, null));
  dag.setAttribute(LogicalPlan.METRICS_TRANSPORT, new AutoMetricBuiltInTransport("xyz"));
  final DummyStreamingContainerManager streamingContainerManager = new DummyStreamingContainerManager(dag);

  appContext = new TestAppContext(dag.getAttributes());
  bind(JAXBContextResolver.class);
  bind(StramWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(StramAppContext.class).toInstance(appContext);
  bind(StreamingContainerManager.class).toInstance(streamingContainerManager);
  bind(Configuration.class).toInstance(conf);
  serve("/*").with(GuiceContainer.class);
}
 
Example #16
Source File: TestRMWebServicesNodeLabels.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {
  bind(JAXBContextResolver.class);
  bind(RMWebServices.class);
  bind(GenericExceptionHandler.class);
  try {
    userName = UserGroupInformation.getCurrentUser().getShortUserName();
  } catch (IOException ioe) {
    throw new RuntimeException("Unable to get current user name "
        + ioe.getMessage(), ioe);
  }
  notUserName = userName + "abc123";
  conf = new YarnConfiguration();
  conf.set(YarnConfiguration.YARN_ADMIN_ACL, userName);
  rm = new MockRM(conf);
  bind(ResourceManager.class).toInstance(rm);
  filter("/*").through(
      TestRMWebServicesAppsModification.TestRMCustomAuthFilter.class);
  serve("/*").with(GuiceContainer.class);
}
 
Example #17
Source File: TestHsWebServicesAttempts.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #18
Source File: TestHsWebServices.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 1, 1);
  JobHistory jobHistoryService = new JobHistory();
  HistoryContext historyContext = (HistoryContext) jobHistoryService;
  webApp = new HsWebApp(historyContext);

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #19
Source File: TestHsWebServicesJobs.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1, false);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #20
Source File: TestHsWebServicesJobsQuery.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(3, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #21
Source File: TestHsWebServicesTasks.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #22
Source File: TestHsWebServicesJobsQuery.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(3, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #23
Source File: TestHsWebServicesTasks.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #24
Source File: TestHsWebServicesJobs.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1, false);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #25
Source File: TestHsWebServicesAttempts.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockHistoryContext(0, 1, 2, 1);
  webApp = mock(HsWebApp.class);
  when(webApp.name()).thenReturn("hsmockwebapp");

  bind(JAXBContextResolver.class);
  bind(HsWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(WebApp.class).toInstance(webApp);
  bind(AppContext.class).toInstance(appContext);
  bind(HistoryContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #26
Source File: TestAMWebServicesJobs.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockAppContext(0, 1, 2, 1);
  bind(JAXBContextResolver.class);
  bind(AMWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(AppContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #27
Source File: AppModule.java    From jerseyoauth2 with MIT License 5 votes vote down vote up
@Override
    protected void configureServlets() {
    	bind(IAccessTokenStorageService.class).to(CachingAccessTokenStorage.class);
    	bind(IClientService.class).to(DatabaseClientService.class);
    	bind(IConfiguration.class).to(Configuration.class);
    	bind(IRSConfiguration.class).to(Configuration.class);
    	bind(IAuthorizationFlow.class).to(TestAuthorizationFlow.class);
    	
    	bind(IUserService.class).to(DefaultPrincipalUserService.class);
    	bind(ITokenGenerator.class).to(MD5TokenGenerator.class);
    	bind(IClientIdGenerator.class).to(UUIDClientIdGenerator.class);
    	
    	bind(EntityManagerFactory.class).toProvider(new PersistenceProvider());
    	bind(CacheManager.class).toProvider(new DefaultCacheManagerProvider());
    	
    	serve("/oauth2/auth").with(AuthorizationServlet.class);
    	serve("/oauth2/accessToken").with(IssueAccessTokenServlet.class);
    	
    	filter("/oauth2/*").through(StrictSecurityFilter.class);
    	
       Map<String, String> params = new HashMap<String, String>();
       params.put(PackagesResourceConfig.PROPERTY_PACKAGES, "com.github.hburgmeier.jerseyoauth2.testsuite.resource;" +
       		"com.github.hburgmeier.jerseyoauth2.testsuite.base.resource");
//see http://java.net/jira/browse/JERSEY-630	            
       params.put(PackagesResourceConfig.FEATURE_DISABLE_WADL, "true");
       params.put(ResourceConfig.PROPERTY_RESOURCE_FILTER_FACTORIES, OAuth20FilterFactory.class.getName());
// Route all requests for rest resources through GuiceContainer
       serve("/rest/*").with(GuiceContainer.class, params);
    }
 
Example #28
Source File: TestAMWebServices.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockAppContext(0, 1, 1, 1);
  appContext.setBlacklistedNodes(Sets.newHashSet("badnode1", "badnode2"));
  
  bind(JAXBContextResolver.class);
  bind(AMWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(AppContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #29
Source File: TestAMWebServicesJobConf.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureServlets() {

  Path confPath = new Path(testConfDir.toString(),
      MRJobConfig.JOB_CONF_FILE);
  Configuration config = new Configuration();

  FileSystem localFs;
  try {
    localFs = FileSystem.getLocal(config);
    confPath = localFs.makeQualified(confPath);

    OutputStream out = localFs.create(confPath);
    try {
      conf.writeXml(out);
    } finally {
      out.close();
    }
    if (!localFs.exists(confPath)) {
      fail("error creating config file: " + confPath);
    }

  } catch (IOException e) {
    fail("error creating config file: " + e.getMessage());
  }

  appContext = new MockAppContext(0, 2, 1, confPath);

  bind(JAXBContextResolver.class);
  bind(AMWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(AppContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}
 
Example #30
Source File: TestAMWebServicesTasks.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureServlets() {

  appContext = new MockAppContext(0, 1, 2, 1);
  bind(JAXBContextResolver.class);
  bind(AMWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(AppContext.class).toInstance(appContext);
  bind(Configuration.class).toInstance(conf);

  serve("/*").with(GuiceContainer.class);
}