You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2019/06/02 07:06:11 UTC

[GitHub] [netbeans] dukescript commented on a change in pull request #1279: Polishing Gradle HTML UI

dukescript commented on a change in pull request #1279: Polishing Gradle HTML UI
URL: https://github.com/apache/netbeans/pull/1279#discussion_r289629135
 
 

 ##########
 File path: groovy/gradle.htmlui/test/unit/src/org/netbeans/modules/gradle/htmlui/CreateArchetypeTest.java
 ##########
 @@ -78,11 +98,55 @@ public void testCreateFromArchetype() throws Exception {
                 assertPackage("my.pkg.x").
                 assertName("BrowserMain").
                 assertNoLicense();
+        assertFile("settings include only desktop and web", dest, "settings.gradle").
+                assertText("//include 'app'").
+                assertText("//include 'ios'").
+                assertText("include 'desktop'").
+                assertText("include 'web'");
+
+        Project mainPrj = ProjectManager.getDefault().findProject(dest);
+        assertNotNull("Project found", mainPrj);
+        OpenProjects.getDefault().open(new Project[] { mainPrj }, true);
+
+
+        ActionProvider actions = mainPrj.getLookup().lookup(ActionProvider.class);
+        assertTrue(Arrays.asList(actions.getSupportedActions()).contains(ActionProvider.COMMAND_BUILD));
+        actions.isActionEnabled(ActionProvider.COMMAND_BUILD, mainPrj.getLookup());
+
+
+        invokeCommand(actions, ActionProvider.COMMAND_BUILD, mainPrj);
+        assertFile("JAR created", dest, "build", "libs", "dest-1.0-SNAPSHOT.jar");
+
+        FileObject desktopFo = mainPrj.getProjectDirectory().getFileObject("desktop");
+        assertNotNull("desktop dir found", desktopFo);
+        Project desktopPrj = ProjectManager.getDefault().findProject(desktopFo);
+        assertNotNull("desktop project found", desktopPrj);
+
+        invokeCommand(actions, ActionProvider.COMMAND_RUN, desktopPrj);
+        assertFile("JAR created", dest, "desktop", "build", "libs", "desktop.jar");
+
+        FileObject webFo = mainPrj.getProjectDirectory().getFileObject("web");
+        assertNotNull("web dir found", webFo);
+        Project webPrj = ProjectManager.getDefault().findProject(webFo);
+        assertNotNull("web project found", webPrj);
+
+        invokeCommand(actions, ActionProvider.COMMAND_RUN, webPrj);
+        assertFile("Main script created", dest, "web", "build", "web", "bck2brwsr.js");
+    }
+
+    protected void invokeCommand(ActionProvider actions, String cmd, Project prj) throws IllegalArgumentException, InterruptedException {
+        CountDownLatch waiter = new CountDownLatch(1);
+        TaskListener notifier = (t) -> {
+            waiter.countDown();
+        };
+        actions.invokeAction(cmd, Lookups.fixed(prj, notifier));
+        waiter.await();
 
 Review comment:
   The `invokeCommand` has to wait till the `cmd` action is finished, @lkishalmi.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists