Package siena.core

Examples of siena.core.PersistenceManagerLifeCycleWrapper


      }
     
      // activate lifecycle or not
      if(useLifecycle()){
        Logger.debug("Siena activating lifecycle management");
        persistenceManager = new PersistenceManagerLifeCycleWrapper(persistenceManager);
      }

      // is it required ?
      // connection.close();
      // for googlesql, forces Google driver
      //if(dbType.contains("google")){
      //  Properties p = new Properties();
      //  p.setProperty("driver", "com.google.appengine.api.rdbms.AppEngineDriver");
      //  p.setProperty("url", Play.configuration.getProperty("db.url"));
      //  p.setProperty("user", Play.configuration.getProperty("db.user"));
      //  p.setProperty("password", Play.configuration.getProperty("db.pass"));

      //  persistenceManager.init(p);
      //}else {
        persistenceManager.init(null);
      //}

            if(!disableJPA){
                JPAPlugin.closeTx(false);
            }
                         
        } else if(dbType.equals("nosql:gae")) {
      Logger.debug("Siena DB Type: GAE");
            persistenceManager = new GaePersistenceManager();
     
            // activate lifecycle or not
      if(useLifecycle()){
        Logger.debug("Siena activating lifecycle management");
        persistenceManager = new PersistenceManagerLifeCycleWrapper(persistenceManager);
      }

      persistenceManager.init(null);
        }
        else if(dbType.equals("nosql:sdb")) {
      Logger.debug("Siena DB Type: SDB");
            persistenceManager = new SdbPersistenceManager();

            String awsAccessKeyId = Play.configuration.getProperty("siena.aws.accesskeyid");           
            String awsSecretAccessKey = Play.configuration.getProperty("siena.aws.secretaccesskey");
            String prefix = Play.configuration.getProperty("siena.aws.prefix", "siena_devel_");
            String consistentread = Play.configuration.getProperty("siena.aws.consistentread", "true");

            if(awsAccessKeyId == null || awsSecretAccessKey == null){
              throw new UnexpectedException("siena.aws.accesskeyid & siena.aws.secretaccesskey required in conf");
            }
           
            Properties p = new Properties();
            p.setProperty("implementation", "siena.sdb.SdbPersistenceManager");
            p.setProperty("awsAccessKeyId", awsAccessKeyId);
            p.setProperty("awsSecretAccessKey", awsSecretAccessKey);
            p.setProperty("prefix", prefix);

           
            // activate lifecycle or not
      if(useLifecycle()){
        Logger.debug("Siena activating lifecycle management");
        persistenceManager = new PersistenceManagerLifeCycleWrapper(persistenceManager);
      }

            persistenceManager.init(p);
           
            if(consistentread.toLowerCase().equals("true")){
View Full Code Here


    assertEquals(mk2.id1, afterDisc.mk2.id1);
    assertEquals(mk2.id2, afterDisc.mk2.id2);
  }
 
  public void testLifeCycleGet(){
    PersistenceManagerLifeCycleWrapper pml = new PersistenceManagerLifeCycleWrapper(pm);
   
    DiscoveryLifeCycle before = new DiscoveryLifeCycle("Radioactivity", LongAutoID_CURIE);
    pm.insert(before);
   
    lifeCyclePhase = "";
    DiscoveryLifeCycle after = new DiscoveryLifeCycle();
    after.id = before.id;
    pml.get(after);
   
    assertEquals(LifeCyclePhase.PRE_FETCH.toString()+" "+LifeCyclePhase.POST_FETCH.toString()+" ", lifeCyclePhase);
  }
View Full Code Here

   
    assertEquals(LifeCyclePhase.PRE_FETCH.toString()+" "+LifeCyclePhase.POST_FETCH.toString()+" ", lifeCyclePhase);
  }
 
  public void testLifeCycleGetMultiAndLifeCycleInjection(){
    PersistenceManagerLifeCycleWrapper pml = new PersistenceManagerLifeCycleWrapper(pm);
   
    DiscoveryLifeCycleMulti before = new DiscoveryLifeCycleMulti("Radioactivity", LongAutoID_CURIE);
    pm.insert(before);
   
    lifeCyclePhase = "";
    DiscoveryLifeCycleMulti after = new DiscoveryLifeCycleMulti();
    after.id = before.id;
    pml.get(after);
   
    assertEquals(LifeCyclePhase.PRE_FETCH.toString()+" "+LifeCyclePhase.POST_FETCH.toString()+" ", lifeCyclePhase);
  }
