Package eu.planets_project.tb.api.model

Examples of eu.planets_project.tb.api.model.BasicProperties


 
 
  public void testExperimentNameUnique(){
    TestbedManager manager = TestbedManagerImpl.getInstance();
   
    BasicProperties props = new BasicPropertiesImpl();
    ExperimentSetup expSetup = new ExperimentSetupImpl();
    Experiment exp1 = new ExperimentImpl();
   
  //Test1:
    long expID = manager.registerExperiment(exp1);
    exp1 = manager.getExperiment(expID);

    String sTestname= "TestName12334234445";
    boolean bUnique = manager.isExperimentNameUnique(sTestname);
    //check if the two methods deliver the same results
    assertEquals(bUnique, props.checkExperimentNameUnique(sTestname));
   
    try {
      props.setExperimentName(sTestname);
    } catch (InvalidInputException e) {
      assertEquals(true,false);
    }
    assertEquals(sTestname,props.getExperimentName());
    expSetup.setBasicProperties(props);
    exp1.setExperimentSetup(expSetup);
    manager.updateExperiment(exp1);
   
    assertEquals(false, props.checkExperimentNameUnique(sTestname));
    assertEquals(false, manager.isExperimentNameUnique(sTestname));
   
  //Test2:
    try {
      //although experimentname already exists, if the name stays the same no exception should be thrown
      props.setExperimentName(sTestname);
      assertEquals(true,true);
    } catch (InvalidInputException e) {
      assertEquals(true,false);
    }
   
View Full Code Here


    manager.removeExperiment(exp1.getEntityID());
  }
 

  public void testExternalReferenceID(){
    BasicProperties props = new BasicPropertiesImpl();
    props.setExternalReferenceID("LocalSystem://refID1");
    assertEquals("LocalSystem://refID1", props.getExternalReferenceID());
  }
View Full Code Here

    props.setExternalReferenceID("LocalSystem://refID1");
    assertEquals("LocalSystem://refID1", props.getExternalReferenceID());
  }
 
  public void testFocus(){
    BasicProperties props = new BasicPropertiesImpl();
    String sFocus = "Focus is on testing speed of jpeg->tiff migration tool";
    props.setFocus(sFocus);
    assertEquals(sFocus, props.getFocus());
  }
View Full Code Here

    props.setFocus(sFocus);
    assertEquals(sFocus, props.getFocus());
  }
 
  public void testScope(){
    BasicProperties props = new BasicPropertiesImpl();
    String sScope = "Not tested is the outputquality";
    props.setScope(sScope);
    assertEquals(sScope, props.getScope());
  }
View Full Code Here

    props.setScope(sScope);
    assertEquals(sScope, props.getScope());
  }
 
  public void testPurpose(){
    BasicProperties props = new BasicPropertiesImpl();
    String sPurpose ="Find the best migration tool supporting PDF/A";
    props.setScope(sPurpose);
    assertEquals(sPurpose, props.getScope());
  }
View Full Code Here

    assertEquals(sPurpose, props.getScope());
  }
 
 
  public void testIndication(){
    BasicProperties props = new BasicPropertiesImpl();
    String sIndication = "A overall description";
    props.setIndication(sIndication);
    assertEquals(sIndication, props.getIndication());
  }
View Full Code Here

    props.setIndication(sIndication);
    assertEquals(sIndication, props.getIndication());
  }
 
  public void testSummary(){
    BasicProperties props = new BasicPropertiesImpl();
    String sSummary = "Summary of the experiment";
    props.setSummary(sSummary);
    assertEquals(sSummary, props.getSummary());
  }
