incubator-hise-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r.@apache.org
Subject svn commit: r987241 [4/4] - in /incubator/hise/trunk: ./ hise-bundle/src/main/resources/META-INF/spring/ hise-services/src/main/java/org/apache/hise/api/ hise-services/src/main/java/org/apache/hise/engine/ hise-services/src/main/java/org/apache/hise/en...
Date Thu, 19 Aug 2010 17:37:40 GMT
Modified: incubator/hise/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/pom.xml?rev=987241&r1=987240&r2=987241&view=diff
==============================================================================
--- incubator/hise/trunk/pom.xml (original)
+++ incubator/hise/trunk/pom.xml Thu Aug 19 17:37:40 2010
@@ -29,6 +29,7 @@
 		<module>hise-test-example-osgi</module>  
 		<module>hise-wsdl-classes</module>
 		<module>hise-services</module>
+		<module>rtests</module>
         <module>hise-web</module>
         <module>hise-bundle</module>
         <module>hise-karaf</module>

Modified: incubator/hise/trunk/rtests/src/test/java/org/apache/hise/TaskTestBase.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/rtests/src/test/java/org/apache/hise/TaskTestBase.java?rev=987241&r1=987240&r2=987241&view=diff
==============================================================================
--- incubator/hise/trunk/rtests/src/test/java/org/apache/hise/TaskTestBase.java (original)
+++ incubator/hise/trunk/rtests/src/test/java/org/apache/hise/TaskTestBase.java Thu Aug 19
17:37:40 2010
@@ -2,7 +2,9 @@ package org.apache.hise;
 
 import javax.xml.namespace.QName;
 import org.apache.hise.api.Handler;
+import org.apache.hise.api.Management;
 import org.junit.runner.RunWith;