View Full Code Here

   
    assertEquals(LifeCyclePhase.PRE_FETCH.toString()+" "+LifeCyclePhase.POST_FETCH.toString()+" ", lifeCyclePhase);
  }
 
  public void testLifeCycleInsert(){
    PersistenceManagerLifeCycleWrapper pml = new PersistenceManagerLifeCycleWrapper(pm);
   
    lifeCyclePhase = "";
    DiscoveryLifeCycle before = new DiscoveryLifeCycle("Radioactivity", LongAutoID_CURIE);
    pml.insert(before);
   
    assertEquals(LifeCyclePhase.PRE_INSERT.toString()+" "+LifeCyclePhase.POST_INSERT.toString()+" ", lifeCyclePhase);
  }
View Full Code Here

   
    assertEquals(LifeCyclePhase.PRE_INSERT.toString()+" "+LifeCyclePhase.POST_INSERT.toString()+" ", lifeCyclePhase);
  }
 
  public void testLifeCycleDelete(){
    PersistenceManagerLifeCycleWrapper pml = new PersistenceManagerLifeCycleWrapper(pm);
   
    lifeCyclePhase = "";
    DiscoveryLifeCycle before = new DiscoveryLifeCycle("Radioactivity", LongAutoID_CURIE);
    pm.insert(before);
   
    pml.delete(before);
   
    assertEquals(LifeCyclePhase.PRE_DELETE.toString()+" "+LifeCyclePhase.POST_DELETE.toString()+" ", lifeCyclePhase);
  }
View Full Code Here

   
    assertEquals(LifeCyclePhase.PRE_DELETE.toString()+" "+LifeCyclePhase.POST_DELETE.toString()+" ", lifeCyclePhase);
  }
 
  public void testLifeCycleUpdate(){
    PersistenceManagerLifeCycleWrapper pml = new PersistenceManagerLifeCycleWrapper(pm);
   
    DiscoveryLifeCycle before = new DiscoveryLifeCycle("Radioactivity", LongAutoID_CURIE);
    pm.insert(before);
   
    lifeCyclePhase = "";
    before.name = "Radioactivity_UPD";
    pml.update(before);
   
    assertEquals(LifeCyclePhase.PRE_UPDATE.toString()+" "+LifeCyclePhase.POST_UPDATE.toString()+" ", lifeCyclePhase);
  }
View Full Code Here

   
    assertEquals(LifeCyclePhase.PRE_UPDATE.toString()+" "+LifeCyclePhase.POST_UPDATE.toString()+" ", lifeCyclePhase);
  }
 
  public void testLifeCycleSave(){
    PersistenceManagerLifeCycleWrapper pml = new PersistenceManagerLifeCycleWrapper(pm);
   
    lifeCyclePhase = "";
    DiscoveryLifeCycle before = new DiscoveryLifeCycle("Radioactivity", LongAutoID_CURIE);
    pml.save(before);
   
    assertEquals(LifeCyclePhase.PRE_SAVE.toString()+" "+LifeCyclePhase.POST_SAVE.toString()+" ", lifeCyclePhase);
  }
View Full Code Here

TOP

Related Classes of siena.core.PersistenceManagerLifeCycleWrapper

Copyright © 2018 www.massapicom. 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.