View Full Code Here

    props.setSummary(sSummary);
    assertEquals(sSummary, props.getSummary());
  }
 
  public void testExperimentStructureReference(){
    BasicProperties props = new BasicPropertiesImpl();
    TestbedManager tbmanager = TestbedManagerImpl.getInstance();
    //Test1:
    Experiment exp1 = tbmanager.createNewExperiment();
    try {
      props.setExperimentStructureReference(exp1.getEntityID());
    } catch (ExperimentNotFoundException e2) {
      assertEquals(true,false);
    }
   
    try {
      assertEquals(exp1.getEntityID(),props.getExperimentStructureReference().getEntityID());
    } catch (ExperimentNotFoundException e1) {
      assertEquals(true,false);
    }

    //Test2:
    props.removeExperimentStructureReference();
    try {
      assertEquals(null,props.getExperimentStructureReference());
    } catch (ExperimentNotFoundException e1) {
      assertEquals(true,false);
    }
   
    //Test3:
    try {
      props.setExperimentStructureReference(exp1);
      assertEquals(exp1.getEntityID(),props.getExperimentStructureReference().getEntityID());
    } catch (InvalidInputException e) {
      assertEquals(true,false);
    } catch (ExperimentNotFoundException e) {
      assertEquals(true,false);
    }
   
    //Test4:
    try {
      props.setExperimentStructureReference(new ExperimentImpl());
      assertEquals(true,false);
    } catch (InvalidInputException e) {
      assertEquals(true,true);
    }
  }
View Full Code Here

    }
  }
 

  public void testExperimentFormal(){
    BasicProperties props = new BasicPropertiesImpl();
    boolean bFormal = true;
    props.setExperimentFormal(bFormal);
   
    assertEquals(bFormal,props.isExperimentFormal());
    assertEquals(bFormal,!props.isExperimentInformal());
   
    bFormal = false;
    props.setExperimentFormal(bFormal);
   
    assertEquals(bFormal,props.isExperimentFormal());
    assertEquals(bFormal,!props.isExperimentInformal());
  }
View Full Code Here

    assertEquals(bFormal,!props.isExperimentInformal());
  }
 
 
  public void testLiteratureReference(){
    BasicProperties props = new BasicPropertiesImpl();

    //Test1:
    assertEquals(0,props.getAllLiteratureReferences().size());

    //Test2:
    String sTitle = "Digital Long Term Preservation";
    String sURI = "ISBN: 20-323-3233";
    props.addLiteratureReference(sTitle, sURI);
    List<String[]> refs = props.getAllLiteratureReferences();

    Iterator<String[]> itElement = refs.iterator();
    while(itElement.hasNext()){
      String[] element = itElement.next();
      assertEquals(1,refs.size());
      assertEquals(sTitle,element[0]);
      assertEquals(sURI,element[1]);
    }

    //Test3:
    String sTitle2 = "Digital Long Term Preservation2";
    String sURI2 = "ISBN: 20-323-3233";
    props.addLiteratureReference(sTitle2, sURI2);
    //Element should have been added:
    assertEquals(2,props.getAllLiteratureReferences().size());
   
    props.addLiteratureReference(sTitle2, sURI2);
    //Duplicate element should not have been added:
    assertEquals(2,props.getAllLiteratureReferences().size());

    //Test4:
    String sTitle3 = "Comic Book";
    String sURI3 = "ISBN: 111111";
    props.addLiteratureReference(sTitle3, sURI3);
    //Element should not have been added:
    assertEquals(3,props.getAllLiteratureReferences().size());
   
    props.removeLiteratureReference(sTitle,sURI);
    assertEquals(2,props.getAllLiteratureReferences().size());
   
    String sTitle4 = "Title Website1";
    String sURI4 = "http://localhost:8080";
    Vector<String[]> vAdd = new Vector<String[]>();
    vAdd.add(new String[]{sTitle4,sURI4});
    try {
      props.setLiteratureReferences(vAdd);
    } catch (InvalidInputException e) {
      assertEquals(true,false);
    }
    //Element should not have been added:
    assertEquals(1,props.getAllLiteratureReferences().size());

    String sTitle5 = "Title Website2";
    String sURI5 = "http://localhost:8080/jsf";
    vAdd.add(new String[]{sTitle5,sURI5});
    try {
      props.setLiteratureReferences(vAdd);
    } catch (InvalidInputException e) {
      assertEquals(true,false);
    }
    assertEquals(2,props.getAllLiteratureReferences().size());
  }
View Full Code Here

TOP

Related Classes of eu.planets_project.tb.api.model.BasicProperties

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.