junichi11 commented on a change in pull request #1402: [NETBEANS-1763] Integrate maven failsafe output into test runner output URL: https://github.com/apache/netbeans/pull/1402#discussion_r313818460
########## File path: java/maven.junit.ui/src/org/netbeans/modules/maven/junit/ui/MavenJUnitTestMethodNode.java ########## @@ -62,52 +63,71 @@ public MavenJUnitTestMethodNode(Testcase testcase, Project project, String proje @Override public Action[] getActions(boolean context) { List<Action> actions = new ArrayList<Action>(); - Action preferred = getPreferredAction(); - if (preferred != null) { - actions.add(preferred); - } - FileObject testFO = getTestcaseFileObject(); - if (testFO != null){ + FileObject testFO = getTestcaseFileObject(); + if (testFO != null) { + boolean unitTest = getTestcase().getType() == null || "UNIT".equals(getTestcase().getType()); + boolean integrationTest = "INTEGRATION".equals(getTestcase().getType()); Project suiteProject = FileOwnerQuery.getOwner(testFO); if (suiteProject != null) { ActionProvider actionProvider = suiteProject.getLookup().lookup(ActionProvider.class); if (actionProvider != null) { - boolean runSupported = false; - boolean debugSupported = false; - for (String action : actionProvider.getSupportedActions()) { - if (!runSupported && action.equals(COMMAND_RUN_SINGLE_METHOD)) { - runSupported = true; - if (debugSupported) { - break; - } - } - if (!debugSupported && action.equals(COMMAND_DEBUG_SINGLE_METHOD)) { - debugSupported = true; - if (runSupported) { - break; - } - } - } - SingleMethod methodSpec = new SingleMethod(testFO, testcase.getName()); Lookup nodeContext = Lookups.singleton(methodSpec); - if (runSupported && actionProvider.isActionEnabled(COMMAND_RUN_SINGLE_METHOD, - nodeContext)) { - actions.add(new TestMethodNodeAction(actionProvider, + + for (String action : actionProvider.getSupportedActions()) { + if (unitTest + && action.equals(COMMAND_RUN_SINGLE_METHOD) + && actionProvider.isActionEnabled(action, nodeContext)) { + actions.add(new TestMethodNodeAction(actionProvider, nodeContext, COMMAND_RUN_SINGLE_METHOD, Bundle.LBL_RerunTest())); - } - if (debugSupported && actionProvider.isActionEnabled(COMMAND_DEBUG_SINGLE_METHOD, - nodeContext)) { - actions.add(new TestMethodNodeAction(actionProvider, + } + if (unitTest + && action.equals(COMMAND_DEBUG_SINGLE_METHOD) + && actionProvider.isActionEnabled(action, nodeContext)) { + actions.add(new TestMethodNodeAction(actionProvider, nodeContext, COMMAND_DEBUG_SINGLE_METHOD, Bundle.LBL_DebugTest())); + } + if (integrationTest + && action.equals("integration-test.single") + && actionProvider.isActionEnabled(action, nodeContext)) { + actions.add(new TestMethodNodeAction(actionProvider, + nodeContext, + "integration-test.single", Review comment: Missing `// NOI18N`s? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists