< prev index next >

test/java/security/modules/JigsawSecurityUtils.java

Print this page

        

@@ -24,10 +24,11 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.List;
 import java.util.Map;
+import java.util.Arrays;

 import java.lang.module.ModuleDescriptor;
 import static java.lang.module.ModuleDescriptor.Builder;
 
 /**
  * Jigsaw utility methods are part of this class. It exposes methods to generate

@@ -50,11 +51,12 @@
      * Constructs a Java Command line string based on modular structure followed
      * by modular client and service.
      */
     public static String[] getJavaCommand(Path modulePath,
             StringBuilder classPath, String clientModuleName,
-            String mainClass, Map<String, String> vmArgs) throws IOException {
+            String mainClass, Map<String, String> vmArgs,

+            String... options) throws IOException {

 
         final StringBuilder command = new StringBuilder();
         vmArgs.forEach((key, value) -> command.append(key + value + SPACE));
         if (modulePath != null) {
             command.append("-mp" + SPACE + modulePath.toRealPath() + SPACE);

@@ -64,10 +66,11 @@
         }
         if (clientModuleName != null && clientModuleName.length() > 0) {
             command.append("-m" + SPACE + clientModuleName + "/");
         }
         command.append(mainClass);
+        Arrays.asList(options).stream().forEach(o -> command.append(SPACE + o));

         return command.toString().trim().split("[\\s]+");
     }
 
     /**
      * Generate ModuleDescriptor object for explicit/auto based client/service

@@ -103,13 +106,13 @@
      * Generates service descriptor inside META-INF folder.
      */
     public static boolean createMetaInfServiceDescriptor(
             Path serviceDescriptorFile, String serviceImpl) {
         boolean created = true;
-        System.out.println(String.format("Creating META-INF service descriptor"
-                + " for '%s' at path '%s'", serviceImpl,
-                serviceDescriptorFile));
+        System.out.println(String.format(

+                "Creating META-INF service descriptor for '%s' "

+                + "at path '%s'", serviceImpl, serviceDescriptorFile));

         try {
             Path parent = serviceDescriptorFile.getParent();
             if (parent != null) {
                 Files.createDirectories(parent);
             }
< prev index next >