Example usage for java.lang Module name

List of usage examples for java.lang Module name

Introduction

In this page you can find the example usage for java.lang Module name.

Prototype

String name

To view the source code for java.lang Module name.

Click Source Link

Usage

From source file:org.wildfly.swarm.spi.api.JBossDeploymentStructureAssetTest.java

@Test
public void testImportPaths() throws Exception {
    JBossDeploymentStructureAsset asset = new JBossDeploymentStructureAsset();

    assertThat(asset.deploymentModules()).isNullOrEmpty();
    assertThat(asset.deploymentExclusions()).isNullOrEmpty();

    Module module = asset.addModule("com.mycorp");
    module.withExport(true);/*w  ww .java 2  s .co  m*/
    module.withServices(Module.ServiceHandling.IMPORT);
    module.withImportIncludePath("**");
    module.withImportExcludePath("some/path");
    module.withImportExcludePath("another/path");

    JBossDeploymentStructureAsset asset2 = new JBossDeploymentStructureAsset(asset.openStream());

    List<Module> modules = asset2.deploymentModules();
    assertThat(modules.size()).isEqualTo(1);
    assertThat(modules.get(0)).isNotNull();

    module = modules.get(0);
    assertThat(module.name()).isEqualTo("com.mycorp");
    assertThat(module.slot()).isEqualTo("main");
    assertThat(module.export()).isTrue();
    assertThat(module.services()).isEqualTo(Module.ServiceHandling.IMPORT);
    assertThat(module.importIncludePaths().size()).isEqualTo(1);
    assertThat(module.importIncludePaths().get(0)).isEqualTo("**");
    assertThat(module.importExcludePaths().size()).isEqualTo(2);
    assertThat(module.importExcludePaths().get(0)).isEqualTo("some/path");
    assertThat(module.importExcludePaths().get(1)).isEqualTo("another/path");
}

From source file:org.wildfly.swarm.spi.api.JBossDeploymentStructureAssetTest.java

@Test
public void testExportAndServices() throws Exception {
    JBossDeploymentStructureAsset asset = new JBossDeploymentStructureAsset();
    Module module = asset.addModule("com.mycorp");
    module.withExport(true);/*from w  w w  .  ja  va2 s . com*/
    module.withServices(Module.ServiceHandling.IMPORT);

    module = asset.addModule("com.mycorp.special", "sloty");
    module.withExport(false);

    JBossDeploymentStructureAsset asset2 = new JBossDeploymentStructureAsset(asset.openStream());

    List<Module> modules = asset2.deploymentModules();
    assertThat(modules.size()).isEqualTo(2);
    assertThat(modules.get(0)).isNotNull();
    assertThat(modules.get(1)).isNotNull();

    module = modules.get(0);
    assertThat(module.name()).isEqualTo("com.mycorp");
    assertThat(module.slot()).isEqualTo("main");
    assertThat(module.export()).isTrue();
    assertThat(module.services()).isEqualTo(Module.ServiceHandling.IMPORT);

    module = modules.get(1);
    assertThat(module.name()).isEqualTo("com.mycorp.special");
    assertThat(module.slot()).isEqualTo("sloty");
    assertThat(module.export()).isFalse();
    assertThat(module.metaInf()).isNull();

    module = asset2.addModule("com.somecorp");
    module.withExport(false);

    modules = asset2.deploymentModules();
    assertThat(modules.size()).isEqualTo(3);
    assertThat(modules.get(0)).isNotNull();
    assertThat(modules.get(1)).isNotNull();
    assertThat(modules.get(2)).isNotNull();

    module = modules.get(2);
    assertThat(module.name()).isEqualTo("com.somecorp");
    assertThat(module.slot()).isEqualTo("main");
    assertThat(module.export()).isFalse();
}

From source file:org.wildfly.swarm.spi.api.JBossDeploymentStructureAssetTest.java

