Issue #23507 cluster-cli now uses junit5 instead of junit4
- also removed unfinished commented out test class
diff --git a/nucleus/cluster/cli/pom.xml b/nucleus/cluster/cli/pom.xml
index d787a58..16a5e2e 100755
--- a/nucleus/cluster/cli/pom.xml
+++ b/nucleus/cluster/cli/pom.xml
@@ -101,6 +101,10 @@
</dependency>
<dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
</dependency>
diff --git a/nucleus/cluster/cli/src/test/java/com/sun/enterprise/admin/cli/cluster/LocalInstanceCommandTest.java b/nucleus/cluster/cli/src/test/java/com/sun/enterprise/admin/cli/cluster/LocalInstanceCommandTest.java
index 278e690..318e122 100644
--- a/nucleus/cluster/cli/src/test/java/com/sun/enterprise/admin/cli/cluster/LocalInstanceCommandTest.java
+++ b/nucleus/cluster/cli/src/test/java/com/sun/enterprise/admin/cli/cluster/LocalInstanceCommandTest.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -17,39 +18,31 @@
package com.sun.enterprise.admin.cli.cluster;
import com.sun.enterprise.universal.io.SmartFile;
-import com.sun.enterprise.util.SystemPropertyConstants;
-import java.io.*;
+
+import java.io.File;
+
import org.glassfish.api.admin.CommandException;
import org.glassfish.api.admin.CommandValidationException;
-import com.sun.enterprise.admin.servermgmt.cli.LocalServerCommand;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
/**
*
* @author bnevins
*/
-public class LocalInstanceCommandTest extends LocalInstanceCommand{
+public class LocalInstanceCommandTest extends LocalInstanceCommand {
- public LocalInstanceCommandTest() {
- }
+ private static File installDir;
+ private static File nodeAgentsDir;
-
- @AfterClass
- public static void tearDownClass() throws Exception {
- }
-
- @Before
+ @BeforeEach
public void setUp() {
- me = new LocalInstanceCommandTest();
- }
-
- @After
- public void tearDown() {
+ String installDirPath = LocalInstanceCommandTest.class.getClassLoader().getResource("fake_gf_install_dir").getPath();
+ installDir = SmartFile.sanitize(new File(installDirPath));
+ System.out.println("install dir: " + installDir);
+ nodeAgentsDir = new File(installDir, "nodes");
}
/**
@@ -57,17 +50,10 @@
*/
@Test
public void testValidate() throws Exception {
- System.out.println("test LocalInstanceCommand.validate");
- try {
- nodeDir = nodeAgentsDir.getAbsolutePath();
- instanceName = "i1";
- isCreateInstanceFilesystem = true;
- validate();
- }
- catch(CommandException e) {
- fail("validate failed!!!");
- throw e;
- }
+ nodeDir = nodeAgentsDir.getAbsolutePath();
+ instanceName = "i1";
+ isCreateInstanceFilesystem = true;
+ assertDoesNotThrow(() -> validate());
}
@Override
@@ -75,14 +61,4 @@
System.out.println("Do nothing!");
return 0;
}
-
- private LocalInstanceCommandTest me;
- private static File installDir;
- private static File nodeAgentsDir;
-
- static {
- String installDirPath = LocalInstanceCommandTest.class.getClassLoader().getResource("fake_gf_install_dir").getPath();
- installDir = SmartFile.sanitize(new File(installDirPath));
- nodeAgentsDir = new File(installDir, "nodes");
- }
}
diff --git a/nucleus/cluster/cli/src/test/java/com/sun/enterprise/admin/cli/cluster/StartInstanceCommandTest.java b/nucleus/cluster/cli/src/test/java/com/sun/enterprise/admin/cli/cluster/StartInstanceCommandTest.java
deleted file mode 100644
index c0752b4..0000000
--- a/nucleus/cluster/cli/src/test/java/com/sun/enterprise/admin/cli/cluster/StartInstanceCommandTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.enterprise.admin.cli.cluster;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-/**
- *
- * @author bnevins
- */
-public class StartInstanceCommandTest {
-
- public StartInstanceCommandTest() {
- }
-
- @BeforeClass
- public static void setUpClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownClass() throws Exception {
- }
-
- @Before
- public void setUp() {
- }
-
- @After
- public void tearDown() {
- }
-
- /**
- * Test of executeCommand method, of class StartInstanceCommand.
- */
- @Test
- public void testExecuteCommand() throws Exception {
- System.out.println("executeCommand");
- //StartLocalInstanceCommand instance = new StartLocalInstanceCommand();
- //int expResult = 0;
- //int result = instance.executeCommand();
- //assertEquals(expResult, result);
- }
-
-}