Package eu.planets_project.tb.api.model.benchmark

Examples of eu.planets_project.tb.api.model.benchmark.BenchmarkGoal


  public List<BenchmarkGoal> getAllBenchmarkGoals(String sCategoryName){
    //all benchmark goals for a given category
    List<BenchmarkGoal> ret = new Vector<BenchmarkGoal>();
    Iterator<BenchmarkGoal> itTemplates = this.hmBmGoals.values().iterator();
    while(itTemplates.hasNext()){
      BenchmarkGoal template = itTemplates.next();
      if(template.getCategory().equals(sCategoryName))
        ret.add(this.getBenchmarkGoal(template.getID()));
    }
    return ret;
  }
View Full Code Here


   */
  public List<String> getAllBenchmarkGoalIDs(String sCategoryName){
    List<String> ret = new Vector<String>();
    Iterator<BenchmarkGoal> itGoals = this.hmBmGoals.values().iterator();
    while(itGoals.hasNext()){
      BenchmarkGoal goal = itGoals.next();
      if(goal.getCategory().equals(sCategoryName))
        ret.add(goal.getID());
    }
    return ret;
  }
View Full Code Here

   */
  public List<String> getAllBenchmarkGoalIDs() {
    List<String> ret = new Vector<String>();
    Iterator<BenchmarkGoal> itGoals = this.hmBmGoals.values().iterator();
    while(itGoals.hasNext()){
      BenchmarkGoal goal = itGoals.next();
      ret.add(goal.getID());
    }
    return ret;
  }
View Full Code Here

   * @see eu.planets_project.tb.api.model.benchmark.BenchmarkGoalsHandler#getBenchmarkGoal(java.lang.String)
   */
  public BenchmarkGoal getBenchmarkGoal(String sID){
    //returns a new BenchmarkGoal instance from a template
    BenchmarkGoalImpl ret = new BenchmarkGoalImpl();
    BenchmarkGoal template = this.hmBmGoals.get(sID);
    if(template !=null){
      ret = ((BenchmarkGoalImpl)this.hmBmGoals.get(sID)).clone();
      /*ret.setCategory(template.getCategory());
      ret.setDefinition(template.getDefinition());
      ret.setDescription(template.getDescription());
 
View Full Code Here

   */
  public void setBMGoalPropertyNameMapping(String BMGoalName, String BMGoalID, String PropertyName){
    BenchmarkGoalsHandler handler = BenchmarkGoalsHandlerImpl.getInstance();
    List<String> ids = handler.getAllBenchmarkGoalIDs();
    if(ids.contains(BMGoalID)){
      BenchmarkGoal goal = handler.getBenchmarkGoal(BMGoalID);
      if(goal.getName().equals(BMGoalName)){
        //now store the mapping
        this.mappingGoalIDToPropertyID.put(goal.getID(), PropertyName);
      }
      else{
        //ignore - TB internal BM goals are different ones.
        return;
      }
View Full Code Here

   
  }
 
  public void testGetBencharmarkGoals2(){
    Vector<String> IDs = (Vector<String>)handler.getAllBenchmarkGoalIDs();
    BenchmarkGoal goal1 = handler.getBenchmarkGoal(IDs.firstElement());
   
    //Test1:
    assertEquals(-1, goal1.getWeight());
    try {
      goal1.setWeight(BenchmarkGoal.WEIGHT_MEDIUM);
    } catch (InvalidInputException e) {
      assertEquals(true,false);
    }
    assertEquals(BenchmarkGoal.WEIGHT_MEDIUM,goal1.getWeight());
    //check if a new object was returned
    BenchmarkGoal goal2 = handler.getBenchmarkGoal(IDs.firstElement());
    assertEquals(-1,goal2.getWeight());
  }
View Full Code Here

  }
 
 
  public void testAttributes(){
   
    BenchmarkGoal nop1 = handler.getBenchmarkGoal(this.sGoalID);
    assertEquals(this.sCathegory,nop1.getCategory());
    assertEquals(this.sGoalID, nop1.getID());
    assertEquals(this.sGoalName, nop1.getName());
    assertEquals(this.sGoalType, nop1.getType());
    assertEquals(this.sGoalScale, nop1.getScale());
    assertEquals(this.sGoalVersion, nop1.getVersion());
    assertEquals(this.sGoalDefinition, nop1.getDefinition());
    assertEquals(this.sGoalDescription, nop1.getDescription());
    assertEquals(-1,nop1.getWeight());
    assertEquals("",nop1.getSourceValue());
    assertEquals("",nop1.getTargetValue());
    assertEquals("",nop1.getEvaluationValue());
  }
View Full Code Here

  }
 
 
  public void testWeight(){
    //Test1:
    BenchmarkGoal nop1 = handler.getBenchmarkGoal(this.sGoalID);
    assertEquals(-1,nop1.getWeight());
   
    //Test2:
    try {
      nop1.setWeight(BenchmarkGoal.WEIGHT_MEDIUM);
    } catch (InvalidInputException e) {
      assertEquals(true,false);
    }
    assertEquals(BenchmarkGoal.WEIGHT_MEDIUM,nop1.getWeight());
   
    try {
      nop1.setWeight(BenchmarkGoal.WEIGHT_MINIMUM);
    } catch (InvalidInputException e) {
      assertEquals(true,false);
    }
    assertEquals(BenchmarkGoal.WEIGHT_MINIMUM,nop1.getWeight());
   
    //Test3: got a new instance?
    BenchmarkGoal nop2 = handler.getBenchmarkGoal(this.sGoalID);
    assertEquals(-1,nop2.getWeight());
   
    //Test4: invalid value
    BenchmarkGoal nop3 = handler.getBenchmarkGoal(this.sGoalID);
    try {
      nop3.setWeight(15);
      assertEquals(true,false);
    } catch (InvalidInputException e) {
      assertEquals(true,true);
    }
    assertEquals(-1,nop3.getWeight());
   
  }
View Full Code Here

   
  }
 
 
  public void testSourceValue(){
    BenchmarkGoal nop1 = handler.getBenchmarkGoal(this.sGoalID);
   
    assertEquals("",nop1.getSourceValue());
   
    //Type is of java.lang.Integer
    try {
      nop1.setSourceValue("25");
    } catch (InvalidInputException e) {
      assertEquals(true,false);
    }
    assertEquals("25",nop1.getSourceValue());
   
    //Test: value was not valid and therefore did not change
    try {
      nop1.setSourceValue("true");
      assertEquals(true,false);
    } catch (InvalidInputException e) {
      assertEquals(true,true);
    }
    assertEquals("25",nop1.getSourceValue());
  }
View Full Code Here

        BenchmarkBean bmb = iter.next();
     
        if (bmb.getSelected()) {

          //We're having an existing bmGoal object to modify
          BenchmarkGoal bmg = exp.getExperimentSetup().getBenchmarkGoal(bmb.getID());
          if(bmg==null){
            //We're adding a new BMGoal from the list
            //method to get a new instance of BenchmarkGoal
            bmg = BenchmarkGoalsHandlerImpl.getInstance().getBenchmarkGoal(bmb.getID());
          }
View Full Code Here

TOP

Related Classes of eu.planets_project.tb.api.model.benchmark.BenchmarkGoal

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.