[jboss-cvs] JBossAS SVN: r89387 - in projects/jboss-osgi/projects: bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon May 25 15:42:36 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-05-25 15:42:36 -0400 (Mon, 25 May 2009)
New Revision: 89387
Removed:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java
Modified:
projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/pom.xml
projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java
projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java
projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java
projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java
projects/jboss-osgi/projects/runtime/felix/trunk/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java
projects/jboss-osgi/projects/runtime/knopflerfish/trunk/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
Log:
Migrate to JUnit4
Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/pom.xml 2009-05-25 19:39:08 UTC (rev 89386)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/pom.xml 2009-05-25 19:42:36 UTC (rev 89387)
@@ -150,11 +150,11 @@
<!--
Implement URLStreamHandlerService
https://jira.jboss.org/jira/browse/JBOSGI-75
+ -->
<property>
<name>java.protocol.handler.pkgs</name>
<value>org.jboss.net.protocol|org.jboss.virtual.protocol</value>
</property>
- -->
<property>
<name>test.archive.directory</name>
<value>${project.build.directory}/test-libs</value>
Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java 2009-05-25 19:39:08 UTC (rev 89386)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java 2009-05-25 19:42:36 UTC (rev 89387)
@@ -23,6 +23,9 @@
//$Id$
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.net.URL;
import java.util.List;
@@ -30,6 +33,7 @@
import org.jboss.osgi.blueprint.reflect.Blueprint;
import org.jboss.osgi.blueprint.reflect.ComponentMetadataImpl;
import org.jboss.osgi.spi.testing.OSGiTest;
+import org.junit.Test;
import org.osgi.service.blueprint.reflect.BeanMetadata;
/**
@@ -40,6 +44,7 @@
*/
public class BasicBeansParserTestCase extends OSGiTest
{
+ @Test
public void testBasicBeans() throws Exception
{
URL xmlURL = getResourceURL("parser/blueprint-basic-beans.xml");
Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java 2009-05-25 19:39:08 UTC (rev 89386)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java 2009-05-25 19:42:36 UTC (rev 89387)
@@ -23,6 +23,9 @@
//$Id$
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
import java.math.BigInteger;
import java.net.URL;
@@ -30,6 +33,7 @@
import org.jboss.osgi.blueprint.reflect.Availability;
import org.jboss.osgi.blueprint.reflect.Blueprint;
import org.jboss.osgi.spi.testing.OSGiTest;
+import org.junit.Test;
/**
* Blueprint parser tests
@@ -39,6 +43,7 @@
*/
public class BasicRootParserTestCase extends OSGiTest
{
+ @Test
public void testBlueprintDefaultAttributes() throws Exception
{
URL xmlURL = getResourceURL("parser/blueprint-basic-root.xml");
@@ -52,6 +57,7 @@
assertNull(blueprint.getDefaultDestroyMethod());
}
+ @Test
public void testBlueprintDescription() throws Exception
{
URL xmlURL = getResourceURL("parser/blueprint-basic-root.xml");
Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java 2009-05-25 19:39:08 UTC (rev 89386)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java 2009-05-25 19:42:36 UTC (rev 89387)
@@ -23,6 +23,9 @@
//$Id$
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.net.URL;
import java.util.List;
@@ -30,6 +33,7 @@
import org.jboss.osgi.blueprint.reflect.Blueprint;
import org.jboss.osgi.blueprint.reflect.ComponentMetadataImpl;
import org.jboss.osgi.spi.testing.OSGiTest;
+import org.junit.Test;
import org.osgi.service.blueprint.reflect.BeanMetadata;
import org.osgi.service.blueprint.reflect.ServiceMetadata;
@@ -41,6 +45,7 @@
*/
public class BasicServiceParserTestCase extends OSGiTest
{
+ @Test
public void testBasicBeans() throws Exception
{
URL xmlURL = getResourceURL("parser/blueprint-basic-service.xml");
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java 2009-05-25 19:39:08 UTC (rev 89386)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java 2009-05-25 19:42:36 UTC (rev 89387)
@@ -22,6 +22,7 @@
package org.jboss.osgi.husky;
+
// $Id$
/**
@@ -68,6 +69,21 @@
public interface Bridge
{
/**
+ * Get the caller's class
+ */
+ Class<?> getCallerClass();
+
+ /**
+ * Get the caller's method
+ */
+ String getCallerMethod();
+
+ /**
+ * Get the caller's concatination of class name and method.
+ */
+ String getCallerFrame();
+
+ /**
* Intercepts a test and delegates the execution to the
* same test in the same test class.
*
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java 2009-05-25 19:39:08 UTC (rev 89386)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java 2009-05-25 19:42:36 UTC (rev 89387)
@@ -86,18 +86,20 @@
}
}
- private Class<?> getCallerClass(String callerFrame)
+ public Class<?> getCallerClass()
{
+ String callerFrame = getCallerFrame();
String className = callerFrame.substring(0, callerFrame.lastIndexOf('.'));
return Util.loadClass(className);
}
- private String getCallerMethod(String callerFrame)
+ public String getCallerMethod()
{
+ String callerFrame = getCallerFrame();
return callerFrame.substring(callerFrame.lastIndexOf('.') + 1);
}
- private String getCallerFrame()
+ public String getCallerFrame()
{
String callerFrame = null;
try
@@ -117,7 +119,9 @@
// line 2 is this run method
String line = br.readLine();
line = br.readLine().trim();
- while (line.startsWith("at org.jboss.osgi.husky"))
+
+ String bridgePackage = Bridge.class.getPackage().getName();
+ while (line.startsWith("at " + bridgePackage))
{
line = br.readLine().trim();
}
@@ -130,4 +134,15 @@
}
return callerFrame;
}
+
+ private Class<?> getCallerClass(String callerFrame)
+ {
+ String className = callerFrame.substring(0, callerFrame.lastIndexOf('.'));
+ return Util.loadClass(className);
+ }
+
+ private String getCallerMethod(String callerFrame)
+ {
+ return callerFrame.substring(callerFrame.lastIndexOf('.') + 1);
+ }
}
Modified: projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java 2009-05-25 19:39:08 UTC (rev 89386)
+++ projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java 2009-05-25 19:42:36 UTC (rev 89387)
@@ -23,11 +23,14 @@
//$Id$
+import static org.junit.Assert.*;
+
import org.jboss.osgi.equinox.framework.EquinoxIntegration;
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.framework.OSGiFramework;
import org.jboss.osgi.spi.testing.OSGiTest;
+import org.junit.Test;
import org.osgi.framework.Bundle;
/**
@@ -38,6 +41,7 @@
*/
public class SystemBundleTestCase extends OSGiTest
{
+ @Test
public void testEquinoxIntegration()
{
EquinoxIntegration framework = new EquinoxIntegration();
@@ -50,6 +54,7 @@
assertEquals("SymbolicName", "org.eclipse.osgi", bundle.getSymbolicName());
}
+ @Test
public void testSystemBundle()
{
OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
Modified: projects/jboss-osgi/projects/runtime/felix/trunk/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java 2009-05-25 19:39:08 UTC (rev 89386)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java 2009-05-25 19:42:36 UTC (rev 89387)
@@ -23,11 +23,14 @@
//$Id$
+import static org.junit.Assert.assertEquals;
+
import org.jboss.osgi.felix.framework.FelixIntegration;
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.framework.OSGiFramework;
import org.jboss.osgi.spi.testing.OSGiTest;
+import org.junit.Test;
import org.osgi.framework.Bundle;
/**
@@ -38,18 +41,20 @@
*/
public class SystemBundleTestCase extends OSGiTest
{
+ @Test
public void testFelixIntegration()
{
FelixIntegration framework = new FelixIntegration();
framework.create();
framework.start();
-
+
Bundle bundle = framework.getBundle();
assertEquals("BundleId == 0", 0, bundle.getBundleId());
assertEquals("SymbolicName", "org.apache.felix.framework", bundle.getSymbolicName());
}
-
+
+ @Test
public void testSystemBundle()
{
OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
Modified: projects/jboss-osgi/projects/runtime/knopflerfish/trunk/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/knopflerfish/trunk/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java 2009-05-25 19:39:08 UTC (rev 89386)
+++ projects/jboss-osgi/projects/runtime/knopflerfish/trunk/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java 2009-05-25 19:42:36 UTC (rev 89387)
@@ -23,11 +23,14 @@
//$Id$
+import static org.junit.Assert.assertEquals;
+
import org.jboss.osgi.knopflerfish.framework.KnopflerfishIntegration;
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.framework.OSGiFramework;
import org.jboss.osgi.spi.testing.OSGiTest;
+import org.junit.Test;
import org.osgi.framework.Bundle;
/**
@@ -38,6 +41,7 @@
*/
public class SystemBundleTestCase extends OSGiTest
{
+ @Test
public void testEquinoxIntegration()
{
KnopflerfishIntegration framework = new KnopflerfishIntegration();
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-25 19:39:08 UTC (rev 89386)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-25 19:42:36 UTC (rev 89387)
@@ -24,11 +24,11 @@
import java.io.File;
import java.net.URL;
-import junit.framework.TestCase;
-
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
import org.jboss.virtual.VFS;
+import org.junit.After;
+import org.junit.Before;
/**
* An OSGi Test Case
@@ -36,7 +36,7 @@
* @author Thomas.Diesler at jboss.org
* @since 25-Sep-2008
*/
-public abstract class OSGiTest extends TestCase
+public abstract class OSGiTest
{
// Provide logging
final Logger log = Logger.getLogger(OSGiTest.class);
@@ -49,18 +49,16 @@
VFS.init();
}
- @Override
- protected void setUp() throws Exception
+ @Before
+ public void setUp() throws Exception
{
log.debug("### START " + getLongName());
helper = new OSGiTestHelper();
- super.setUp();
}
- @Override
- protected void tearDown() throws Exception
+ @After
+ public void tearDown() throws Exception
{
- super.tearDown();
log.debug("### END " + getLongName());
}
@@ -73,7 +71,7 @@
protected String getLongName()
{
- return getClass().getName() + "." + getName();
+ return getClass().getName();
}
protected OSGiRuntime getDefaultRuntime()
Deleted: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-25 19:39:08 UTC (rev 89386)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-25 19:42:36 UTC (rev 89387)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.spi.testing;
-
-import java.io.File;
-import java.net.URL;
-
-import junit.extensions.TestSetup;
-import junit.framework.TestSuite;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
-
-/**
- * An OSGi Test Setup
- *
- * @author Thomas.Diesler at jboss.org
- * @since 25-Sep-2008
- */
-public class OSGiTestSetup extends TestSetup
-{
- // Provide logging
- final Logger log = Logger.getLogger(OSGiTestSetup.class);
-
- private OSGiTestHelper helper;
- private Class<?> testCase;
-
- public OSGiTestSetup(Class<?> testCase)
- {
- super(new TestSuite(testCase));
- this.testCase = testCase;
- }
-
- @Override
- protected void setUp() throws Exception
- {
- log.debug("### START SETUP " + testCase.getName());
- helper = new OSGiTestHelper();
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- super.tearDown();
- log.debug("### END SETUP " + testCase.getName());
- }
-
- public OSGiRuntime getDefaultRuntime()
- {
- return helper.getDefaultRuntime();
- }
-
- protected OSGiRuntimeImpl getEmbeddedRuntime()
- {
- return helper.getEmbeddedRuntime();
- }
-
- public RemoteRuntime getRemoteRuntime()
- {
- return helper.getRemoteRuntime();
- }
-
- public URL getResourceURL(String resource)
- {
- return helper.getResourceURL(resource);
- }
-
- protected File getResourceFile(String resource)
- {
- return helper.getResourceFile(resource);
- }
-
- public URL getTestArchiveURL(String archive)
- {
- return helper.getTestArchiveURL(archive);
- }
-
- protected File getTestArchiveFile(String archive)
- {
- return helper.getTestArchiveFile(archive);
- }
-}
More information about the jboss-cvs-commits
mailing list