+import org.springframework.orm.jpa.JpaTransactionManager;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.apache.hise.engine.HISEEngineImpl;
@@ -33,6 +35,12 @@ public abstract class TaskTestBase {
 
     @Autowired
     public ApplicationContext applicationContext = null;
+    
+    @Autowired
+    public Management management;
+    
+    @Autowired
+	protected JpaTransactionManager transactionManager;
 
     private ClassPathXmlApplicationContext innerCtx = null;
 

Added: incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/ManagementApiTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/ManagementApiTest.java?rev=987241&view=auto
==============================================================================
--- incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/ManagementApiTest.java
(added)
+++ incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/ManagementApiTest.java
Thu Aug 19 17:37:40 2010
@@ -0,0 +1,111 @@
+package org.apache.hise.managementApi;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+
+import org.apache.hise.TaskTestBase;
+import org.apache.hise.dao.HISEDao;
+import org.apache.hise.dao.OrgEntity;
+import org.apache.hise.dao.Task.Status;
+import org.apache.hise.dao.TaskOrgEntity.OrgEntityType;
+import org.apache.hise.engine.wsdl.IllegalAccessFault;
+import org.apache.hise.engine.wsdl.IllegalArgumentFault;
+import org.apache.hise.engine.wsdl.IllegalStateFault;
+import org.apache.hise.engine.wsdl.RecipientNotAllowed;
+import org.apache.hise.lang.xsd.htdt.GetTaskInfoResponseDocument;
+import org.apache.hise.runtime.Task;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.TransactionCallback;
+import org.springframework.transaction.support.TransactionTemplate;
+
+public class ManagementApiTest extends TaskTestBase {
+
+	
+    private Task task = null;
+    
+  
+
+  @Before
+    public void setUp() throws Exception {
+        init("test-example/test.xml");
+        task = getTask("test-example/approveHeader.xml", "test-example/approveBody.xml",
new QName("http://www.insurance.example.com/claims", "Task1"));
+        TransactionTemplate tt = new TransactionTemplate(transactionManager);
+        addUserInTranscaction(tt,task.getTaskDto().getActualOwner(), hiseEngine.getHiseDao());
+        //addUserInTranscaction(tt,new String("user"), hiseEngine.getHiseDao());
+    }
+
+    @Test
+    public void testStartStopRelease() throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault{
+    Long id= task.getTaskDto().getId();
+			
+    	management.start(id.toString(), task.getTaskDto().getActualOwner());
+		Status status=task.getTaskDto().getStatus();
+		System.out.println("------start:stan"+task.getTaskDto().getStatus());
+		Assert.assertEquals(status, Status.IN_PROGRESS);
+
+		management.stop(id.toString(), task.getTaskDto().getActualOwner());
+		System.out.println("------stop:stan"+task.getTaskDto().getStatus());
+		Assert.assertEquals(task.getTaskDto().getStatus(), Status.RESERVED);
+		
+		management.release(id, task.getTaskDto().getActualOwner());
+		Assert.assertEquals(Status.READY, task.getTaskDto().getStatus());
+		
+		
+    }
+    
+    @Test
+    public void testGetTaskInfo() throws IllegalArgumentFault{
+    	Long id= task.getTaskDto().getId();
+    	GetTaskInfoResponseDocument response=management.getTaskInfo(id);
+    	Assert.assertEquals(task.getTaskDto().getActualOwner(),response.getGetTaskInfoResponse().getTask().getActualOwner());
+    	
+    }
+    
+    @Test
+    public void testDelegate() throws RecipientNotAllowed, IllegalStateFault, IllegalArgumentFault,
IllegalAccessFault{
+    	Long id= task.getTaskDto().getId();
+    	management.start(id.toString(), task.getTaskDto().getActualOwner());
+    	Assert.assertEquals(task.getTaskDto().getStatus(), Status.IN_PROGRESS);
+    	addUser(new String("newUser"));
+    	
+    	List<String> users= new ArrayList<String>();
+    	users.add(new String("newUser"));
+    	management.delegate(id.toString(), users,new ArrayList<String>());
+    	Assert.assertEquals(new String("newUser"), task.getTaskDto().getActualOwner());
+    
+    }
+    
+    private void addUser(String name){
+    	TransactionTemplate tt = new TransactionTemplate(transactionManager);
+    	addUserInTranscaction(tt,name, hiseEngine.getHiseDao());
+    }
+    
+    public void addUserInTranscaction(TransactionTemplate tt,final String name, final HISEDao
hiseDao){
+   	 tt.execute(new TransactionCallback() {
+           public Object doInTransaction(TransactionStatus arg0) {
+               try {
+   
+            	   OrgEntity user = new OrgEntity();
+
+                       user.setName(name);
+                       user.setType(OrgEntityType.USER);
+                       user.setUserPassword("pass");
+
+               		hiseDao.persist(user);
+               	
+               } catch (Exception e) {
+                   throw new RuntimeException(e);
+               }
+				return arg0;
+           }
+       });
+   }
+	
+}

Modified: incubator/hise/trunk/rtests/src/test/resources/hise-ctx.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/rtests/src/test/resources/hise-ctx.xml?rev=987241&r1=987240&r2=987241&view=diff
==============================================================================
--- incubator/hise/trunk/rtests/src/test/resources/hise-ctx.xml (original)
+++ incubator/hise/trunk/rtests/src/test/resources/hise-ctx.xml Thu Aug 19 17:37:40 2010
@@ -17,13 +17,13 @@
             <props>
                 <prop key="openjpa.db">H2</prop>
                 <prop key="openjpa.dictionary">org.apache.openjpa.jdbc.sql.H2Dictionary</prop>
-                <prop key="openjpa.synchronizeMappings">buildSchema(ForeignKeys=true,SchemaAction='a')</prop>
+                <prop key="openjpa.synchronizeMappings">buildSchema(ForeignKeys=true,SchemaAction='drop,add')</prop>
                 <prop key="openjpa.generateDdl">true</prop>
                 <prop key="openjpa.showSql">false</prop>
                 <prop key="openjpa.schema"></prop>
                 <prop key="db.driver">org.h2.Driver</prop>
-                <prop key="db.url">jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</prop>
-                <!--prop key="db.url">jdbc:h2:file:target/hise-h2-db;DB_CLOSE_ON_EXIT=false</prop-->
+                <!--prop key="db.url">jdbc:h2:mem:test</prop-->
+                <prop key="db.url">jdbc:h2:file:target/hise-h2-db;DB_CLOSE_ON_EXIT=false</prop>
                 <prop key="db.user">sa</prop>
                 <prop key="db.password"></prop>
                 <prop key="db.maxActive">4</prop>
@@ -91,11 +91,11 @@
     <property name="hiseDao" ref="hiseDao"/>
     <property name="hiseScheduler" ref="hiseScheduler"/>
     <property name="hiseUserDetails" ref="hiseUserDetails"/>
-    <!--property name="peopleQueryProviders">
+    <property name="peopleQueryProviders">
         <util:list>
-            <ref bean="TestPeopleQueryProvider"/>
+         
         </util:list>
-    </property-->
+    </property>
   </bean>
 
   <bean id="hiseUserDetails" class="org.apache.hise.engine.DefaultHISEUserDetails">
@@ -110,5 +110,14 @@
   <bean id="sender" class="org.apache.hise.MockSender"/>
 
   <bean id="handler" class="org.apache.hise.MockHandler"/>
+  
+  <bean id="management" class="org.apache.hise.engine.ManagementImpl">
+  	<property name="hiseEngine" ref="hiseEngine"/>
+  	<property name="adminOperations" ref="taskOperationsAdministrative"/>
+  </bean>
+  
+  <bean id="taskOperationsAdministrative" class="org.apache.hise.engine.jaxws.TaskOperationsAdministrativeImpl">
+    <property name="hiseEngine" ref="hiseEngine"/>
+  </bean>
 
 </beans>
\ No newline at end of file

Modified: incubator/hise/trunk/rtests/src/test/resources/test-example/testHtd1.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/rtests/src/test/resources/test-example/testHtd1.xml?rev=987241&r1=987240&r2=987241&view=diff
==============================================================================
--- incubator/hise/trunk/rtests/src/test/resources/test-example/testHtd1.xml (original)
+++ incubator/hise/trunk/rtests/src/test/resources/test-example/testHtd1.xml Thu Aug 19 17:37:40
2010
@@ -44,7 +44,7 @@ Business Machines Corporation, Oracle In
             
             <htd:documentation xml:lang="en-US">This task is used to handle claims
that require manual approval. </htd:documentation>
             <htd:interface portType="tns:ClaimsHandlingPT" operation="approve" responsePortType="tns:ClaimsHandlingCallbackPT"
responseOperation="approvalResponse"/>
-            <htd:priority> htd:getInput("ClaimApprovalRequest")/cla:prio </htd:priority>
+            <htd:priority> xs:integer(htd:getInput("ClaimApprovalRequest")/cla:prio)
</htd:priority>
             
             <htd:peopleAssignments>
             	<htd:potentialOwners>
@@ -105,7 +105,7 @@ Business Machines Corporation, Oracle In
                 
             </htd:peopleAssignments>
             
-            <htd:delegation potentialDelegatees="nobody"/>
+            <htd:delegation potentialDelegatees="anybody"/>
             
             <htd:presentationElements>
                 
@@ -170,6 +170,8 @@ Business Machines Corporation, Oracle In
       </htd:escalation>
     </htd:completionDeadline>
   </htd:deadlines>
+       
+        <htd:autoActivate>true</htd:autoActivate>
         </htd:task>    
         
         <!-- Two potential owners -->



Mime
View raw message