[jbosstools-commits] JBoss Tools SVN: r23392 - in trunk/jmx/tests: org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui and 3 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Tue Jul 13 19:18:38 EDT 2010
Author: dgolovin
Date: 2010-07-13 19:18:37 -0400 (Tue, 13 Jul 2010)
New Revision: 23392
Added:
trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/ErrorRootTest.java
trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/ImpactTest.java
trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/JMXExceptionTest.java
trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/internal/test/
trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/internal/test/MBeanUtilsTestCase.java
trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/test/
trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/test/JMXUIAllTests.java
Removed:
trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/internal/MBeanUtilsTestCase.java
Modified:
trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/JMXCoreAllTests.java
Log:
increase JMX code coverage a little to test coverage report
Added: trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/ErrorRootTest.java
===================================================================
--- trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/ErrorRootTest.java (rev 0)
+++ trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/ErrorRootTest.java 2010-07-13 23:18:37 UTC (rev 23392)
@@ -0,0 +1,14 @@
+package org.jboss.tools.jmx.core.test;
+
+import junit.framework.TestCase;
+
+import org.jboss.tools.jmx.core.tree.ErrorRoot;
+
+public class ErrorRootTest extends TestCase {
+
+ public void testErrorRootConstructor() {
+ // there should be no exceptions
+ new ErrorRoot();
+ }
+
+}
Property changes on: trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/ErrorRootTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/ImpactTest.java
===================================================================
--- trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/ImpactTest.java (rev 0)
+++ trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/ImpactTest.java 2010-07-13 23:18:37 UTC (rev 23392)
@@ -0,0 +1,25 @@
+package org.jboss.tools.jmx.core.test;
+
+import static org.junit.Assert.*;
+
+import javax.management.MBeanOperationInfo;
+
+import junit.framework.TestCase;
+
+import org.jboss.tools.jmx.core.Impact;
+import org.junit.Test;
+
+public class ImpactTest extends TestCase{
+
+ public void testImpactParseInt() {
+ Impact impact = Impact.parseInt(MBeanOperationInfo.ACTION);
+ assertEquals(Impact.ACTION,impact);
+ impact = Impact.parseInt(MBeanOperationInfo.ACTION_INFO);
+ assertEquals(Impact.ACTION_INFO,impact);
+ impact = Impact.parseInt(MBeanOperationInfo.INFO);
+ assertEquals(Impact.INFO,impact);
+ impact = Impact.parseInt(MBeanOperationInfo.UNKNOWN);
+ assertEquals(Impact.UNKNOWN,impact);
+ }
+
+}
Property changes on: trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/ImpactTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/JMXCoreAllTests.java
===================================================================
--- trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/JMXCoreAllTests.java 2010-07-13 22:35:34 UTC (rev 23391)
+++ trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/JMXCoreAllTests.java 2010-07-13 23:18:37 UTC (rev 23392)
@@ -12,5 +12,8 @@
super("JMX Core All Tests");
addTest(new TestSuite(DefaultProviderTest.class));
addTest(new TestSuite(NodeBuilderTestCase.class));
+ addTestSuite(JMXExceptionTest.class);
+ addTestSuite(ImpactTest.class);
+ addTestSuite(ErrorRootTest.class);
}
}
Added: trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/JMXExceptionTest.java
===================================================================
--- trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/JMXExceptionTest.java (rev 0)
+++ trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/JMXExceptionTest.java 2010-07-13 23:18:37 UTC (rev 23392)
@@ -0,0 +1,24 @@
+package org.jboss.tools.jmx.core.test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.jboss.tools.jmx.core.JMXActivator;
+import org.jboss.tools.jmx.core.JMXException;
+import org.junit.Test;
+
+public class JMXExceptionTest extends TestCase{
+
+ public void testJMXExceptionGetStatus() {
+ JMXException ex = new JMXException(new Status(IStatus.ERROR,JMXActivator.PLUGIN_ID,"Test message"));
+ assertTrue(ex.getStatus().getSeverity() == IStatus.ERROR);
+ ex = new JMXException(new Status(IStatus.INFO,JMXActivator.PLUGIN_ID,"Test message"));
+ assertTrue(ex.getStatus().getSeverity() == IStatus.INFO);
+ ex = new JMXException(new Status(IStatus.OK,JMXActivator.PLUGIN_ID,"Test message"));
+ assertTrue(ex.getStatus().getSeverity() == IStatus.OK);
+ }
+
+}
Property changes on: trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/test/JMXExceptionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/internal/MBeanUtilsTestCase.java
===================================================================
--- trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/internal/MBeanUtilsTestCase.java 2010-07-13 22:35:34 UTC (rev 23391)
+++ trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/internal/MBeanUtilsTestCase.java 2010-07-13 23:18:37 UTC (rev 23392)
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Jeff Mesnil
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.jboss.tools.jmx.ui.internal;
-
-import org.jboss.tools.jmx.ui.internal.MBeanUtils;
-
-import junit.framework.TestCase;
-
-public class MBeanUtilsTestCase extends TestCase {
-
- public void testNullValue() throws Exception {
- assertNull(MBeanUtils.getValue(null, "whatever")); //$NON-NLS-1$
- assertNull(MBeanUtils.getValue("whatever", null)); //$NON-NLS-1$
- assertNull(MBeanUtils.getValue(null, null));
- }
-
- public void testNonPrimitiveType() throws Exception {
- String value = "any value"; //$NON-NLS-1$
- assertEquals(value, MBeanUtils.getValue(value, "java.util.Vector")); //$NON-NLS-1$
- }
-
- public void testBooleanValue() throws Exception {
- assertEquals(Boolean.TRUE, MBeanUtils.getValue("true", "boolean")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(Boolean.FALSE, MBeanUtils.getValue("false", "boolean")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(Boolean.FALSE, MBeanUtils.getValue("whatever", "boolean")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testByteValue() throws Exception {
- assertEquals((byte) 0, MBeanUtils.getValue("0", "byte")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals((byte) 1, MBeanUtils.getValue("1", "byte")); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- MBeanUtils.getValue("whatever", "byte"); //$NON-NLS-1$ //$NON-NLS-2$
- fail();
- } catch (NumberFormatException e) {
-
- }
- }
-
- public void testCharValue() throws Exception {
- assertEquals('a', MBeanUtils.getValue("a", "char")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals('o', MBeanUtils.getValue("only take the first char", //$NON-NLS-1$
- "char")); //$NON-NLS-1$
- }
-
- public void testShortValue() throws Exception {
- assertEquals((short) 1, MBeanUtils.getValue("1", "short")); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- MBeanUtils.getValue("not a short", "short"); //$NON-NLS-1$ //$NON-NLS-2$
- fail();
- } catch (NumberFormatException e) {
-
- }
- }
-
- public void testIntValue() throws Exception {
- assertEquals(1, MBeanUtils.getValue("1", "int")); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- MBeanUtils.getValue("not a int", "int"); //$NON-NLS-1$ //$NON-NLS-2$
- fail();
- } catch (NumberFormatException e) {
-
- }
- }
-
- public void testLongValue() throws Exception {
- assertEquals((long) 1, MBeanUtils.getValue("1", "long")); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- MBeanUtils.getValue("not a long", "long"); //$NON-NLS-1$ //$NON-NLS-2$
- fail();
- } catch (NumberFormatException e) {
-
- }
- }
-
- public void testFloatValue() throws Exception {
- assertEquals(1.0f, MBeanUtils.getValue("1", "float")); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- MBeanUtils.getValue("not a float", "float"); //$NON-NLS-1$ //$NON-NLS-2$
- fail();
- } catch (NumberFormatException e) {
-
- }
- }
-
- public void testDoubleValue() throws Exception {
- assertEquals(1.0, MBeanUtils.getValue("1", "double")); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- MBeanUtils.getValue("not a double", "double"); //$NON-NLS-1$ //$NON-NLS-2$
- fail();
- } catch (NumberFormatException e) {
-
- }
- }
-
-}
Copied: trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/internal/test/MBeanUtilsTestCase.java (from rev 23391, trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/internal/MBeanUtilsTestCase.java)
===================================================================
--- trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/internal/test/MBeanUtilsTestCase.java (rev 0)
+++ trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/internal/test/MBeanUtilsTestCase.java 2010-07-13 23:18:37 UTC (rev 23392)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Jeff Mesnil
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.jboss.tools.jmx.ui.internal.test;
+
+import org.jboss.tools.jmx.ui.internal.MBeanUtils;
+
+import junit.framework.TestCase;
+
+public class MBeanUtilsTestCase extends TestCase {
+
+ public void testNullValue() throws Exception {
+ assertNull(MBeanUtils.getValue(null, "whatever")); //$NON-NLS-1$
+ assertNull(MBeanUtils.getValue("whatever", null)); //$NON-NLS-1$
+ assertNull(MBeanUtils.getValue(null, null));
+ }
+
+ public void testNonPrimitiveType() throws Exception {
+ String value = "any value"; //$NON-NLS-1$
+ assertEquals(value, MBeanUtils.getValue(value, "java.util.Vector")); //$NON-NLS-1$
+ }
+
+ public void testBooleanValue() throws Exception {
+ assertEquals(Boolean.TRUE, MBeanUtils.getValue("true", "boolean")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(Boolean.FALSE, MBeanUtils.getValue("false", "boolean")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(Boolean.FALSE, MBeanUtils.getValue("whatever", "boolean")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void testByteValue() throws Exception {
+ assertEquals((byte) 0, MBeanUtils.getValue("0", "byte")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals((byte) 1, MBeanUtils.getValue("1", "byte")); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ MBeanUtils.getValue("whatever", "byte"); //$NON-NLS-1$ //$NON-NLS-2$
+ fail();
+ } catch (NumberFormatException e) {
+
+ }
+ }
+
+ public void testCharValue() throws Exception {
+ assertEquals('a', MBeanUtils.getValue("a", "char")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals('o', MBeanUtils.getValue("only take the first char", //$NON-NLS-1$
+ "char")); //$NON-NLS-1$
+ }
+
+ public void testShortValue() throws Exception {
+ assertEquals((short) 1, MBeanUtils.getValue("1", "short")); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ MBeanUtils.getValue("not a short", "short"); //$NON-NLS-1$ //$NON-NLS-2$
+ fail();
+ } catch (NumberFormatException e) {
+
+ }
+ }
+
+ public void testIntValue() throws Exception {
+ assertEquals(1, MBeanUtils.getValue("1", "int")); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ MBeanUtils.getValue("not a int", "int"); //$NON-NLS-1$ //$NON-NLS-2$
+ fail();
+ } catch (NumberFormatException e) {
+
+ }
+ }
+
+ public void testLongValue() throws Exception {
+ assertEquals((long) 1, MBeanUtils.getValue("1", "long")); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ MBeanUtils.getValue("not a long", "long"); //$NON-NLS-1$ //$NON-NLS-2$
+ fail();
+ } catch (NumberFormatException e) {
+
+ }
+ }
+
+ public void testFloatValue() throws Exception {
+ assertEquals(1.0f, MBeanUtils.getValue("1", "float")); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ MBeanUtils.getValue("not a float", "float"); //$NON-NLS-1$ //$NON-NLS-2$
+ fail();
+ } catch (NumberFormatException e) {
+
+ }
+ }
+
+ public void testDoubleValue() throws Exception {
+ assertEquals(1.0, MBeanUtils.getValue("1", "double")); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ MBeanUtils.getValue("not a double", "double"); //$NON-NLS-1$ //$NON-NLS-2$
+ fail();
+ } catch (NumberFormatException e) {
+
+ }
+ }
+
+}
Copied: trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/test/JMXUIAllTests.java (from rev 23391, trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/JMXUIAllTests.java)
===================================================================
--- trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/test/JMXUIAllTests.java (rev 0)
+++ trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/test/JMXUIAllTests.java 2010-07-13 23:18:37 UTC (rev 23392)
@@ -0,0 +1,14 @@
+package org.jboss.tools.jmx.ui.test;
+import org.jboss.tools.jmx.ui.internal.test.MBeanUtilsTestCase;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+public class JMXUIAllTests {
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+ suite.addTestSuite(MBeanUtilsTestCase.class);
+ return suite;
+ }
+}
Property changes on: trunk/jmx/tests/org.jboss.tools.jmx.ui.test/src/org/jboss/tools/jmx/ui/test/JMXUIAllTests.java
___________________________________________________________________
Name: svn:mergeinfo
+
More information about the jbosstools-commits
mailing list