Package org.emftrace.metamodel.EMFfitModel

Examples of org.emftrace.metamodel.EMFfitModel.FactorCategory


public class RepairFactorTableFTEntriesNumberingsCommandTest extends EMFfitTestCase{

  @Test
  public void testDoRunForDoNotIncludeSubitems(){ 
    FactorCategory category1st = (FactorCategory)factorTable.getEntries().get(0);
    category1st.setNumbering("O2");
    category1st.getChildren().get(0).setNumbering("O2.1");
    ((FactorCategory) category1st.getChildren().get(0)).getChildren().get(0).setNumbering("O2.1.1");
    category1st.getChildren().get(1).setNumbering("O2.2");
    category1st.getChildren().get(2).setNumbering("O2.3");
    category1st.getChildren().get(3).setNumbering("O2.4");
   
   
    FactorCategory category2nd = (FactorCategory)factorTable.getEntries().get(1);
    category2nd.setNumbering("O5");
    category2nd.getChildren().get(0).setNumbering("O5.1");
   
   
    new RepairFactorTableFTEntriesNumberingsCommand(factorTable,false).runWithoutUnicaseCommand();
   
    assertEquals("O1", category1st.getNumbering());
    assertEquals("O1.1", category1st.getChildren().get(0).getNumbering());
    assertEquals("O1.1.1", ((FactorCategory)category1st.getChildren().get(0)).getChildren().get(0).getNumbering());
    assertEquals("O1.2", category1st.getChildren().get(1).getNumbering());
    assertEquals("O1.3", category1st.getChildren().get(2).getNumbering());
    assertEquals("O1.4", category1st.getChildren().get(3).getNumbering());
   
    assertEquals("O2", category2nd.getNumbering());
    assertEquals("O2.1", category2nd.getChildren().get(0).getNumbering());
   
   
    //don't rebuild invalid numberings if parent items has a valid numbering
    new RepairFactorTableFTEntriesNumberingsCommand(factorTable,false).runWithoutUnicaseCommand();
    ((FactorCategory) category1st.getChildren().get(0)).getChildren().get(0).setNumbering("O2.1.1");
View Full Code Here


   
  }
 
