[jboss-osgi-commits] JBoss-OSGI SVN: r101150 - in projects/jboss-osgi/projects/testing/trunk/src/test: java/org/jboss/test/osgi/testing and 3 other directories.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Fri Feb 19 05:50:47 EST 2010
Author: thomas.diesler at jboss.com
Date: 2010-02-19 05:50:46 -0500 (Fri, 19 Feb 2010)
New Revision: 101150
Added:
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/SimpleTestCase.java
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleActivator.java
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleService.java
projects/jboss-osgi/projects/testing/trunk/src/test/resources/simple/
projects/jboss-osgi/projects/testing/trunk/src/test/resources/simple/example-simple.bnd
Log:
split husky and testing
Added: projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/SimpleTestCase.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/SimpleTestCase.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/SimpleTestCase.java 2010-02-19 10:50:46 UTC (rev 101150)
@@ -0,0 +1,65 @@
+/*
+ * 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.test.osgi.testing;
+
+//$Id$
+
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+
+/**
+ * A test that deployes a bundle and verifies its state
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 12-Feb-2009
+ */
+public class SimpleTestCase extends OSGiTest
+{
+ @Test
+ public void testSimpleBundle() throws Exception
+ {
+ // Get the default runtime
+ OSGiRuntime runtime = getDefaultRuntime();
+ try
+ {
+ // Install the bundle
+ OSGiBundle bundle = runtime.installBundle("example-simple.jar");
+ assertBundleState(Bundle.INSTALLED, bundle.getState());
+
+ // Start the bundle
+ bundle.start();
+ assertBundleState(Bundle.ACTIVE, bundle.getState());
+
+ // Uninstall the bundle
+ bundle.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, bundle.getState());
+ }
+ finally
+ {
+ // Shutdown the runtime
+ runtime.shutdown();
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/SimpleTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleActivator.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleActivator.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleActivator.java 2010-02-19 10:50:46 UTC (rev 101150)
@@ -0,0 +1,55 @@
+/*
+ * 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.test.osgi.testing.bundle;
+
+//$Id$
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
+
+/**
+ * A Service Activator
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 24-Apr-2009
+ */
+public class SimpleActivator implements BundleActivator
+{
+ private LogService log;
+
+ public void start(BundleContext context)
+ {
+ log = new LogServiceTracker(context);
+ log.log(LogService.LOG_INFO, "Start: " + context.getBundle());
+
+ // Register a service
+ SimpleService service = new SimpleService(context);
+ context.registerService(SimpleService.class.getName(), service, null);
+ }
+
+ public void stop(BundleContext context)
+ {
+ log.log(LogService.LOG_INFO, "Stop: " + context.getBundle());
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleActivator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleService.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleService.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleService.java 2010-02-19 10:50:46 UTC (rev 101150)
@@ -0,0 +1,50 @@
+/*
+ * 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.test.osgi.testing.bundle;
+
+//$Id$
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
+
+/**
+ * A SimpleService
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 24-Apr-2009
+ */
+public class SimpleService
+{
+ private LogService log;
+
+ public SimpleService(BundleContext context)
+ {
+ log = new LogServiceTracker(context);
+ }
+
+ public String echo(String msg)
+ {
+ log.log(LogService.LOG_INFO, "echo: " + msg);
+ return msg;
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/test/resources/simple/example-simple.bnd
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/test/resources/simple/example-simple.bnd (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/test/resources/simple/example-simple.bnd 2010-02-19 10:50:46 UTC (rev 101150)
@@ -0,0 +1,6 @@
+# bnd build -classpath target/test-classes -output target/test-libs/example-simple.jar src/test/resources/example/simple/example-simple.bnd
+
+Bundle-SymbolicName: example-simple
+
+Bundle-Activator: org.jboss.test.osgi.testing.bundle.SimpleActivator
+Export-Package: org.jboss.test.osgi.testing.bundle
More information about the jboss-osgi-commits
mailing list