Search in sources :

Example 1 with VoidProjectStructureExtensionProvider

use of org.finos.legend.sdlc.server.project.extension.VoidProjectStructureExtensionProvider in project legend-sdlc by finos.

the class TestProjectStructureConfiguration method testExtensionProvider.

@Test
public void testExtensionProvider() throws IOException {
    assertConfig("{\"extensionProvider\":null}", Collections.emptySet(), null, Collections.emptyList(), null);
    assertConfig("{\"extensionProvider\":{\"org.finos.legend.sdlc.server.project.extension.VoidProjectStructureExtensionProvider\":{}}}", Collections.emptySet(), new VoidProjectStructureExtensionProvider(), Collections.emptyList(), null);
    assertConfig("{\"extensionProvider\":{\"org.finos.legend.sdlc.server.project.extension.DefaultProjectStructureExtensionProvider\":{}}}", Collections.emptySet(), DefaultProjectStructureExtensionProvider.fromExtensions(), Collections.emptyList(), null);
    assertConfig("{\"extensionProvider\":{\"org.finos.legend.sdlc.server.project.extension.DefaultProjectStructureExtensionProvider\":{\"extensions\":[{\"org.finos.legend.sdlc.server.project.extension.DefaultProjectStructureExtension\":{\"projectStructureVersion\": 0, \"extensionVersion\": 1, \"files\":{\"PANGRAM.TXT\":{\"content\":\"THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG\"}}}}, {\"org.finos.legend.sdlc.server.project.extension.DefaultProjectStructureExtension\":{\"projectStructureVersion\": 0, \"extensionVersion\": 2, \"files\":{\"pangram.txt\":{\"content\":\"the quick brown fox jumped over the lazy dog\"}}}}]}}}", Collections.emptySet(), DefaultProjectStructureExtensionProvider.fromExtensions(DefaultProjectStructureExtension.newProjectStructureExtension(0, 1, Collections.singletonMap("/PANGRAM.TXT", "THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG")), DefaultProjectStructureExtension.newProjectStructureExtension(0, 2, Collections.singletonMap("/pangram.txt", "the quick brown fox jumped over the lazy dog"))), Collections.emptyList(), null);
}
Also used : VoidProjectStructureExtensionProvider(org.finos.legend.sdlc.server.project.extension.VoidProjectStructureExtensionProvider) Test(org.junit.Test)

Example 2 with VoidProjectStructureExtensionProvider

use of org.finos.legend.sdlc.server.project.extension.VoidProjectStructureExtensionProvider in project legend-sdlc by finos.

the class TestProjectStructureConfiguration method testExtensionProviderAndExtensions.

@Test
public void testExtensionProviderAndExtensions() throws IOException {
    assertConfig("{\"extensionProvider\":{\"org.finos.legend.sdlc.server.project.extension.VoidProjectStructureExtensionProvider\":{}}, \"extensions\":null}", Collections.emptySet(), new VoidProjectStructureExtensionProvider(), Collections.emptyList(), null);
    assertConfig("{\"extensionProvider\":{\"org.finos.legend.sdlc.server.project.extension.VoidProjectStructureExtensionProvider\":{}}, \"extensions\":[]}", Collections.emptySet(), new VoidProjectStructureExtensionProvider(), Collections.emptyList(), null);
    assertDoesNotParse("{\"extensionProvider\":{\"org.finos.legend.sdlc.server.project.extension.VoidProjectStructureExtensionProvider\":{}}, \"extensions\":[{\"org.finos.legend.sdlc.server.project.extension.DefaultProjectStructureExtension\":{\"projectStructureVersion\": 0, \"extensionVersion\": 1, \"files\":{\"PANGRAM.TXT\":{\"content\":\"THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG\"}}}}, {\"org.finos.legend.sdlc.server.project.extension.DefaultProjectStructureExtension\":{\"projectStructureVersion\": 0, \"extensionVersion\": 2, \"files\":{\"pangram.txt\":{\"content\":\"the quick brown fox jumped over the lazy dog\"}}}}]}", "May not specify both extensionProvider and extensions");
}
Also used : VoidProjectStructureExtensionProvider(org.finos.legend.sdlc.server.project.extension.VoidProjectStructureExtensionProvider) Test(org.junit.Test)

Example 3 with VoidProjectStructureExtensionProvider

use of org.finos.legend.sdlc.server.project.extension.VoidProjectStructureExtensionProvider in project legend-sdlc by finos.

the class AbstractBaseModule method resolveProjectStructureExtensionProvider.

private ProjectStructureExtensionProvider resolveProjectStructureExtensionProvider() {
    ProjectStructureConfiguration projectStructureConfiguration = getConfiguration().getProjectStructureConfiguration();
    if (projectStructureConfiguration != null) {
        ProjectStructureExtensionProvider configuredProvider = projectStructureConfiguration.getProjectStructureExtensionProvider();
        if (configuredProvider != null) {
            return configuredProvider;
        }
        List<ProjectStructureExtension> extensions = projectStructureConfiguration.getProjectStructureExtensions();
        if ((extensions != null) && !extensions.isEmpty()) {
            return DefaultProjectStructureExtensionProvider.fromExtensions(extensions);
        }
    }
    return new VoidProjectStructureExtensionProvider();
}
Also used : DefaultProjectStructureExtensionProvider(org.finos.legend.sdlc.server.project.extension.DefaultProjectStructureExtensionProvider) ProjectStructureExtensionProvider(org.finos.legend.sdlc.server.project.extension.ProjectStructureExtensionProvider) VoidProjectStructureExtensionProvider(org.finos.legend.sdlc.server.project.extension.VoidProjectStructureExtensionProvider) VoidProjectStructureExtensionProvider(org.finos.legend.sdlc.server.project.extension.VoidProjectStructureExtensionProvider) ProjectStructureExtension(org.finos.legend.sdlc.server.project.extension.ProjectStructureExtension) ProjectStructureConfiguration(org.finos.legend.sdlc.server.project.config.ProjectStructureConfiguration)

Aggregations

VoidProjectStructureExtensionProvider (org.finos.legend.sdlc.server.project.extension.VoidProjectStructureExtensionProvider)3 Test (org.junit.Test)2 ProjectStructureConfiguration (org.finos.legend.sdlc.server.project.config.ProjectStructureConfiguration)1 DefaultProjectStructureExtensionProvider (org.finos.legend.sdlc.server.project.extension.DefaultProjectStructureExtensionProvider)1 ProjectStructureExtension (org.finos.legend.sdlc.server.project.extension.ProjectStructureExtension)1 ProjectStructureExtensionProvider (org.finos.legend.sdlc.server.project.extension.ProjectStructureExtensionProvider)1