< prev index next >

test/jdk/java/lang/ModuleLayer/LayerControllerTest.java

Print this page




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @library /lib/testlibrary
  27  * @build LayerControllerTest ModuleUtils

  28  * @run testng LayerControllerTest
  29  * @summary Basic tests for java.lang.ModuleLayer.Controller
  30  */
  31 
  32 import java.lang.module.Configuration;
  33 import java.lang.module.ModuleDescriptor;
  34 import java.lang.module.ModuleFinder;
  35 import java.util.List;
  36 import java.util.Set;
  37 


  38 import org.testng.annotations.Test;
  39 import static org.testng.Assert.*;
  40 
  41 @Test
  42 public class LayerControllerTest {
  43 
  44     /**
  45      * Creates a Controller for a module layer containing modules m1 and m2.
  46      * Module m1 contains p1, reads java.base, does not export/open any package
  47      * Module m2 contains p2, reads java.base, does not export/open any package
  48      */
  49     private ModuleLayer.Controller createTestLayer() {
  50         ModuleDescriptor descriptor1
  51             = ModuleDescriptor.newModule("m1")
  52                 .packages(Set.of("p1"))
  53                 .requires("java.base")
  54                 .build();
  55 
  56         ModuleDescriptor descriptor2
  57             = ModuleDescriptor.newModule("m2")




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @library /test/lib
  27  * @build LayerControllerTest
  28  *        jdk.test.lib.util.ModuleUtils
  29  * @run testng LayerControllerTest
  30  * @summary Basic tests for java.lang.ModuleLayer.Controller
  31  */
  32 
  33 import java.lang.module.Configuration;
  34 import java.lang.module.ModuleDescriptor;
  35 import java.lang.module.ModuleFinder;
  36 import java.util.List;
  37 import java.util.Set;
  38 
  39 import jdk.test.lib.util.ModuleUtils;
  40 
  41 import org.testng.annotations.Test;
  42 import static org.testng.Assert.*;
  43 
  44 @Test
  45 public class LayerControllerTest {
  46 
  47     /**
  48      * Creates a Controller for a module layer containing modules m1 and m2.
  49      * Module m1 contains p1, reads java.base, does not export/open any package
  50      * Module m2 contains p2, reads java.base, does not export/open any package
  51      */
  52     private ModuleLayer.Controller createTestLayer() {
  53         ModuleDescriptor descriptor1
  54             = ModuleDescriptor.newModule("m1")
  55                 .packages(Set.of("p1"))
  56                 .requires("java.base")
  57                 .build();
  58 
  59         ModuleDescriptor descriptor2
  60             = ModuleDescriptor.newModule("m2")


< prev index next >