Пример #1
0
  @Test
  public void testCopyProject()
      throws IOException, NoProjectLoadedException, ProjectFileParsingException, Exception {
    System.out.println("---  testCopyAndRunProject");

    String projNameNew = "TestingGranCell";
    File projDirNew = new File(MainTest.getTempProjectDirectory(), projNameNew);

    if (projDirNew.exists()) {
      GeneralUtils.removeAllFiles(projDirNew, false, true, true);
    }

    System.out.println("Ex " + projDirNew.getCanonicalFile() + ": " + projDirNew.exists());
    projDirNew.mkdir();

    File projFile = new File(projDirNew, projNameNew + ".ncx");

    File oldProjDir = new File(ProjectStructure.getnCModelsDir(), "GranuleCell");
    File oldProj = new File(oldProjDir, "GranuleCell.ncx");

    ProjectManager p = new ProjectManager();

    Project proj = p.copyProject(oldProj, projFile);

    System.out.println("Created project at: " + proj.getProjectFile().getCanonicalPath());

    assertEquals(proj.getProjectName(), projNameNew);

    assertTrue(projFile.exists());
  }
Пример #2
0
  /** Test of getProjectFileName method, of class Project. */
  @Test
  public void testGetProjectFileName() {
    System.out.println("---  getProjectFileName");

    String expResult = ProjectStructure.findProjectFile(projDir).getName();
    String result = projLoaded.getProjectFileName();
    assertEquals(expResult, result);
  }
Пример #3
0
  @Before
  public void setUp() {

    System.out.println("---------------   setUp() ProjectTest");
    projFile = ProjectStructure.findProjectFile(projDir);

    try {
      projLoaded = Project.loadProject(projFile, null);

      System.out.println("Proj status: " + projLoaded.getProjectStatusAsString());

    } catch (ProjectFileParsingException ex) {
      fail("Error loading: " + projFile.getAbsolutePath());
    }
  }
Пример #4
0
/** @author padraig */
public class ProjectTest {
  static {
    // System.out.println("ProjectTest static: "+ProjectStructure.getCMLExamplesDir());

  }

  String projName = "Ex5_Networks";
  File projDir = new File(ProjectStructure.getnCExamplesDir() + "/" + projName);
  File projFile = null;

  Project projLoaded = null;

  public ProjectTest() {}

  @Before
  public void setUp() {

    System.out.println("---------------   setUp() ProjectTest");
    projFile = ProjectStructure.findProjectFile(projDir);

    try {
      projLoaded = Project.loadProject(projFile, null);

      System.out.println("Proj status: " + projLoaded.getProjectStatusAsString());

    } catch (ProjectFileParsingException ex) {
      fail("Error loading: " + projFile.getAbsolutePath());
    }
  }

  @After
  public void tearDown() {}

  /** Test of createNewProject method, of class Project. */
  @Test
  public void testCreateNewProject() throws IOException, NoProjectLoadedException {
    System.out.println("---  testCreateNewProject");

    String projName2 = "TestingFrameworkProject";
    File projDir2 = new File(MainTest.getTempProjectDirectory(), projName2);

    Project proj = Project.createNewProject(projDir2.getAbsolutePath(), projName2, null);

    System.out.println("Created project at: " + proj.getProjectFile().getCanonicalPath());

    proj.saveProject();

    File projFileNew = proj.getProjectFile();

    assertEquals(proj.getProjectName(), projName2);

    assertTrue(projFileNew.exists());
  }

  @Test
  public void testCopyProject()
      throws IOException, NoProjectLoadedException, ProjectFileParsingException, Exception {
    System.out.println("---  testCopyAndRunProject");

    String projNameNew = "TestingGranCell";
    File projDirNew = new File(MainTest.getTempProjectDirectory(), projNameNew);

    if (projDirNew.exists()) {
      GeneralUtils.removeAllFiles(projDirNew, false, true, true);
    }

    System.out.println("Ex " + projDirNew.getCanonicalFile() + ": " + projDirNew.exists());
    projDirNew.mkdir();

    File projFile = new File(projDirNew, projNameNew + ".ncx");

    File oldProjDir = new File(ProjectStructure.getnCModelsDir(), "GranuleCell");
    File oldProj = new File(oldProjDir, "GranuleCell.ncx");

    ProjectManager p = new ProjectManager();

    Project proj = p.copyProject(oldProj, projFile);

    System.out.println("Created project at: " + proj.getProjectFile().getCanonicalPath());

    assertEquals(proj.getProjectName(), projNameNew);

    assertTrue(projFile.exists());
  }

  /** Test of getProjectFileName method, of class Project. */
  @Test
  public void testGetProjectFileName() {
    System.out.println("---  getProjectFileName");

    String expResult = ProjectStructure.findProjectFile(projDir).getName();
    String result = projLoaded.getProjectFileName();
    assertEquals(expResult, result);
  }

  public static void main(String[] args) {
    ProjectTest ct = new ProjectTest();
    Result r = org.junit.runner.JUnitCore.runClasses(ct.getClass());
    MainTest.checkResults(r);
  }
}