@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())); }
@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)); }
@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)); }
@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)); }
@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)); }
@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)); }