  @Test
  public void testDoRunForIncludeSubitems(){ 
    FactorCategory category1st = (FactorCategory)factorTable.getEntries().get(0);
    category1st.setNumbering("O2");
    category1st.getChildren().get(0).setNumbering("O2.1");
    ((FactorCategory) category1st.getChildren().get(0)).getChildren().get(0).setNumbering("O2.1.1");
    category1st.getChildren().get(1).setNumbering("O2.2");
    category1st.getChildren().get(2).setNumbering("O2.3");
    category1st.getChildren().get(3).setNumbering("O2.4");
   
   
    FactorCategory category2nd = (FactorCategory)factorTable.getEntries().get(1);
    category2nd.setNumbering("O5");
    category2nd.getChildren().get(0).setNumbering("O5.1");
   
   
    new RepairFactorTableFTEntriesNumberingsCommand(factorTable,false).runWithoutUnicaseCommand();
   
    assertEquals("O1", category1st.getNumbering());
    assertEquals("O1.1", category1st.getChildren().get(0).getNumbering());
    assertEquals("O1.1.1", ((FactorCategory)category1st.getChildren().get(0)).getChildren().get(0).getNumbering());
    assertEquals("O1.2", category1st.getChildren().get(1).getNumbering());
    assertEquals("O1.3", category1st.getChildren().get(2).getNumbering());
    assertEquals("O1.4", category1st.getChildren().get(3).getNumbering());
   
    assertEquals("O2", category2nd.getNumbering());
    assertEquals("O2.1", category2nd.getChildren().get(0).getNumbering());
   
   
    //rebuild invalid numberings of any FTEntry
    ((FactorCategory) category1st.getChildren().get(0)).getChildren().get(0).setNumbering("O2.1.1");
    new RepairFactorTableFTEntriesNumberingsCommand(factorTable,true).runWithoutUnicaseCommand();
View Full Code Here

    factor4.setInfluence(HypertextHelpers.strToHypertext("I'm a influence."));
    factor4.setPriority("2");
   
    Factor factor5 = EMFfitModelFactory.eINSTANCE.createFactor();
   
    FactorCategory fc1 = EMFfitModelFactory.eINSTANCE.createFactorCategory();
    fc1.setName("foo category");
    fc1.setNumbering("O1");
   
    FactorCategory fc11 = EMFfitModelFactory.eINSTANCE.createFactorCategory();
    fc11.setName("foo category");
    fc11.setNumbering("O1.1");
   
    fc11.getChildren().add(factor4);
    factor4.setNumbering("O1.1.1");
    fc1.getChildren().add(fc11);
    fc1.getChildren().add(factor1);
    fc1.getChildren().add(factor2);
    fc1.getChildren().add(factor3);
    factor1.setNumbering("O1.2");
    factor2.setNumbering("O1.3");
    factor3.setNumbering("O1.4");
   
   
    FactorCategory fc2 = EMFfitModelFactory.eINSTANCE.createFactorCategory();
    fc2.setName("foo category");
    fc2.setNumbering("O2");
    fc2.getChildren().add(factor5);
   


   
    factorTable = EMFfitModelFactory.eINSTANCE.createFactorTable();
View Full Code Here

   * tests:<br>
   * - name has been updated after command run
   */
  @Test
  public void testDoRun() {
    FactorCategory fc1st  = (FactorCategory) factorTable.getEntries().get(0);
    new SetCategoryNameCommand(fc1st,"new name for category").runWithoutUnicaseCommand();
    assertEquals("new name for category", fc1st.getName());
  }
View Full Code Here

public class DeleteFTEntryCommandTest extends EMFfitTestCase{

  @Test
  public void testDoRunForFactor(){
    FactorCategory fc1st  = (FactorCategory) factorTable.getEntries().get(0);
    Factor factor3rd = (Factor) fc1st.getChildren().get(2);
 
    new DeleteFTEntryCommand(factor3rd).runWithoutUnicaseCommand();
    assertEquals(3, fc1st.getChildren().size());
    assertEquals("O1.1", ((FactorCategory) fc1st.getChildren().get(0)).getNumbering());
    assertEquals("O1.2", ((Factor) fc1st.getChildren().get(1)).getNumbering());
    assertEquals("O1.3", ((Factor) fc1st.getChildren().get(2)).getNumbering());

  }
View Full Code Here

  }
 
  @Test
  public void testDoRunForCategory() {
    //setup
    FactorCategory fc1st  = (FactorCategory) factorTable.getEntries().get(0);
    FactorCategory fc2nd  = (FactorCategory) factorTable.getEntries().get(1);
      //run command
    new DeleteFTEntryCommand(fc1st).runWithoutUnicaseCommand();
    //check
    assertEquals(1, factorTable.getEntries().size());
    assertEquals("O1", fc2nd.getNumbering());
    assertEquals("O1.1", fc2nd.getChildren().get(0).getNumbering());
  }
View Full Code Here

public class RepairFTEntryNumberingCommandTest extends EMFfitTestCase {

  @Test
  public void testDoRunForCategoryForDoNotIncludeSubitems() {
    FactorCategory category1st = (FactorCategory)factorTable.getEntries().get(0);
    category1st.setNumbering("O2");
    category1st.getChildren().get(0).setNumbering("O2.1");
    ((FactorCategory) category1st.getChildren().get(0)).getChildren().get(0).setNumbering("O2.1.1");
    category1st.getChildren().get(1).setNumbering("O2.2");
    category1st.getChildren().get(2).setNumbering("O2.3");
    category1st.getChildren().get(3).setNumbering("O2.4");
   
    new RepairFTEntryNumberingCommand(category1st, "O1",false).runWithoutUnicaseCommand();
   
    assertEquals("O1", category1st.getNumbering());
    assertEquals("O1.1", category1st.getChildren().get(0).getNumbering());
    assertEquals("O1.1.1", ((FactorCategory)category1st.getChildren().get(0)).getChildren().get(0).getNumbering());
    assertEquals("O1.2", category1st.getChildren().get(1).getNumbering());
    assertEquals("O1.3", category1st.getChildren().get(2).getNumbering());
    assertEquals("O1.4", category1st.getChildren().get(3).getNumbering());
   
  }
View Full Code Here

  @Test
  public void testDoRun() {   
    new NewFactorTableCategoryCommand(factorTable, "new foo category").runWithoutUnicaseCommand();
    assertEquals(3, factorTable.getEntries().size());
    FactorCategory newFactorCategory =  (FactorCategory) factorTable.getEntries().get(2);
    assertEquals("new foo category", newFactorCategory.getName());
    assertEquals("O3", newFactorCategory.getNumbering());
  }
View Full Code Here

   
  }
 
  @Test
  public void testDoRunForCategoryForIncludeSubitems() {
    FactorCategory category1st = (FactorCategory)factorTable.getEntries().get(0);
    category1st.setNumbering("O1");
    category1st.getChildren().get(0).setNumbering("O1.1");
    ((FactorCategory) category1st.getChildren().get(0)).getChildren().get(0).setNumbering("O2.1.1");
    category1st.getChildren().get(1).setNumbering("O2.2");
    category1st.getChildren().get(2).setNumbering("O2.3");
    category1st.getChildren().get(3).setNumbering("O2.4");
   
    new RepairFTEntryNumberingCommand(category1st, "O1",false).runWithoutUnicaseCommand();
   
    assertEquals("O1", category1st.getNumbering());
    assertEquals("O1.1", category1st.getChildren().get(0).getNumbering());
    assertEquals("O1.1.1", ((FactorCategory)category1st.getChildren().get(0)).getChildren().get(0).getNumbering());
    assertEquals("O1.2", category1st.getChildren().get(1).getNumbering());
    assertEquals("O1.3", category1st.getChildren().get(2).getNumbering());
    assertEquals("O1.4", category1st.getChildren().get(3).getNumbering());
   
  }
View Full Code Here

  /* (non-Javadoc)
   * @see emffit_commands.EMFfitCommand#doRun()
   */
  @Override
  protected void doRun() {
    FactorCategory newCategory = EMFfitModelFactory.eINSTANCE.createFactorCategory();
    newCategory.setName(name);
   
        String number = FTHelpers.getFactorTableNumbering(factorTable);
   
    newCategory.setNumbering(number + new Integer(factorTable.getEntries().size()+1).toString());
    factorTable.getEntries().add(newCategory);
  }
View Full Code Here

TOP

Related Classes of org.emftrace.metamodel.EMFfitModel.FactorCategory

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.