Use new version of Osgi plugin
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 3 Jun 2009 11:19:21 +0000 (11:19 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 3 Jun 2009 11:19:21 +0000 (11:19 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2447 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

integration-tests/org.argeo.slc.it.webapp/pom.xml
integration-tests/org.argeo.slc.it.webapp/src/test/java/org/argeo/slc/it/webapp/AgentTest.java [new file with mode: 0644]
integration-tests/org.argeo.slc.it.webapp/src/test/java/org/argeo/slc/it/webapp/StartStopServerTest.java [deleted file]
integration-tests/org.argeo.slc.it.webapp/src/test/resources/org/argeo/slc/it/webapp/applicationContext.xml [new file with mode: 0644]

index c1ba1a27a1edd4ec8260e46729ed81ef44a41fd0..4ee9f57315b35e57ab2e68ff7e7f7ca47499334f 100644 (file)
        <name>Argeo SLC Web Application Integration Tests</name>
        <build>
                <plugins>
+                       <!--
+                               <plugin> <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-dependency-plugin</artifactId> <executions>
+                               <execution> <id>copy-dependencies</id>
+                               <phase>pre-integration-test</phase> <goals>
+                               <goal>copy-dependencies</goal> </goals> <configuration>
+                               <overWriteReleases>true</overWriteReleases>
+                               <overWriteSnapshots>true</overWriteSnapshots> </configuration>
+                               </execution> </executions> </plugin>
+                       -->
                        <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-dependency-plugin</artifactId>
+                               <groupId>org.argeo.slc.maven</groupId>
+                               <artifactId>maven-argeo-osgi-plugin</artifactId>
+                               <version>${version.maven-argeo-osgi}</version>
                                <executions>
                                        <execution>
-                                               <id>copy-dependencies</id>
+                                               <id>equinox-start</id>
                                                <phase>pre-integration-test</phase>
                                                <goals>
-                                                       <goal>copy-dependencies</goal>
+                                                       <goal>equinox</goal>
                                                </goals>
                                                <configuration>
-                                                       <overWriteReleases>true</overWriteReleases>
-                                                       <overWriteSnapshots>true</overWriteSnapshots>
+                                                       <wait>false</wait>
+                                                       <pause>5000</pause>
+                                                       <argsToAppend>
+                                                               <arg>-clean</arg>
+                                                       </argsToAppend>
+                                                       <systemProperties>
+                                                               <slc.osgi.bundles>${basedir}/../../demo/site;in=*;ex=target</slc.osgi.bundles>
+                                                               <slc.osgi.start>
+                                                                       org.argeo.dep.osgi.catalina.start,
+                                                                       org.springframework.osgi.extender,
+                                                                       org.springframework.osgi.web.extender,
+                                                                       org.springframework.osgi.samples.simplewebapp,
+                                                                       org.argeo.slc.server.activemq,
+                                                                       org.argeo.slc.server.hsqldb,
+                                                                       org.argeo.slc.server.hibernate,
+                                                                       org.argeo.slc.server.services,
+                                                                       org.argeo.slc.server.jms,
+                                                                       org.argeo.slc.webapp,
+                                                                       org.argeo.slc.ria
+                                                               </slc.osgi.start>
+                                                       </systemProperties>
                                                </configuration>
                                        </execution>
+                                       <execution>
+                                               <id>equinox-shutdown</id>
+                                               <phase>post-integration-test</phase>
+                                               <goals>
+                                                       <goal>equinox-shutdown</goal>
+                                               </goals>
+                                       </execution>
                                </executions>
                        </plugin>
                        <plugin>
                        <version>${project.version}</version>
                        <type>pom</type>
                </dependency>
+               <dependency>
+                       <groupId>org.argeo.slc.runtime</groupId>
+                       <artifactId>org.argeo.slc.support.equinox</artifactId>
+               </dependency>
+
 
                <!-- TEST -->
                <dependency>
diff --git a/integration-tests/org.argeo.slc.it.webapp/src/test/java/org/argeo/slc/it/webapp/AgentTest.java b/integration-tests/org.argeo.slc.it.webapp/src/test/java/org/argeo/slc/it/webapp/AgentTest.java
new file mode 100644 (file)
index 0000000..09f368e
--- /dev/null
@@ -0,0 +1,22 @@
+package org.argeo.slc.it.webapp;
+
+import java.net.InetAddress;
+
+import org.argeo.slc.msg.ObjectList;
+import org.argeo.slc.runtime.SlcAgentDescriptor;
+import org.argeo.slc.server.client.SlcServerHttpClient;
+import org.argeo.slc.unit.AbstractSpringTestCase;
+
+public class AgentTest extends AbstractSpringTestCase {
+       public void testListAgents() throws Exception {
+               SlcServerHttpClient httpClient = getBean(SlcServerHttpClient.class);
+               ObjectList objectList = httpClient.callService("listAgents.service",
+                               null);
+               assertEquals(0, objectList.getObjects().size());
+//             SlcAgentDescriptor slcAgentDescriptor = (SlcAgentDescriptor) objectList
+//                             .getObjects().get(0);
+//             assertEquals(InetAddress.getLocalHost().getHostName(),
+//                             slcAgentDescriptor.getHost());
+       }
+
+}
diff --git a/integration-tests/org.argeo.slc.it.webapp/src/test/java/org/argeo/slc/it/webapp/StartStopServerTest.java b/integration-tests/org.argeo.slc.it.webapp/src/test/java/org/argeo/slc/it/webapp/StartStopServerTest.java
deleted file mode 100644 (file)
index 84ac248..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.argeo.slc.it.webapp;
-
-import java.util.Properties;
-
-import org.argeo.slc.osgi.test.AbstractOsgiRuntimeTest;
-import org.argeo.slc.osgiboot.OsgiBoot;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.springframework.osgi.test.platform.EquinoxPlatform;
-import org.springframework.osgi.test.platform.OsgiPlatform;
-import org.springframework.osgi.util.OsgiStringUtils;
-
-public class StartStopServerTest extends AbstractOsgiRuntimeTest {
-       public void testStartStop() throws Exception {
-               BundleContext bundleContext = osgiPlatform.getBundleContext();
-               Bundle[] bundles = bundleContext.getBundles();
-               for (int i = 0; i < bundles.length; i++) {
-                       System.out
-                                       .println(OsgiStringUtils.nullSafeSymbolicName(bundles[i]));
-               }
-
-               Thread.sleep(5 * 1000);
-
-       }
-
-       protected void postStart() throws Exception {
-               String classpath = System.getProperty("java.class.path");
-               System.out.println("Classpath=" + classpath);
-               osgiBoot.installUrls(osgiBoot.getLocationsUrls(
-                               OsgiBoot.DEFAULT_BASE_URL, classpath));
-               osgiBoot.installUrls(osgiBoot.getBundlesUrls(OsgiBoot.DEFAULT_BASE_URL,
-                               "../../demo/site;in=*;ex=target"));
-               osgiBoot.installUrls(osgiBoot.getBundlesUrls(OsgiBoot.DEFAULT_BASE_URL,
-                               "target/dependency;in=*.jar"));
-
-               String bundlesToStart = "org.argeo.dep.osgi.catalina.start,org.springframework.osgi.extender,org.springframework.osgi.web.extender,org.springframework.osgi.samples.simplewebapp,org.argeo.slc.server.activemq,org.argeo.slc.server.hsqldb,org.argeo.slc.server.hibernate,org.argeo.slc.server.services,org.argeo.slc.server.jms,org.argeo.slc.webapp,org.argeo.slc.ria";
-               osgiBoot.startBundles(bundlesToStart);
-       }
-
-       @Override
-       protected OsgiPlatform createOsgiPlatform() {
-
-               return new EquinoxPlatform() {
-
-                       @Override
-                       public Properties getConfigurationProperties() {
-                               Properties props = super.getConfigurationProperties();
-                               props.put("osgi.console", "");
-                               return props;
-                       }
-
-               };
-       }
-
-}
diff --git a/integration-tests/org.argeo.slc.it.webapp/src/test/resources/org/argeo/slc/it/webapp/applicationContext.xml b/integration-tests/org.argeo.slc.it.webapp/src/test/resources/org/argeo/slc/it/webapp/applicationContext.xml
new file mode 100644 (file)
index 0000000..8c1dcb7
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xmlns:tx="http://www.springframework.org/schema/tx"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
+       default-lazy-init="true">
+
+       <import resource="classpath:org/argeo/slc/castor/spring.xml" />
+
+       <!-- Http client -->
+       <bean id="slcDefault.serverHttpClient"
+               class="org.argeo.slc.server.client.SlcServerHttpClient" lazy-init="true">
+               <property name="unmarshaller" ref="slcDefault.castor.marshaller" />
+       </bean>
+</beans>
\ No newline at end of file