< prev index next >

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

Print this page




   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  * @modules java.base/jdk.internal.misc
  28  *          java.base/jdk.internal.module
  29  * @build ConfigurationTest
  30  *        jdk.test.lib.util.ModuleUtils
  31  * @run testng ConfigurationTest
  32  * @summary Basic tests for java.lang.module.Configuration
  33  */
  34 
  35 import java.io.IOException;
  36 import java.io.OutputStream;
  37 import java.lang.module.Configuration;
  38 import java.lang.module.FindException;
  39 import java.lang.module.ModuleDescriptor;
  40 import java.lang.module.ModuleDescriptor.Requires;
  41 import java.lang.module.ModuleFinder;
  42 import java.lang.module.ResolutionException;
  43 import java.lang.module.ResolvedModule;
  44 import java.nio.file.Files;
  45 import java.nio.file.Path;
  46 import java.nio.file.Paths;
  47 import java.util.List;
  48 import java.util.Optional;
  49 import java.util.Set;
  50 
  51 import jdk.test.lib.util.ModuleUtils;
  52 
  53 import jdk.internal.misc.SharedSecrets;
  54 import jdk.internal.module.ModuleInfoWriter;
  55 import jdk.internal.module.ModuleTarget;
  56 import org.testng.annotations.DataProvider;
  57 import org.testng.annotations.Test;
  58 import static org.testng.Assert.*;
  59 
  60 @Test
  61 public class ConfigurationTest {
  62 
  63     /**
  64      * Creates a "non-strict" builder for building a module. This allows the
  65      * test the create ModuleDescriptor objects that do not require java.base.
  66      */
  67     private static ModuleDescriptor.Builder newBuilder(String mn) {
  68         return SharedSecrets.getJavaLangModuleAccess()
  69                 .newModuleBuilder(mn, false, Set.of());
  70     }
  71 
  72     /**
  73      * Basic test of resolver




   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  * @modules java.base/jdk.internal.access
  28  *          java.base/jdk.internal.module
  29  * @build ConfigurationTest
  30  *        jdk.test.lib.util.ModuleUtils
  31  * @run testng ConfigurationTest
  32  * @summary Basic tests for java.lang.module.Configuration
  33  */
  34 
  35 import java.io.IOException;
  36 import java.io.OutputStream;
  37 import java.lang.module.Configuration;
  38 import java.lang.module.FindException;
  39 import java.lang.module.ModuleDescriptor;
  40 import java.lang.module.ModuleDescriptor.Requires;
  41 import java.lang.module.ModuleFinder;
  42 import java.lang.module.ResolutionException;
  43 import java.lang.module.ResolvedModule;
  44 import java.nio.file.Files;
  45 import java.nio.file.Path;
  46 import java.nio.file.Paths;
  47 import java.util.List;

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


< prev index next >