< prev index next >

test/jdk/java/lang/module/AutomaticModulesTest.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 /test/lib
  27  * @build AutomaticModulesTest ModuleUtils
  28  *        jdk.test.lib.util.JarUtils

  29  * @run testng AutomaticModulesTest
  30  * @summary Basic tests for automatic modules
  31  */
  32 
  33 import java.io.IOException;
  34 import java.lang.module.Configuration;
  35 import java.lang.module.FindException;
  36 import java.lang.module.ModuleDescriptor;
  37 import java.lang.module.ModuleDescriptor.Requires.Modifier;
  38 import java.lang.module.ModuleFinder;
  39 import java.lang.module.ModuleReference;
  40 import java.lang.module.ResolutionException;
  41 import java.lang.module.ResolvedModule;
  42 import java.nio.file.Files;
  43 import java.nio.file.Path;
  44 import java.nio.file.Paths;
  45 import java.util.Optional;
  46 import java.util.Set;
  47 import java.util.jar.Attributes;
  48 import java.util.jar.Manifest;
  49 import java.util.stream.Collectors;
  50 import java.util.stream.Stream;
  51 
  52 import jdk.test.lib.util.JarUtils;

  53 
  54 import org.testng.annotations.DataProvider;
  55 import org.testng.annotations.Test;
  56 import static org.testng.Assert.*;
  57 
  58 @Test
  59 public class AutomaticModulesTest {
  60 
  61     private static final Path USER_DIR
  62          = Paths.get(System.getProperty("user.dir"));
  63 
  64     @DataProvider(name = "jarnames")
  65     public Object[][] createJarNames() {
  66         return new Object[][] {
  67 
  68             // JAR file name                module-name[/version]
  69 
  70             { "foo.jar",                    "foo" },
  71             { "foo4j.jar",                  "foo4j", },
  72 




   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 AutomaticModulesTest
  28  *        jdk.test.lib.util.JarUtils
  29  *        jdk.test.lib.util.ModuleUtils
  30  * @run testng AutomaticModulesTest
  31  * @summary Basic tests for automatic modules
  32  */
  33 
  34 import java.io.IOException;
  35 import java.lang.module.Configuration;
  36 import java.lang.module.FindException;
  37 import java.lang.module.ModuleDescriptor;
  38 import java.lang.module.ModuleDescriptor.Requires.Modifier;
  39 import java.lang.module.ModuleFinder;
  40 import java.lang.module.ModuleReference;
  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.Optional;
  47 import java.util.Set;
  48 import java.util.jar.Attributes;
  49 import java.util.jar.Manifest;
  50 import java.util.stream.Collectors;
  51 import java.util.stream.Stream;
  52 
  53 import jdk.test.lib.util.JarUtils;
  54 import jdk.test.lib.util.ModuleUtils;
  55 
  56 import org.testng.annotations.DataProvider;
  57 import org.testng.annotations.Test;
  58 import static org.testng.Assert.*;
  59 
  60 @Test
  61 public class AutomaticModulesTest {
  62 
  63     private static final Path USER_DIR
  64          = Paths.get(System.getProperty("user.dir"));
  65 
  66     @DataProvider(name = "jarnames")
  67     public Object[][] createJarNames() {
  68         return new Object[][] {
  69 
  70             // JAR file name                module-name[/version]
  71 
  72             { "foo.jar",                    "foo" },
  73             { "foo4j.jar",                  "foo4j", },
  74 


< prev index next >