Example #1
0
 @Test(expected = ContentFileProcessingException.class)
 public void anExceptionIsThrownIfAGroupIsDefinedTwice() throws ContentProcessingException {
   Set<String> validClasses =
       SourceFileLocator.createValidClasses(
           SourceFileLocator.getAllSourceFiles(workbenchPathWithGroupsDefinedTwice, null));
   new AliasRegistry(workbenchPathWithGroupsDefinedTwice, appBaseFile, validClasses);
 }
Example #2
0
 @Test(expected = ContentFileProcessingException.class)
 public void anExceptionIsThrownWhenTryingToUseANotDefinedGroup()
     throws ContentProcessingException {
   Set<String> validClasses =
       SourceFileLocator.createValidClasses(
           SourceFileLocator.getAllSourceFiles(workbenchPathhWithANonExistingGroup, null));
   new AliasRegistry(workbenchPathhWithANonExistingGroup, appBaseFile, validClasses);
 }
Example #3
0
  @Test
  @Ignore
  public void verifyAliasesWithinAGroupGetAdded() throws ContentProcessingException {
    Set<String> validClasses =
        SourceFileLocator.createValidClasses(
            SourceFileLocator.getAllSourceFiles(workbenchPathUsingGroups, null));
    AliasRegistry aliasRegistry =
        new AliasRegistry(workbenchPathUsingGroups, appBaseFile, validClasses);

    assertEquals(
        aliasGroupsJson, aliasRegistry.getJson(classDictionary, aliasRegistry.getAliases()));
  }
Example #4
0
  @Test
  @Ignore
  public void verifyAliasWithNoClassReturnsNull() throws ContentProcessingException {
    activeAliases.addAlias("alias #1", new AliasDefinition(null, null, null));

    File testDir = new File(testBase, "single-alias-file/default-aspect");
    Set<String> validClasses =
        SourceFileLocator.createValidClasses(SourceFileLocator.getAllSourceFiles(testDir, null));
    AliasRegistry aliasRegistry = new AliasRegistry(testDir, null, validClasses);

    assertEquals(nullClassJson, aliasRegistry.getJson(classDictionary, activeAliases));
  }
Example #5
0
  @Test
  @Ignore
  public void verifySingleAliasFile() throws ContentProcessingException {
    activeAliases.addAlias("alias #1", alias1);
    activeAliases.addAlias("alias #2", alias2);

    File testDir = new File(testBase, "single-alias-file/default-aspect");
    Set<String> validClasses =
        SourceFileLocator.createValidClasses(SourceFileLocator.getAllSourceFiles(testDir, null));
    AliasRegistry aliasRegistry = new AliasRegistry(testDir, null, validClasses);

    assertEquals(defaultScenarioJson, aliasRegistry.getJson(classDictionary, activeAliases));
  }
Example #6
0
  @Test
  @Ignore
  public void verifyAliasFileCanSwitchScenario() throws ContentProcessingException {
    activeAliases.addAlias("novox.example.blade1.alias #1", group1blade1alias1test);
    activeAliases.addAlias("novox.example.blade1.alias #2", group1blade1alias2test);

    File testDir = new File(testBase, "alias-file-switching-scenario/default-aspect");
    Set<String> validClasses =
        SourceFileLocator.createValidClasses(SourceFileLocator.getAllSourceFiles(testDir, null));
    AliasRegistry aliasRegistry = new AliasRegistry(testDir, null, validClasses);

    assertEquals(testScenarioJson, aliasRegistry.getJson(classDictionary, activeAliases));
  }
Example #7
0
  @Test
  @Ignore
  public void verifyAliasFileCanOverrideAnAliasDefinitionsFile() throws ContentProcessingException {
    activeAliases.addAlias("novox.example.blade1.alias #1", group1blade1alias1);
    activeAliases.addAlias("novox.example.blade1.alias #2", group1blade1alias2);

    File testDir =
        new File(testBase, "alias-file-overriding-an-alias-definitions-file/default-aspect");
    Set<String> validClasses =
        SourceFileLocator.createValidClasses(SourceFileLocator.getAllSourceFiles(testDir, null));
    AliasRegistry aliasRegistry = new AliasRegistry(testDir, null, validClasses);

    assertEquals(overriddenJson, aliasRegistry.getJson(classDictionary, activeAliases));
  }
Example #8
0
 @Test
 @Ignore
 public void anExceptionIsThrownIfAnAliasClashesWithTheSameAliasInAnotherGroup()
     throws ContentProcessingException {
   try {
     Set<String> validClasses =
         SourceFileLocator.createValidClasses(
             SourceFileLocator.getAllSourceFiles(workbenchPathChashingAliases, null));
     new AliasRegistry(workbenchPathChashingAliases, appBaseFile, validClasses);
     fail("exception expected");
   } catch (Exception e) {
     assertEquals(
         e.getMessage(),
         "Alias novox.example.myAlias has been defined in at least 2 groups: novox.myGroup1 and novox.myGroup");
   }
 }
Example #9
0
  @Test
  @Ignore
  public void verifyAnAliasGetsAddedToGivenScenario() throws Exception {
    File testDir = new File(testBase, "single-alias-file/default-aspect");
    Set<String> validClasses =
        SourceFileLocator.createValidClasses(SourceFileLocator.getAllSourceFiles(testDir, null));
    AliasRegistry aliasRegistry = new AliasRegistry(testDir, null, validClasses);

    Aliases aliases = mock(Aliases.class);
    ScenarioAliases scenarioAliases = mock(ScenarioAliases.class);
    when(aliases.hasScenario("aScenario")).thenReturn(false);
    when(aliases.getScenarioAliases("aScenario")).thenReturn(scenarioAliases);

    aliasRegistry.aliasScenarios = aliases;

    AliasDefinition alias = new AliasDefinition("myAlias", "novox.g1.AliasClass1", "myInterface");

    aliasRegistry.addClassAlias(alias, "aScenario");

    verify(scenarioAliases).addAlias(eq("myAlias"), eq(alias));
  }