[jboss-svn-commits] JBL Code SVN: r36712 - in labs/jbossrules/tags/5.2.0.M1: drools-server and 16 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Feb 24 12:53:00 EST 2011
Author: ge0ffrey
Date: 2011-02-24 12:53:00 -0500 (Thu, 24 Feb 2011)
New Revision: 36712
Added:
labs/jbossrules/tags/5.2.0.M1/drools-server/
labs/jbossrules/tags/5.2.0.M1/drools-server/.gitignore
labs/jbossrules/tags/5.2.0.M1/drools-server/pom.xml
labs/jbossrules/tags/5.2.0.M1/drools-server/src/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/java/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/java/org/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/java/org/drools/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/java/org/drools/server/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/java/org/drools/server/Test.java
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/META-INF/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/META-INF/orm.xml
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/META-INF/persistence.xml
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/beans.xml
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/camel-client.xml
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/camel-server-grid.xml
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/camel-server.xml
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/knowledge-services-grid.xml
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/knowledge-services.xml
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/soap.wsdl
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/test.drl
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/webapp/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/webapp/WEB-INF/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/webapp/WEB-INF/web.xml
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/webapp/index.jsp
labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/webapp/test.jsp
labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/drools/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/drools/server/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/drools/server/CxfRsClientServerTest.java
labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/drools/server/CxfSoapClientServerGridTest.java
labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/drools/server/CxfSoapClientServerTest.java
labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/
labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/beans-test-grid.xml
labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/beans-test.xml
labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/camel-client-test.xml
labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/camel-embedded-server-test-grid.xml
labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/camel-embedded-server-test.xml
Log:
All monolothic build versions (<= 5.2.0.M1) stay in subversion
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/.gitignore
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/.gitignore (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/.gitignore 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,10 @@
+/target
+/local
+
+# Eclipse, Netbeans and IntelliJ files
+/.*
+!.gitignore
+/nbproject
+/*.ipr
+/*.iws
+/*.iml
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/pom.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/pom.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/pom.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.drools</groupId>
+ <artifactId>drools</artifactId>
+ <version>5.2.0.M1</version>
+ </parent>
+
+ <artifactId>drools-server</artifactId>
+ <packaging>war</packaging>
+ <name>Drools :: Server</name>
+ <build>
+ <finalName>drools-server</finalName>
+ </build>
+
+ <dependencies>
+
+ <!-- Drools -->
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-compiler</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-decisiontables</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-persistence-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-workitems</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-templates</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-spring</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-grid-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-camel</artifactId>
+ </dependency>
+
+ <!-- Camel -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-cxf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-xstream</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jaxb</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Spring -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- CXF deps -->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-bundle-jaxrs</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jaxen</groupId>
+ <artifactId>jaxen</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.xmlbeans</groupId>
+ <artifactId>xmlbeans</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ </dependency>
+
+
+ <!-- web app deps -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- HSQLDB -->
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+
+ </dependency>
+ </dependencies>
+
+</project>
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/java/org/drools/server/Test.java
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/java/org/drools/server/Test.java (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/java/org/drools/server/Test.java 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,78 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.server;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.apache.camel.CamelContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class Test {
+
+ public static void main(String[] args) {
+ String msg = "Hello World";
+
+ System.out.println( "Sending Message:\n" + msg);
+
+ Test test = new Test();
+ String response = test.send( msg );
+
+ System.out.println( );
+ System.out.println( );
+
+ System.out.println( "Received Response:\n" + response);
+ }
+
+ public String send(String msg) {
+ ClassPathXmlApplicationContext springContext = new ClassPathXmlApplicationContext("classpath:camel-client.xml");
+ String batch = "";
+ batch += "<batch-execution lookup=\"ksession1\">\n";
+ batch += " <insert out-identifier=\"message\">\n";
+ batch += " <org.test.Message>\n";
+ batch += " <text>" + msg + "</text>\n";
+ batch += " </org.test.Message>\n";
+ batch += " </insert>\n";
+ batch += "</batch-execution>\n";
+
+
+ Test test = new Test();
+ String response = test.execute( batch,
+ ( CamelContext ) springContext.getBean( "camel" ) );
+
+ return response;
+ }
+
+ public String execute(String msg, CamelContext camelContext) {
+
+ String response = camelContext.createProducerTemplate().requestBody( "direct://kservice/rest", msg, String.class );
+
+ return response;
+ }
+
+ public String execute(SOAPMessage soapMessage, CamelContext camelContext) throws SOAPException, IOException {
+ Object object = camelContext.createProducerTemplate().requestBody( "direct://kservice/soap", soapMessage);
+ OutputStream out = new ByteArrayOutputStream();
+ SOAPMessage soapResponse = (SOAPMessage) object;
+ soapResponse.writeTo(out);
+ return out.toString();
+ }
+}
\ No newline at end of file
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/META-INF/orm.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/META-INF/orm.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/META-INF/orm.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
+ version="1.0">
+ <entity class="org.drools.grid.service.directory.impl.AddressImpl" access="FIELD">
+ <table name="Address"/>
+
+ <attributes>
+ <id name="id">
+ <generated-value strategy="AUTO"/>
+ </id>
+ <many-to-one name="gridServiceDescription" target-entity="org.drools.grid.service.directory.impl.GridServiceDescriptionImpl" />
+ </attributes>
+ </entity>
+
+ <entity class="org.drools.grid.service.directory.impl.GridServiceDescriptionImpl" access="FIELD">
+ <table name="GridServiceDescription"/>
+
+ <attributes>
+ <id name="id" />
+ <one-to-many name="addresses" mapped-by="gridServiceDescription" target-entity="org.drools.grid.service.directory.impl.AddressImpl" fetch="EAGER" >
+ <map-key name="transport" />
+ <cascade>
+ <cascade-all/>
+ </cascade>
+ </one-to-many>
+
+ </attributes>
+ </entity>
+
+ <entity class="org.drools.grid.timer.impl.ScheduledJob" access="FIELD">
+ <table name="ScheduledJob"/>
+
+ <attributes>
+ <id name="id" />
+ <transient name="jobHandle" />
+ </attributes>
+ </entity>
+</entity-mappings>
Property changes on: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/META-INF/orm.xml
___________________________________________________________________
Added: svn:executable
+ *
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/META-INF/persistence.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/META-INF/persistence.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/META-INF/persistence.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
+ <persistence-unit name="org.drools.grid">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <class>org.drools.grid.service.directory.impl.GridServiceDescriptionImpl</class>
+ <class>org.drools.grid.service.directory.impl.AddressImpl</class>
+ <class>java.lang.String</class>
+ <class>org.drools.grid.timer.impl.ScheduledJob</class>
+ <properties>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
+ <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
+ <property name="hibernate.connection.url" value="jdbc:h2:mem:mydb"/>
+ <!--property name="hibernate.connection.url" value="jdbc:h2:file:/h2/test;AUTO_SERVER=TRUE" /-->
+ <!-- property name="hibernate.connection.url" value="jdbc:h2:file:\dev\drools\trunk7\jbpm-process\jbpm-human-task\mydb"/ -->
+ <!-- <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>-->
+ <!-- <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/> -->
+ <!-- <property name="hibernate.connection.url" value="jdbc:postgresql://localhost/postgres"/>-->
+ <property name="hibernate.connection.username" value="sa"/>
+ <property name="hibernate.connection.password" value="sasa"/>
+ <property name="hibernate.connection.autocommit" value="false"/>
+ <property name="hibernate.max_fetch_depth" value="3"/>
+ <property name="hibernate.hbm2ddl.auto" value="create"/>
+ <property name="hibernate.show_sql" value="true"/>
+ </properties>
+ </persistence-unit>
+</persistence>
Property changes on: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/META-INF/persistence.xml
___________________________________________________________________
Added: svn:executable
+ *
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/beans.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/beans.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/beans.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"
+ default-autowire="byName">
+
+
+ <!-- loads the kbases and ksessions into the ApplicationContext -->
+ <import resource="classpath:knowledge-services.xml" />
+
+ <!-- Builds the routes that makes the ksessesions available as services -->
+ <import resource="classpath:camel-server.xml" />
+
+</beans>
\ No newline at end of file
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/camel-client.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/camel-client.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/camel-client.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+
+ <!-- Leave this, as it's needed to make Camel "drools" aware -->
+ <bean id="droolsPolicy" class="org.drools.camel.component.DroolsPolicy" />
+
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+
+ <route>
+ <from uri="direct://kservice"/>
+ <policy ref="droolsPolicy">
+ <to uri="cxfrs://http://localhost:8080/drools-server-app/kservice/rest"/>
+ </policy>
+ </route>
+
+ </camelContext>
+
+</beans>
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/camel-server-grid.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/camel-server-grid.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/camel-server-grid.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
+
+ <!--
+ ! If you are running on JBoss you will need to copy a camel-jboss.jar into the lib and set this classloader configuration
+ | http://camel.apache.org/camel-jboss.html
+ <bean id="jbossResolver" class="org.apache.camel.jboss.JBossPackageScanClassResolver"/>
+ -->
+
+ <!--
+ ! Define the server end point.
+ ! Copy and paste this element, changing id and the address, to expose services on different urls.
+ ! Different Camel routes can handle different end point paths.
+ -->
+ <cxf:rsServer id="rsServer"
+ address="/rest"
+ serviceClass="org.drools.jax.rs.CommandExecutorImpl">
+ <cxf:providers>
+ <bean class="org.drools.jax.rs.CommandMessageBodyReader"/>
+ </cxf:providers>
+ </cxf:rsServer>
+
+ <cxf:cxfEndpoint id="soapServer"
+ address="/soap"
+ serviceName="ns:CommandExecutor"
+ endpointName="ns:CommandExecutorPort"
+ wsdlURL="soap.wsdl"
+ xmlns:ns="http://soap.jax.drools.org/" >
+ <cxf:properties>
+ <entry key="dataFormat" value="MESSAGE"/>
+ <entry key="defaultOperationName" value="execute"/>
+ </cxf:properties>
+ </cxf:cxfEndpoint>
+
+ <!-- Leave this, as it's needed to make Camel "drools" aware -->
+ <bean id="droolsPolicy" class="org.drools.camel.component.DroolsPolicy" />
+
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <!--
+ ! Routes incoming messages from end point id="rsServer".
+ ! Example route unmarshals the messages with xstream and executes against ksession1.
+ ! Copy and paste this element, changing marshallers and the 'to' uri, to target different sessions, as needed.
+ !-->
+
+ <route>
+ <from uri="cxfrs://bean://rsServer"/>
+ <policy ref="droolsPolicy">
+ <unmarshal ref="xstream" />
+ <to uri="drools:node1" />
+ <marshal ref="xstream" />
+ </policy>
+ </route>
+
+ <route>
+ <from uri="cxf://bean://soapServer"/>
+ <policy ref="droolsPolicy">
+ <unmarshal ref="xstream" />
+ <to uri="drools:node1" />
+ <marshal ref="xstream" />
+ </policy>
+ </route>
+
+ </camelContext>
+
+</beans>
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/camel-server.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/camel-server.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/camel-server.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
+
+ <!--
+ ! If you are running on JBoss you will need to copy a camel-jboss.jar into the lib and set this classloader configuration
+ | http://camel.apache.org/camel-jboss.html
+ <bean id="jbossResolver" class="org.apache.camel.jboss.JBossPackageScanClassResolver"/>
+ -->
+
+ <!--
+ ! Define the server end point.
+ ! Copy and paste this element, changing id and the address, to expose services on different urls.
+ ! Different Camel routes can handle different end point paths.
+ -->
+ <cxf:rsServer id="rsServer"
+ address="/rest"
+ serviceClass="org.drools.jax.rs.CommandExecutorImpl">
+ <cxf:providers>
+ <bean class="org.drools.jax.rs.CommandMessageBodyReader"/>
+ </cxf:providers>
+ </cxf:rsServer>
+
+ <cxf:cxfEndpoint id="soapServer"
+ address="/soap"
+ serviceName="ns:CommandExecutor"
+ endpointName="ns:CommandExecutorPort"
+ wsdlURL="soap.wsdl"
+ xmlns:ns="http://soap.jax.drools.org/" >
+ <cxf:properties>
+ <entry key="dataFormat" value="MESSAGE"/>
+ <entry key="defaultOperationName" value="execute"/>
+ </cxf:properties>
+ </cxf:cxfEndpoint>
+
+ <!-- Leave this, as it's needed to make Camel "drools" aware -->
+ <bean id="droolsPolicy" class="org.drools.camel.component.DroolsPolicy" />
+
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <!--
+ ! Routes incoming messages from end point id="rsServer".
+ ! Example route unmarshals the messages with xstream and executes against ksession1.
+ ! Copy and paste this element, changing marshallers and the 'to' uri, to target different sessions, as needed.
+ !-->
+
+ <route>
+ <from uri="cxfrs://bean://rsServer"/>
+ <policy ref="droolsPolicy">
+ <unmarshal ref="xstream" />
+ <to uri="drools:node1/ksession1" />
+ <marshal ref="xstream" />
+ </policy>
+ </route>
+
+ <route>
+ <from uri="cxf://bean://soapServer"/>
+ <policy ref="droolsPolicy">
+ <unmarshal ref="xstream" />
+ <to uri="drools:node1/ksession1" />
+ <marshal ref="xstream" />
+ </policy>
+ </route>
+
+ </camelContext>
+
+</beans>
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/knowledge-services-grid.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/knowledge-services-grid.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/knowledge-services-grid.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:drools="http://drools.org/schema/drools-spring"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://drools.org/schema/drools-spring http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring-1.2.0.xsd">
+
+ <bean id="ds" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+ <!-- org.h2.jdbcx.JdbcDataSource -->
+ <property name="driverClassName" value="org.h2.Driver" />
+ <property name="url" value="jdbc:h2:mem:mydb" />
+ <property name="username" value="sa" />
+ <property name="password" value="" />
+ </bean>
+
+ <bean id="myEmf" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
+ <property name="persistenceUnitName" value="org.drools.grid"/>
+ </bean>
+
+ <bean id="shared-map" class="java.util.HashMap" />
+
+ <bean id="localWhitePages" class="org.drools.grid.service.directory.impl.WhitePagesImpl" />
+
+ <drools:grid id="grid1">
+ <drools:core-services ref="shared-map" />
+
+ <drools:whitepages>
+ <drools:jpa-persistence>
+ <drools:entity-manager-factory ref="myEmf" />
+ </drools:jpa-persistence>
+ </drools:whitepages>
+
+ <drools:socket-service acceptor="mina" ip="127.0.0.1">
+ <drools:service name="org.drools.grid.service.directory.WhitePages" port="8000" />
+ </drools:socket-service>
+ </drools:grid>
+
+ <drools:grid id="grid2">
+ <drools:core-services ref="shared-map" />
+ </drools:grid>
+
+ <drools:grid-node id="node1" grid="grid1">
+ <drools:socket-service port="8000" />
+ </drools:grid-node>
+
+ <drools:kbase id="kbase1" node="node1">
+ <drools:resources>
+ <drools:resource type="DRL" source="classpath:test.drl"/>
+ </drools:resources>
+ </drools:kbase>
+
+ <drools:ksession id="ksession3" type="stateful" kbase="kbase1" node="node1"/>
+
+
+
+</beans>
\ No newline at end of file
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/knowledge-services.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/knowledge-services.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/knowledge-services.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:drools="http://drools.org/schema/drools-spring"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://drools.org/schema/drools-spring org/drools/container/spring/drools-spring-1.2.0.xsd">
+
+ <drools:grid-node id="node1" />
+
+ <drools:kbase id="kbase1" node="node1">
+ <drools:resources>
+ <drools:resource type="DRL" source="classpath:test.drl"/>
+ </drools:resources>
+ </drools:kbase>
+
+ <drools:ksession id="ksession1" type="stateless" kbase="kbase1" node="node1"/>
+
+</beans>
\ No newline at end of file
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/soap.wsdl
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/soap.wsdl (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/soap.wsdl 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="CommandExecutor" targetNamespace="http://soap.jax.drools.org/" xmlns:ns1="http://cxf.apache.org/bindings/xformat" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://soap.jax.drools.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://soap.jax.drools.org/" xmlns:tns="http://soap.jax.drools.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+<xsd:element name="execute" type="tns:execute"/>
+<xsd:complexType name="execute">
+<xsd:sequence>
+<xsd:element minOccurs="0" name="arg0"/>
+</xsd:sequence>
+</xsd:complexType>
+<xsd:element name="executeResponse" type="tns:executeResponse"/>
+<xsd:complexType name="executeResponse">
+<xsd:sequence>
+<xsd:element minOccurs="0" name="return" type="xsd:anyType"/>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="execute">
+ <wsdl:part element="tns:execute" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="executeResponse">
+ <wsdl:part element="tns:executeResponse" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="CommandExecutorPortType">
+ <wsdl:operation name="execute">
+ <wsdl:input message="tns:execute" name="execute">
+ </wsdl:input>
+ <wsdl:output message="tns:executeResponse" name="executeResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CommandExecutorSoapBinding" type="tns:CommandExecutorPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="execute">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="execute">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="executeResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CommandExecutor">
+ <wsdl:port binding="tns:CommandExecutorSoapBinding" name="CommandExecutorPort">
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/test.drl
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/test.drl (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/resources/test.drl 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.test
+
+declare Message
+ text : String
+end
+
+
+rule "echo" dialect "mvel"
+when
+ $m : Message()
+then
+ $m.text = "echo:" + $m.text;
+end
\ No newline at end of file
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/webapp/WEB-INF/web.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/webapp/WEB-INF/web.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,30 @@
+<web-app>
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>classpath:beans.xml</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>
+ org.springframework.web.context.ContextLoaderListener
+ </listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <display-name>CXF Servlet</display-name>
+ <servlet-class>
+ org.apache.cxf.transport.servlet.CXFServlet
+ </servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/kservice/*</url-pattern>
+ </servlet-mapping>
+
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+</web-app>
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/webapp/index.jsp
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/webapp/index.jsp (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/webapp/index.jsp 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,9 @@
+<%@ page contentType="text/html; charset=UTF-8" %>
+<html>
+ <head>
+ <title>Drools execution server</title>
+ </head>
+ <body>
+ <h1>Execution server is running</h1>
+ </body>
+</html>
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/webapp/test.jsp
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/webapp/test.jsp (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/main/webapp/test.jsp 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,24 @@
+<%@ page contentType="text/html; charset=UTF-8" %>
+<html>
+ <head>
+ <title>Test Server</title>
+ </head>
+ <body>
+ <h1>Sending Test Message</h1>
+ <%
+ org.drools.server.Test test = new org.drools.server.Test();
+ String msg = request.getParameter("msg");
+
+ if ( msg == null ) {
+ msg = "Hello World";
+ }
+ %>
+
+ Sending Message: "<%=msg%>"
+ </br>
+ <%
+ String res = test.send( msg );
+ %>
+ Response: "<%=res%>"
+ </body>
+</html>
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/drools/server/CxfRsClientServerTest.java
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/drools/server/CxfRsClientServerTest.java (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/drools/server/CxfRsClientServerTest.java 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.server;
+
+import org.apache.camel.CamelContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.junit.Assert.*;
+
+public class CxfRsClientServerTest {
+
+ @org.junit.Test
+ public void test1() throws Exception {
+ ClassPathXmlApplicationContext springContext = new ClassPathXmlApplicationContext( "classpath:beans-test.xml" );
+
+ String cmd = "";
+ cmd += "<batch-execution lookup=\"ksession1\">\n";
+ cmd += " <insert out-identifier=\"message\">\n";
+ cmd += " <org.test.Message>\n";
+ cmd += " <text>Hello World</text>\n";
+ cmd += " </org.test.Message>\n";
+ cmd += " </insert>\n";
+ cmd += "</batch-execution>\n";
+
+ Test test = new Test();
+ String response = test.execute( cmd,
+ (CamelContext) springContext.getBean( "camel-client-ctx" ) );
+
+ assertTrue( response.contains( "execution-results" ) );
+ assertTrue( response.contains( "echo" ) );
+ springContext.stop();
+ }
+
+}
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/drools/server/CxfSoapClientServerGridTest.java
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/drools/server/CxfSoapClientServerGridTest.java (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/drools/server/CxfSoapClientServerGridTest.java 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,171 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.server;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.apache.camel.CamelContext;
+import org.drools.KnowledgeBase;
+import org.drools.KnowledgeBaseFactoryService;
+import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderError;
+import org.drools.builder.KnowledgeBuilderErrors;
+import org.drools.builder.KnowledgeBuilderFactoryService;
+import org.drools.builder.ResourceType;
+import org.drools.grid.ConnectionFactoryService;
+import org.drools.grid.GridConnection;
+import org.drools.grid.GridNode;
+import org.drools.grid.GridServiceDescription;
+import org.drools.grid.SocketService;
+import org.drools.grid.impl.GridImpl;
+import org.drools.grid.service.directory.WhitePages;
+import org.drools.io.impl.ByteArrayResource;
+import org.drools.runtime.StatefulKnowledgeSession;
+import org.junit.Ignore;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.junit.Assert.*;
+
+public class CxfSoapClientServerGridTest {
+
+ @org.junit.Test @Ignore
+ public void test1() throws Exception {
+ ClassPathXmlApplicationContext springContext = new ClassPathXmlApplicationContext( "classpath:beans-test-grid.xml" );
+
+ SOAPMessage soapMessage = createMessageForKsession("ksession3");
+
+ Test test = new Test();
+ String response = test.execute( soapMessage,
+ (CamelContext) springContext.getBean( "camel-client-ctx" ) );
+
+ //System.out.println("Response 1 = "+ response );
+ assertTrue( response.contains( "execution-results" ) );
+ assertTrue( response.contains( "echo" ) );
+
+
+ GridImpl grid2 = (GridImpl) springContext.getBean("grid2");
+ GridServiceDescription<GridNode> n1Gsd = grid2.get( WhitePages.class ).lookup( "node1" );
+ GridConnection<GridNode> conn = grid2.get( ConnectionFactoryService.class ).createConnection( n1Gsd );
+ GridNode remoteN1 = conn.connect();
+
+ KnowledgeBuilder kbuilder = remoteN1.get( KnowledgeBuilderFactoryService.class ).newKnowledgeBuilder();
+
+ assertNotNull( kbuilder );
+
+ String rule = "package org.grid.test\n"
+ + "declare Message2\n"
+ + "text : String\n"
+ + "end\n"
+ + "rule \"echo2\" \n"
+ + "dialect \"mvel\"\n"
+ + "when\n"
+ + " $m : Message2()\n"
+ + "then\n"
+ + "$m.text = \"echo2:\" + $m.text;\n"
+ + "end\n";
+ //System.out.println("Rule = "+rule);
+ kbuilder.add( new ByteArrayResource( rule.getBytes() ),
+ ResourceType.DRL );
+
+ KnowledgeBuilderErrors errors = kbuilder.getErrors();
+ if ( errors != null && errors.size() > 0 ) {
+ for ( KnowledgeBuilderError error : errors ) {
+ System.out.println( "Error: " + error.getMessage() );
+
+ }
+ fail("KnowledgeBase did not build");
+ }
+
+ KnowledgeBase kbase = remoteN1.get( KnowledgeBaseFactoryService.class ).newKnowledgeBase();
+
+ assertNotNull( kbase );
+
+ kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
+
+ StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();
+
+ assertNotNull( session );
+
+
+ remoteN1.set("ksession2", session);
+
+
+ soapMessage = createMessageForKsession("ksession2");
+
+ String response2 = test.execute( soapMessage,
+ (CamelContext) springContext.getBean( "camel-client-ctx" ) );
+
+ //System.out.println("Response 2 = "+response2 );
+ assertTrue( response2.contains( "execution-results" ) );
+ assertTrue( response2.contains( "echo2" ) );
+
+ remoteN1.dispose();
+ GridImpl grid1 = (GridImpl) springContext.getBean("grid1");
+ grid1.get(SocketService.class).close();
+
+ springContext.registerShutdownHook();
+ springContext.stop();
+
+ }
+
+ private SOAPMessage createMessageForKsession(String ksessionName) throws SOAPException{
+
+ SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
+ SOAPBody body = soapMessage.getSOAPPart().getEnvelope().getBody();
+ QName payloadName = new QName( "http://soap.jax.drools.org",
+ "execute",
+ "ns1" );
+
+ body.addBodyElement( payloadName );
+ String add="";
+ String packages = "org.test";
+ if(ksessionName.equals("ksession2")){
+ add="2";
+ packages = "org.grid.test";
+ }
+ String cmd = "";
+ cmd += "<batch-execution lookup=\""+ksessionName+"\">\n";
+ cmd += " <insert out-identifier=\"message\">\n";
+ cmd += " <"+packages+".Message"+add+">\n";
+ cmd += " <text>Helllo World"+ksessionName+"</text>\n";
+ cmd += " </"+packages+".Message"+add+">\n";
+ cmd += " </insert>\n";
+ cmd += " <fire-all-rules/>\n";
+ cmd += "</batch-execution>\n";
+
+ body.addTextNode( cmd );
+ OutputStream os = new ByteArrayOutputStream();
+ try {
+ soapMessage.writeTo(os);
+ } catch (IOException ex) {
+ Logger.getLogger(CxfSoapClientServerGridTest.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ //System.out.println("SOAP = "+os.toString());
+ return soapMessage;
+
+ }
+
+}
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/drools/server/CxfSoapClientServerTest.java
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/drools/server/CxfSoapClientServerTest.java (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/java/org/drools/server/CxfSoapClientServerTest.java 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,63 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.server;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPMessage;
+
+import org.apache.camel.CamelContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.junit.Assert.*;
+
+public class CxfSoapClientServerTest {
+
+ @org.junit.Test
+ public void test1() throws Exception {
+ ClassPathXmlApplicationContext springContext = new ClassPathXmlApplicationContext( "classpath:beans-test.xml" );
+
+ SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
+ SOAPBody body = soapMessage.getSOAPPart().getEnvelope().getBody();
+ QName payloadName = new QName( "http://soap.jax.drools.org",
+ "execute",
+ "ns1" );
+
+ body.addBodyElement( payloadName );
+
+ String cmd = "";
+ cmd += "<batch-execution lookup=\"ksession1\">\n";
+ cmd += " <insert out-identifier=\"message\">\n";
+ cmd += " <org.test.Message>\n";
+ cmd += " <text>Helllo World</text>\n";
+ cmd += " </org.test.Message>\n";
+ cmd += " </insert>\n";
+ cmd += "</batch-execution>\n";
+
+ body.addTextNode( cmd );
+
+ Test test = new Test();
+ String response = test.execute( soapMessage,
+ (CamelContext) springContext.getBean( "camel-client-ctx" ) );
+
+ assertTrue( response.contains( "execution-results" ) );
+ assertTrue( response.contains( "echo" ) );
+ springContext.stop();
+ }
+
+}
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/beans-test-grid.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/beans-test-grid.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/beans-test-grid.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xmlns:drools="http://drools.org/schema/drools-spring"
+ xsi:schemaLocation="
+ http://drools.org/schema/drools-spring org/drools/container/spring/drools-spring-1.2.0.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <import resource="classpath:knowledge-services-grid.xml" />
+
+ <import resource="classpath:camel-embedded-server-test-grid.xml" />
+
+ <import resource="classpath:camel-client-test.xml" />
+
+</beans>
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/beans-test.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/beans-test.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/beans-test.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xmlns:drools="http://drools.org/schema/drools-spring"
+ xsi:schemaLocation="
+ http://drools.org/schema/drools-spring org/drools/container/spring/drools-spring-1.2.0.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <import resource="classpath:knowledge-services.xml" />
+
+ <import resource="classpath:camel-embedded-server-test.xml" />
+
+ <import resource="classpath:camel-client-test.xml" />
+
+</beans>
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/camel-client-test.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/camel-client-test.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/camel-client-test.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+
+ <!-- Leave this, as it's needed to make Camel "drools" aware -->
+ <bean id="droolsPolicy" class="org.drools.camel.component.DroolsPolicy" />
+
+ <camelContext id="camel-client-ctx" xmlns="http://camel.apache.org/schema/spring">
+
+ <route>
+ <from uri="direct://kservice/rest"/>
+ <policy ref="droolsPolicy">
+ <to uri="cxfrs://http://localhost:9002/rest"/>
+ </policy>
+ </route>
+
+ <route>
+ <from uri="direct://kservice/soap"/>
+ <policy ref="droolsPolicy">
+ <to uri="cxf://bean://soapServer"/>
+ </policy>
+ </route>
+
+ </camelContext>
+
+</beans>
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/camel-embedded-server-test-grid.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/camel-embedded-server-test-grid.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/camel-embedded-server-test-grid.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml"/>
+
+ <cxf:rsServer id="rsServer"
+ address="http://localhost:9002/rest"
+ serviceClass="org.drools.jax.rs.CommandExecutorImpl">
+ <cxf:providers>
+ <bean class="org.drools.jax.rs.CommandMessageBodyReader"/>
+ </cxf:providers>
+ </cxf:rsServer>
+
+ <cxf:cxfEndpoint id="soapServer"
+ address="http://localhost:9002/soap"
+ serviceName="ns:CommandExecutor"
+ endpointName="ns:CommandExecutorPort"
+ wsdlURL="soap.wsdl"
+ xmlns:ns="http://soap.jax.drools.org/" >
+ <cxf:properties>
+ <entry key="dataFormat" value="MESSAGE"/>
+ <entry key="defaultOperationName" value="execute"/>
+ </cxf:properties>
+ </cxf:cxfEndpoint>
+
+ <!-- Leave this, as it's needed to make Camel "drools" aware -->
+ <bean id="droolsPolicy" class="org.drools.camel.component.DroolsPolicy" />
+
+ <camelContext id="camel-server-ctx" xmlns="http://camel.apache.org/schema/spring">
+
+
+ <route>
+ <from uri="cxfrs://bean://rsServer"/>
+ <policy ref="droolsPolicy">
+ <unmarshal ref="xstream" />
+ <to uri="drools:node1" />
+ <marshal ref="xstream" />
+ </policy>
+ </route>
+
+ <route>
+ <from uri="cxf://bean://soapServer"/>
+ <policy ref="droolsPolicy">
+ <unmarshal ref="xstream" />
+ <to uri="drools:node1" />
+ <marshal ref="xstream" />
+ </policy>
+ </route>
+
+ </camelContext>
+
+</beans>
Added: labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/camel-embedded-server-test.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/camel-embedded-server-test.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-server/src/test/resources/camel-embedded-server-test.xml 2011-02-24 17:53:00 UTC (rev 36712)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml"/>
+
+ <cxf:rsServer id="rsServer"
+ address="http://localhost:9002/rest"
+ serviceClass="org.drools.jax.rs.CommandExecutorImpl">
+ <cxf:providers>
+ <bean class="org.drools.jax.rs.CommandMessageBodyReader"/>
+ </cxf:providers>
+ </cxf:rsServer>
+
+ <cxf:cxfEndpoint id="soapServer"
+ address="http://localhost:9002/soap"
+ serviceName="ns:CommandExecutor"
+ endpointName="ns:CommandExecutorPort"
+ wsdlURL="soap.wsdl"
+ xmlns:ns="http://soap.jax.drools.org/" >
+ <cxf:properties>
+ <entry key="dataFormat" value="MESSAGE"/>
+ <entry key="defaultOperationName" value="execute"/>
+ </cxf:properties>
+ </cxf:cxfEndpoint>
+
+ <!-- Leave this, as it's needed to make Camel "drools" aware -->
+ <bean id="droolsPolicy" class="org.drools.camel.component.DroolsPolicy" />
+
+ <camelContext id="camel-server-ctx" xmlns="http://camel.apache.org/schema/spring">
+
+ <route>
+ <from uri="cxfrs://bean://rsServer"/>
+ <policy ref="droolsPolicy">
+ <unmarshal ref="xstream" />
+ <to uri="drools:node1/ksession1" />
+ <marshal ref="xstream" />
+ </policy>
+ </route>
+
+ <route>
+ <from uri="cxf://bean://soapServer"/>
+ <policy ref="droolsPolicy">
+ <unmarshal ref="xstream" />
+ <to uri="drools:node1/ksession1" />
+ <marshal ref="xstream" />
+ </policy>
+ </route>
+
+ </camelContext>
+
+</beans>
More information about the jboss-svn-commits
mailing list