< prev index next >

test/jdk/java/lang/module/ConfigurationTest.java

Print this page
rev 51958 : 8211122: Reduce the number of internal classes made accessible to jdk.unsupported
Reviewed-by: alanb, dfuchs, kvn
rev 51959 : resolve JDK-8211122
   1 /*
   2  * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   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  * @modules java.base/jdk.internal.misc
  28  *          java.base/jdk.internal.module
  29  * @build ConfigurationTest ModuleUtils
  30  * @run testng ConfigurationTest
  31  * @summary Basic tests for java.lang.module.Configuration
  32  */
  33 
  34 import java.io.IOException;
  35 import java.io.OutputStream;
  36 import java.lang.module.Configuration;
  37 import java.lang.module.FindException;
  38 import java.lang.module.ModuleDescriptor;
  39 import java.lang.module.ModuleDescriptor.Requires;
  40 import java.lang.module.ModuleFinder;
  41 import java.lang.module.ResolutionException;
  42 import java.lang.module.ResolvedModule;
  43 import java.nio.file.Files;
  44 import java.nio.file.Path;
  45 import java.nio.file.Paths;
  46 import java.util.List;
  47 import java.util.Optional;
  48 import java.util.Set;
  49 
  50 import jdk.internal.misc.SharedSecrets;
  51 import jdk.internal.module.ModuleInfoWriter;
  52 import jdk.internal.module.ModuleTarget;
  53 import org.testng.annotations.DataProvider;
  54 import org.testng.annotations.Test;
  55 import static org.testng.Assert.*;
  56 
  57 @Test
  58 public class ConfigurationTest {
  59 
  60     /**
  61      * Creates a "non-strict" builder for building a module. This allows the
  62      * test the create ModuleDescriptor objects that do not require java.base.
  63      */
  64     private static ModuleDescriptor.Builder newBuilder(String mn) {
  65         return SharedSecrets.getJavaLangModuleAccess()
  66                 .newModuleBuilder(mn, false, Set.of());
  67     }
  68 
  69     /**
  70      * Basic test of resolver


   1 /*
   2  * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   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  * @modules java.base/jdk.internal.access
  28  *          java.base/jdk.internal.module
  29  * @build ConfigurationTest ModuleUtils
  30  * @run testng ConfigurationTest
  31  * @summary Basic tests for java.lang.module.Configuration
  32  */
  33 
  34 import java.io.IOException;
  35 import java.io.OutputStream;
  36 import java.lang.module.Configuration;
  37 import java.lang.module.FindException;
  38 import java.lang.module.ModuleDescriptor;
  39 import java.lang.module.ModuleDescriptor.Requires;
  40 import java.lang.module.ModuleFinder;
  41 import java.lang.module.ResolutionException;
  42 import java.lang.module.ResolvedModule;
  43 import java.nio.file.Files;
  44 import java.nio.file.Path;
  45 import java.nio.file.Paths;
  46 import java.util.List;

  47 import java.util.Set;
  48 
  49 import jdk.internal.access.SharedSecrets;
  50 import jdk.internal.module.ModuleInfoWriter;
  51 import jdk.internal.module.ModuleTarget;
  52 import org.testng.annotations.DataProvider;
  53 import org.testng.annotations.Test;
  54 import static org.testng.Assert.*;
  55 
  56 @Test
  57 public class ConfigurationTest {
  58 
  59     /**
  60      * Creates a "non-strict" builder for building a module. This allows the
  61      * test the create ModuleDescriptor objects that do not require java.base.
  62      */
  63     private static ModuleDescriptor.Builder newBuilder(String mn) {
  64         return SharedSecrets.getJavaLangModuleAccess()
  65                 .newModuleBuilder(mn, false, Set.of());
  66     }
  67 
  68     /**
  69      * Basic test of resolver


< prev index next >