Examples of JpaPersistModule


Examples of com.google.inject.persist.jpa.JpaPersistModule

  public void testModuleConfigUsingJpa() throws Exception {
    Logger.getLogger(getClass().getName()).info("Starting EDSL test.");
    Guice.createInjector(Stage.PRODUCTION, new AbstractModule() {
      @Override
      protected void configure() {
        install(new JpaPersistModule("myunit"));
        binder().requireExplicitBindings();
      }
    });
    Logger.getLogger(getClass().getName()).info("Completed EDSL test.");
  }
View Full Code Here

Examples of com.google.inject.persist.jpa.JpaPersistModule

  @Inject
  Configuration configuration;

  @BeforeClass
  public static void beforeClass() throws Exception{
    injector = Guice.createInjector(new AuthorizationTestModule(), new JpaPersistModule("ambari-javadb"));
    injector.getInstance(GuiceJpaInitializer.class);

    apacheDSContainer = new ApacheDSContainer("dc=ambari,dc=apache,dc=org", "classpath:/users.ldif");
    apacheDSContainer.setPort(33389);
    apacheDSContainer.afterPropertiesSet();
View Full Code Here

Examples of com.google.inject.persist.jpa.JpaPersistModule

  @Inject
  UserDAO userDAO;

  @BeforeClass
  public static void prepareData() {
    injector = Guice.createInjector(new AuthorizationTestModule(), new JpaPersistModule("ambari-javadb"));
    injector.getInstance(GuiceJpaInitializer.class);
    injector.getInstance(OrmTestHelper.class).createTestUsers();
  }
View Full Code Here

Examples of com.google.inject.persist.jpa.JpaPersistModule

      bind(HeartBeatHandler.class).toInstance(handler);
      bind(AmbariMetaInfo.class).toInstance(ambariMetaInfo);
    }

    private void installDependencies() {
      install(new JpaPersistModule("ambari-javadb"));
      install(new FactoryModuleBuilder().implement(
          Cluster.class, ClusterImpl.class).build(ClusterFactory.class));
      install(new FactoryModuleBuilder().implement(
          Host.class, HostImpl.class).build(HostFactory.class));
      install(new FactoryModuleBuilder().implement(
View Full Code Here

Examples of com.google.inject.persist.jpa.JpaPersistModule

    bind(AmbariMetaInfo.class).toInstance(ambariMetaInfo);
    bind(HostsMap.class).toInstance(hostsMap);
   
    bind(PasswordEncoder.class).toInstance(new StandardPasswordEncoder());

    JpaPersistModule jpaPersistModule = new JpaPersistModule(configuration.getPersistenceType().getUnitName());
    if (configuration.getPersistenceType() == PersistenceType.POSTGRES) {
      Properties properties = new Properties();
      properties.setProperty("javax.persistence.jdbc.user", configuration.getDatabaseUser());
      properties.setProperty("javax.persistence.jdbc.password", configuration.getDatabasePassword());
      jpaPersistModule.properties(properties);
    }

    install(jpaPersistModule);

View Full Code Here

Examples of com.google.inject.persist.jpa.JpaPersistModule

    /** {@inheritDoc}
     * @see com.google.inject.servlet.GuiceServletContextListener#getInjector()
     */
    @Override
    protected Injector getInjector() {
        return Guice.createInjector(new JpaPersistModule("myblogUnit"), new ServletModule(){
            /** {@inheritDoc}
             * @see com.google.inject.servlet.ServletModule#configureServlets()
             */
            @Override
            protected void configureServlets() {
View Full Code Here

Examples of com.google.inject.persist.jpa.JpaPersistModule

 
  protected Injector injector;

  @Before
  public void before() {
    injector = Guice.createInjector(new JpaPersistModule("testUnit"), new ServiceModule());
    injector.getInstance(PersistService.class).start();
  }
View Full Code Here

Examples of com.google.inject.persist.jpa.JpaPersistModule

    bind(ServerActionManager.class).to(ServerActionManagerImpl.class);
  }

  private JpaPersistModule buildJpaPersistModule() {
    PersistenceType persistenceType = configuration.getPersistenceType();
    JpaPersistModule jpaPersistModule = new JpaPersistModule(Configuration.JDBC_UNIT_NAME);

    Properties properties = new Properties();

    switch (persistenceType) {
      case IN_MEMORY:
        properties.put("javax.persistence.jdbc.url", Configuration.JDBC_IN_MEMORY_URL);
        properties.put("javax.persistence.jdbc.driver", Configuration.JDBC_IN_MEMROY_DRIVER);
        properties.put("eclipselink.ddl-generation", "drop-and-create-tables");
        properties.put("eclipselink.orm.throw.exceptions", "true");
        jpaPersistModule.properties(properties);
        return jpaPersistModule;
      case REMOTE:
        properties.put("javax.persistence.jdbc.url", configuration.getDatabaseUrl());
        properties.put("javax.persistence.jdbc.driver", configuration.getDatabaseDriver());
        break;
      case LOCAL:
        properties.put("javax.persistence.jdbc.url", Configuration.JDBC_LOCAL_URL);
        properties.put("javax.persistence.jdbc.driver", Configuration.JDBC_LOCAL_DRIVER);
        break;
    }

    properties.setProperty("javax.persistence.jdbc.user", configuration.getDatabaseUser());
    properties.setProperty("javax.persistence.jdbc.password", configuration.getDatabasePassword());

    switch (configuration.getJPATableGenerationStrategy()) {
      case CREATE:
        properties.setProperty("eclipselink.ddl-generation", "create-tables");
        break;
      case DROP_AND_CREATE:
        properties.setProperty("eclipselink.ddl-generation", "drop-and-create-tables");
        break;
    }
    properties.setProperty("eclipselink.ddl-generation.output-mode", "both");
    properties.setProperty("eclipselink.create-ddl-jdbc-file-name", "DDL-create.jdbc");
    properties.setProperty("eclipselink.drop-ddl-jdbc-file-name", "DDL-drop.jdbc");

    jpaPersistModule.properties(properties);

    return jpaPersistModule;
  }
View Full Code Here

Examples of com.google.inject.persist.jpa.JpaPersistModule

      bind(HeartBeatHandler.class).toInstance(handler);
      bind(AmbariMetaInfo.class).toInstance(ambariMetaInfo);
    }

    private void installDependencies() {
      install(new JpaPersistModule("ambari-javadb"));
      install(new FactoryModuleBuilder().implement(
          Cluster.class, ClusterImpl.class).build(ClusterFactory.class));
      install(new FactoryModuleBuilder().implement(
          Host.class, HostImpl.class).build(HostFactory.class));
      install(new FactoryModuleBuilder().implement(
View Full Code Here

Examples of com.google.inject.persist.jpa.JpaPersistModule

    bind(Configuration.class).toInstance(configuration);
    bind(AmbariMetaInfo.class).toInstance(ambariMetaInfo);

    bind(PasswordEncoder.class).toInstance(new StandardPasswordEncoder());

    JpaPersistModule jpaPersistModule = new JpaPersistModule(configuration.getPersistenceType().getUnitName());
    if (configuration.getPersistenceType() == PersistenceType.POSTGRES) {
      Properties properties = new Properties();
      properties.setProperty("javax.persistence.jdbc.user", configuration.getDatabaseUser());
      properties.setProperty("javax.persistence.jdbc.password", configuration.getDatabasePassword());
      jpaPersistModule.properties(properties);
    }

    install(jpaPersistModule);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.