Package eu.planets_project.tb.impl

Examples of eu.planets_project.tb.impl.TestbedManagerImpl


    /**
     * NOTE that this may not work if the event has been updated and persisted during the same POST.
     */
    public void deleteMeasurementEvent() {
        log.info("Deleting MeasurementEvent "+this.getId());
        TestbedManagerImpl tbm = (TestbedManagerImpl) JSFUtil.getManagedObject("TestbedManager");
        // Now update experiment.
        ExperimentBean expBean = (ExperimentBean)JSFUtil.getManagedObject("ExperimentBean");
        BatchExecutionRecordImpl batch = expBean.getExperiment().getExperimentExecutable().getBatchExecutionRecords().iterator().next();
        ExecutionRecordImpl run = batch.getRuns().iterator().next();
       
        // Remove the Event itself:
        ExperimentPersistencyRemote db = tbm.getExperimentPersistencyRemote();
        setTargetInvocation(null);
        setTargetExecution(null);
        db.removeMeasurementEvent(this);
        log.info("deleteMeasurementEvent: Removed the event, now updating the experiment");
       
View Full Code Here


    /**
     *
     */
    public void deleteMeasurement() {
        if( this.getEvent() != null && this.measurementRecordId != -1 ) {
            TestbedManagerImpl tbm = (TestbedManagerImpl) JSFUtil.getManagedObject("TestbedManager");
            ExperimentPersistencyRemote db = tbm.getExperimentPersistencyRemote();
            // Remove the record.
            MeasurementImpl m = null;
            log.info("For measurment "+this.measurementRecordId );
            for( MeasurementImpl fm : getEvent().getMeasurements() ) {
                log.info("Looking at Measurement "+fm.getId());
View Full Code Here

    HashMap<Long,eu.planets_project.tb.api.model.Experiment> hmRet = new HashMap<Long,eu.planets_project.tb.api.model.Experiment>();
    Enumeration<Long> enumExpRefs = this.vRefExpIDs.elements();
    while(enumExpRefs.hasMoreElements()){
      long lExpRefId = enumExpRefs.nextElement();
      //get Singleton: TestbedManager
      TestbedManagerImpl testbedManager = TestbedManagerImpl.getInstance(true);
      ExperimentImpl experiment = (ExperimentImpl)testbedManager.getExperiment(lExpRefId);
      hmRet.put(experiment.getEntityID(), experiment);
    }
    return hmRet;
  }
View Full Code Here

 
  TestbedManager manager;
  private long expID1, expID2;
 
  protected void setUp(){
    manager = new TestbedManagerImpl();
    //create two new test Experiments
    //ExperimentImpl exp1 = (ExperimentImpl)manager.createNewExperiment();
    //expID1 = exp1.getEntityID();
     
    //ExperimentImpl exp2 = (ExperimentImpl)manager.createNewExperiment();
View Full Code Here

  @SuppressWarnings("unused")
  private long createExperiment1(){
   
    ExperimentSetupImpl expSetup = (ExperimentSetupImpl) createExperimentSetup();
   
    TestbedManagerImpl manager = TestbedManagerImpl.getInstance();
    ExperimentImpl exp1 = new ExperimentImpl();
    exp1.setState(ExperimentSetup.STATE_COMPLETED);
    exp1.setExperimentSetup(expSetup);
   
    //as the manager and the ExperimentImpl object are detached it is required to execute:
    /**
     * this call persists the ExperimentImpl and registers it within the TestbedManager
     * When the Experiment is persisted ExperimentSetupImpl-->BasicPropertiesImpl are persisted
     * as well through the @OneToOne(cascade={CascadeType.ALL})annotation
    **/
    long expID = manager.registerExperiment(exp1);
    System.out.println("Registered ExperimentID: "+expID);
    //As the ID is injected by the container it is important to query the Experiment Object again.
    exp1 = (ExperimentImpl)manager.getExperiment(expID);
    System.out.println("Got Registered ExperimentID: "+exp1.getEntityID());
    return exp1.getEntityID();

  }
View Full Code Here

   */
  private long createExperiment2(){
   
    ExperimentSetupImpl expSetup = (ExperimentSetupImpl) createExperimentSetup();
   
    TestbedManagerImpl tbmanager = TestbedManagerImpl.getInstance();
    /**
     * this call persists the ExperimentImpl. When the Experiment is persisted
     * ExperimentSetupImpl-->BasicPropertiesImpl are persisted as well through the
     * @OneToOne(cascade={CascadeType.ALL})annotation
    **/
    System.out.println("createExperiment2: hier1");
    ExperimentImpl exp = (ExperimentImpl)tbmanager.createNewExperiment();
    System.out.println("createExperiment2: hier2: received exp from createNewExp with ID: "+exp.getEntityID());
    exp.setState(ExperimentSetup.STATE_COMPLETED);
    System.out.println("createExperiment2: hier3");
    exp.setExperimentSetup(expSetup);
   
    //as the manager and the ExperimentImpl object are detached it is required to execute:
    System.out.println("createExperiment2: manager.updateExperiment with ID: "+exp.getEntityID());
    tbmanager.updateExperiment(exp);
    System.out.println("createExperiment2: hier4");
   
    return exp.getEntityID();
   
  }
View Full Code Here

   * persistently stored object from the TestbedManager.
   */
  public void testisExperimentCreated(){
    //check is SetupExperiment created
    //check are BasicProperties created
    TestbedManagerImpl manager = TestbedManagerImpl.getInstance();
    long lExperimentID = createExperiment2();

    ExperimentImpl exp = (ExperimentImpl)manager.getExperiment(lExperimentID);
    ExperimentSetupImpl expSetup = (ExperimentSetupImpl)exp.getExperimentSetup();
    BasicPropertiesImpl props = (BasicPropertiesImpl)expSetup.getBasicProperties();
   
    //now test if everything worked out
    assertTrue(exp!=null);
View Full Code Here

  public void isExperimentPersisted(){
   
  }
 
  public void testQueryAllExperiments(){
    TestbedManagerImpl manager = TestbedManagerImpl.getInstance();
    Iterator<Long> itIDs = manager.getAllExperimentIDs().iterator();
    while(itIDs.hasNext()){
      System.out.println("I'm using ID: "+itIDs.next());
    }
   
    //manager.queryAllExperiments();
View Full Code Here

TOP

Related Classes of eu.planets_project.tb.impl.TestbedManagerImpl

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.