From 4a5a00863f30319cd09a07a66dd8199952c21d9b Mon Sep 17 00:00:00 2001 From: esteban-aliverti Date: Thu, 23 May 2013 10:01:04 +0200 Subject: [PATCH] - Added profiles section and resource filtering to pom.xml - agent name and endpoint information can be now configured in pom.xml - database information can be now configured in pom.xml - Modified generated test to actually inform a fact to the agent --- .../resources/archetype-resources/pom.xml | 63 +++++++++++++++++++ .../resources/META-INF/applicationContext.xml | 20 +++--- .../src/main/resources/META-INF/orm.xml | 40 ++++++++++++ .../main/resources/META-INF/persistence.xml | 22 +++++++ .../KnowledgeResourcesCompilationTest.java | 9 ++- 5 files changed, 143 insertions(+), 11 deletions(-) create mode 100644 drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/orm.xml create mode 100644 drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml diff --git a/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/pom.xml b/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/pom.xml index 6422f39..f5e19a5 100644 --- a/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/pom.xml +++ b/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/pom.xml @@ -28,6 +28,51 @@ UTF-8 + + + + dev + + true + + + org.h2.Driver + jdbc:h2:tcp://localhost/~/mydb + sa + sasa + org.hibernate.dialect.H2Dialect + + ${agent-name} + ${agent-name}-localnode + 8000 + localhost + 8081 + + + + local + + com.mysql.jdbc.Driver + jdbc:mysql://localhost:3306/drools-grid-ra + root + root + org.hibernate.dialect.MySQL5Dialect + + ${agent-name} + ${agent-name}-localnode + 8000 + localhost + 8081 + + + + mysql + mysql-connector-java + 5.1.25 + + + + @@ -90,6 +135,12 @@ 1.3.162 test + + org.drools.mas + drools-mas-generic-client + ${project.version} + test + ${agent-name} @@ -104,5 +155,17 @@ + + + src/main/resources + true + + + src/test/java + true + ../filtered-sources/test/java + + + target/filtered-sources/test/java diff --git a/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/applicationContext.xml b/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/applicationContext.xml index 05c41e2..e6e1bfc 100644 --- a/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/applicationContext.xml +++ b/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/applicationContext.xml @@ -10,11 +10,11 @@ http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> @@ -26,21 +26,21 @@ http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> - + - + - - + + - - + + - + @@ -49,7 +49,7 @@ http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> - + diff --git a/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/orm.xml b/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/orm.xml new file mode 100644 index 0000000..d1ae833 --- /dev/null +++ b/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/orm.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + diff --git a/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml b/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..e7fd3b0 --- /dev/null +++ b/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,22 @@ + + + + org.hibernate.ejb.HibernatePersistence + org.drools.grid.service.directory.impl.GridServiceDescriptionImpl + org.drools.grid.service.directory.impl.AddressImpl + org.drools.grid.timer.impl.ScheduledJob + java.lang.String + + + + + + + + + + + + + + diff --git a/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/test/java/KnowledgeResourcesCompilationTest.java b/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/test/java/KnowledgeResourcesCompilationTest.java index bbc09f6..e2ba87d 100644 --- a/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/test/java/KnowledgeResourcesCompilationTest.java +++ b/drools-mas-agent-web-archetype/src/main/resources/archetype-resources/src/test/java/KnowledgeResourcesCompilationTest.java @@ -6,6 +6,7 @@ import java.sql.SQLException; import org.drools.mas.core.DroolsAgent; +import org.drools.mas.helpers.DialogueHelper; import org.h2.tools.DeleteDbFiles; import org.h2.tools.Server; import org.junit.*; @@ -59,13 +60,19 @@ public void tearDown() { * initialized correctly */ @Test - public void compilationTest() { + public void compilationTest() throws InterruptedException { ApplicationContext context = new ClassPathXmlApplicationContext("META-INF/applicationContext.xml"); DroolsAgent agent = (DroolsAgent) context.getBean("agent"); assertNotNull(agent); + DialogueHelper helper = new DialogueHelper("http://${agent.endpoint.ip}:${agent.endpoint.port}/${agent.name}/services/AsyncAgentService?wsdl"); + + helper.invokeInform("me", "you", "Hello World!", null); + + Thread.sleep(3000); + agent.dispose(); }