コード例 #1
0
ファイル: GeneratorTest.java プロジェクト: JangidUK/IRIS
 @Test
 public void testGenerateFromIncompleteRIM() throws Exception {
   DomainModel model = parseHelper.parse(INCOMPLETE_RIM);
   InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
   boolean exceptionThrown = false;
   try {
     underTest.doGenerate(model.eResource(), fsa);
   } catch (RuntimeException e) {
     exceptionThrown = true;
   }
   assertFalse(exceptionThrown);
 }
コード例 #2
0
ファイル: GeneratorTest.java プロジェクト: JangidUK/IRIS
  @Test
  public void testGenerateSingleStateViewCommandOnly() throws Exception {
    DomainModel domainModel = parseHelper.parse(SINGLE_STATE_VIEW_COMMAND_ONLY_RIM);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(domainModel.eResource(), fsa);

    String expectedKey = IFileSystemAccess.DEFAULT_OUTPUT + "Test/AResourceState.java";
    assertTrue(fsa.getFiles().containsKey(expectedKey));
    assertTrue(
        fsa.getFiles()
            .get(expectedKey)
            .toString()
            .contains("new Action(\"GetEntity\", Action.TYPE.VIEW, new Properties())"));
  }
コード例 #3
0
ファイル: GeneratorTest.java プロジェクト: JangidUK/IRIS
  @Test
  public void testGenerateOnErrorResourceSeparateRIM() throws Exception {
    DomainModel domainModel = parseHelper.parse(RESOURCE_ON_ERROR_SEPARATE_RIM);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(domainModel.eResource(), fsa);

    // collection
    String expectedKey = IFileSystemAccess.DEFAULT_OUTPUT + "ErrorTest/Test/AResourceState.java";
    assertTrue(fsa.getFiles().containsKey(expectedKey));
    String output = fsa.getFiles().get(expectedKey).toString();
    assertTrue(
        output.contains(
            "super(\"ENTITY\", \"A\", createActions(), \"/A\", createLinkRelations(), null, factory.getResourceState(\"ErrorTest.Error.AE\"));"));
  }
コード例 #4
0
ファイル: GeneratorTest.java プロジェクト: JangidUK/IRIS
  /*
   * doGenerate should producer one file per resource
   */
  @Test
  public void testGenerateFileInPackage() throws Exception {
    DomainModel domainModel = parseHelper.parse(SINGLE_STATE_WITH_PACKAGE_RIM);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(domainModel.eResource(), fsa);
    System.out.println(fsa.getFiles());
    assertEquals(2, fsa.getFiles().size());

    String expectedKey = IFileSystemAccess.DEFAULT_OUTPUT + "blah/TestBehaviour.java";
    assertTrue(fsa.getFiles().containsKey(expectedKey));
    String output = fsa.getFiles().get(expectedKey).toString();
    assertTrue(output.contains("package blah;"));
    assertTrue(output.contains("public class TestBehaviour {"));
    assertTrue(output.contains("getRIM"));
    assertTrue(output.contains("factory.getResourceState(\"blah.Test.A\");"));

    String expectedRSKey = IFileSystemAccess.DEFAULT_OUTPUT + "blah/Test/AResourceState.java";
    assertTrue(fsa.getFiles().containsKey(expectedRSKey));
    String outputRS = fsa.getFiles().get(expectedRSKey).toString();
    assertTrue(outputRS.contains("package blah.Test;"));
  }