@Test
public void testExportAndMetaInf() throws Exception {
    JBossDeploymentStructureAsset asset = new JBossDeploymentStructureAsset();
    Module module = asset.addModule("com.mycorp");
    module.withExport(true);//from w  w  w .  j a  va2s. c o  m
    module.withServices(Module.ServiceHandling.IMPORT);

    module = asset.addModule("com.mycorp.special", "sloty");
    module.withExport(false);
    module.withMetaInf("import");

    JBossDeploymentStructureAsset asset2 = new JBossDeploymentStructureAsset(asset.openStream());

    List<Module> modules = asset2.deploymentModules();
    assertThat(modules.size()).isEqualTo(2);
    assertThat(modules.get(0)).isNotNull();
    assertThat(modules.get(1)).isNotNull();

    module = modules.get(0);
    assertThat(module.name()).isEqualTo("com.mycorp");
    assertThat(module.slot()).isEqualTo("main");
    assertThat(module.export()).isTrue();
    assertThat(module.services()).isEqualTo(Module.ServiceHandling.IMPORT);

    module = modules.get(1);
    assertThat(module.name()).isEqualTo("com.mycorp.special");
    assertThat(module.slot()).isEqualTo("sloty");
    assertThat(module.export()).isFalse();
    assertThat(module.metaInf()).isEqualTo("import");
}

From source file:org.wildfly.swarm.spi.api.JBossDeploymentStructureAssetTest.java

@Test
public void testExportImportPaths() throws Exception {
    JBossDeploymentStructureAsset asset = new JBossDeploymentStructureAsset();

    assertThat(asset.deploymentModules()).isNullOrEmpty();
    assertThat(asset.deploymentExclusions()).isNullOrEmpty();

    Module module = asset.addModule("com.mycorp");
    module.withExport(true);/*w w w  .  ja  v  a2  s. c  o m*/
    module.withServices(Module.ServiceHandling.IMPORT);
    module.withImportIncludePath("**");
    module.withImportExcludePath("some/path");
    module.withImportExcludePath("another/path");

    module = asset.addModule("com.mycorp", "slot");
    module.withExport(true);
    module.withServices(Module.ServiceHandling.EXPORT);
    module.withExportIncludePath("a/path");
    module.withExportIncludePath("some/path");
    module.withExportExcludePath("**");

    JBossDeploymentStructureAsset asset2 = new JBossDeploymentStructureAsset(asset.openStream());

    module = asset2.addModule("com.mycorp.more");
    module.withExportIncludePath("a/path");
    module.withExportIncludePath("some/path");
    module.withExportExcludePath("**");

    List<Module> modules = asset2.deploymentModules();
    assertThat(modules.size()).isEqualTo(3);
    assertThat(modules.get(0)).isNotNull();
    assertThat(modules.get(1)).isNotNull();
    assertThat(modules.get(2)).isNotNull();

    module = modules.get(0);
    assertThat(module.name()).isEqualTo("com.mycorp");
    assertThat(module.slot()).isEqualTo("main");
    assertThat(module.export()).isTrue();
    assertThat(module.services()).isEqualTo(Module.ServiceHandling.IMPORT);
    assertThat(module.importIncludePaths().size()).isEqualTo(1);
    assertThat(module.importIncludePaths().get(0)).isEqualTo("**");
    assertThat(module.importExcludePaths().size()).isEqualTo(2);
    assertThat(module.importExcludePaths().get(0)).isEqualTo("some/path");
    assertThat(module.importExcludePaths().get(1)).isEqualTo("another/path");

    module = modules.get(1);
    assertThat(module.name()).isEqualTo("com.mycorp");
    assertThat(module.slot()).isEqualTo("slot");
    assertThat(module.export()).isTrue();
    assertThat(module.services()).isEqualTo(Module.ServiceHandling.EXPORT);
    assertThat(module.exportIncludePaths().size()).isEqualTo(2);
    assertThat(module.exportIncludePaths().get(0)).isEqualTo("a/path");
    assertThat(module.exportIncludePaths().get(1)).isEqualTo("some/path");
    assertThat(module.exportExcludePaths().size()).isEqualTo(1);
    assertThat(module.exportExcludePaths().get(0)).isEqualTo("**");

    module = modules.get(2);
    assertThat(module.name()).isEqualTo("com.mycorp.more");
    assertThat(module.slot()).isEqualTo("main");
    assertThat(module.export()).isNull();
    assertThat(module.services()).isNull();
    assertThat(module.exportIncludePaths().size()).isEqualTo(2);
    assertThat(module.exportIncludePaths().get(0)).isEqualTo("a/path");
    assertThat(module.exportIncludePaths().get(1)).isEqualTo("some/path");
    assertThat(module.exportExcludePaths().size()).isEqualTo(1);
    assertThat(module.exportExcludePaths().get(0)).isEqualTo("**");
}