From hise-commits-return-160-apmail-incubator-hise-commits-archive=incubator.apache.org@incubator.apache.org Tue Jul 27 09:58:45 2010 Return-Path: Delivered-To: apmail-incubator-hise-commits-archive@minotaur.apache.org Received: (qmail 75173 invoked from network); 27 Jul 2010 09:58:45 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 27 Jul 2010 09:58:45 -0000 Received: (qmail 39662 invoked by uid 500); 27 Jul 2010 09:58:45 -0000 Delivered-To: apmail-incubator-hise-commits-archive@incubator.apache.org Received: (qmail 39645 invoked by uid 500); 27 Jul 2010 09:58:44 -0000 Mailing-List: contact hise-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hise-dev@incubator.apache.org Delivered-To: mailing list hise-commits@incubator.apache.org Received: (qmail 39637 invoked by uid 99); 27 Jul 2010 09:58:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Jul 2010 09:58:43 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Jul 2010 09:58:41 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D140F238899C; Tue, 27 Jul 2010 09:57:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r979627 - in /incubator/hise/trunk: hise-services/src/main/java/org/apache/hise/lang/ hise-services/src/test/java/org/apache/hise/ hise-services/src/test/resources/ itest/ Date: Tue, 27 Jul 2010 09:57:48 -0000 To: hise-commits@incubator.apache.org From: rr@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100727095748.D140F238899C@eris.apache.org> Author: rr Date: Tue Jul 27 09:57:48 2010 New Revision: 979627 URL: http://svn.apache.org/viewvc?rev=979627&view=rev Log: HISE-53: Comments Unit Test (thanks to Paweł Byszewski) Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/TaskDefinition.java incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java incubator/hise/trunk/hise-services/src/test/resources/dao.xml incubator/hise/trunk/itest/hise-soapui-project.xml incubator/hise/trunk/itest/task_history.xml Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/TaskDefinition.java URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/TaskDefinition.java?rev=979627&r1=979626&r2=979627&view=diff ============================================================================== --- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/TaskDefinition.java (original) +++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/TaskDefinition.java Tue Jul 27 09:57:48 2010 @@ -1,5 +1,4 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one +/* 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 Modified: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java?rev=979627&r1=979626&r2=979627&view=diff ============================================================================== --- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java (original) +++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java Tue Jul 27 09:57:48 2010 @@ -1,9 +1,19 @@ package org.apache.hise; +import java.sql.Connection; +import java.sql.ResultSet; import java.sql.Statement; +import java.util.ArrayList; import java.util.Date; import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.PersistenceException; +import javax.persistence.Query; +import javax.sql.DataSource; + import org.apache.hise.TaskCreationHelper.TaskType; import org.apache.hise.dao.Comment; import org.apache.hise.dao.GenericHumanRole; @@ -11,10 +21,14 @@ import org.apache.hise.dao.HISEDao; import org.apache.hise.dao.Job; import org.apache.hise.dao.OrgEntity; import org.apache.hise.dao.Task; +import org.apache.hise.dao.Task.Status; import org.apache.hise.dao.TaskQuery; import org.junit.Assert; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.datasource.DataSourceUtils; +import org.springframework.orm.jpa.JpaCallback; +import org.springframework.orm.jpa.JpaTemplate; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; @@ -161,7 +175,6 @@ public class DaoTest extends AbstractJUn try { cleanup(); Task t = hiseDao.find(Task.class, taskHelper.addTask(hiseDao)); - { Job j = new Job(); j.setFire(new Date(1213L)); @@ -196,4 +209,67 @@ public class DaoTest extends AbstractJUn }); Assert.assertEquals(new Integer(2), s); } + + @Test + public void testComments() throws Exception{ + + final int commentsCount=76; + final Long tid =generateAndAddComments(commentsCount); + + List result=executeSQL("SELECT * FROM HISE_COMMENT WHERE TASK_ID='"+tid.toString()+"'",Comment.class ); + + Assert.assertEquals(commentsCount, result.size()); + } + + private List executeSQL(final String query, final Class elementsClass){ + TransactionTemplate ttt = new TransactionTemplate(transactionManager); + Object result=ttt.execute(new TransactionCallback() { + public Object doInTransaction(TransactionStatus arg0) { + Object result=null; + try { + JpaTemplate tmp=hiseDao.getJpaTemplate(); + result=tmp.execute(new JpaCallback() { + public Object doInJpa(EntityManager em) throws PersistenceException { + List result=em.createNativeQuery(query, elementsClass).getResultList(); + if(result.get(0) instanceof Comment) + System.out.println("pawel: prawda"); + return result; + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + return (List)result; + } + }); + + + return (List)result; +} + +private Long generateAndAddComments(final int commentsCount ){ + TransactionTemplate tt = new TransactionTemplate(transactionManager); + + final Long tid = (Long) tt.execute(new TransactionCallback() { + public Object doInTransaction(TransactionStatus arg0) { + try { + cleanup(); + + Task task = hiseDao.find(Task.class, taskHelper.addTask(hiseDao)); + Comment c; + for(int i=0;i + @@ -28,6 +29,10 @@ + + + + Modified: incubator/hise/trunk/itest/hise-soapui-project.xml URL: http://svn.apache.org/viewvc/incubator/hise/trunk/itest/hise-soapui-project.xml?rev=979627&r1=979626&r2=979627&view=diff ============================================================================== --- incubator/hise/trunk/itest/hise-soapui-project.xml (original) +++ incubator/hise/trunk/itest/hise-soapui-project.xml Tue Jul 27 09:57:48 2010 @@ -3088,7 +3088,7 @@ -]]>http://schemas.xmlsoap.org/wsdl/${#Project#destination}/ClaimsHandlingService/${#Project#destination}/ClaimsHandlingService2/${#Project#destination}/ClaimsHandlingService8/UTF-8${#Project#destination}/ClaimsHandlingService/ +]]>http://schemas.xmlsoap.org/wsdl/${#Project#destination}/ClaimsHandlingService/${#Project#destination}/ClaimsHandlingService2/${#Project#destination}/ClaimsHandlingService8/${#Project#destination}/ClaimsHandlingService6/UTF-8${#Project#destination}/ClaimsHandlingService/ @@ -3764,7 +3764,7 @@ declare namespace htd2 = 'http://www.exa -]]>user2user2passtid1002tid2Responseapprove<a>{*/*/*/text()}</a>tidPropertiestaskOperationsSOAPgetAttachmentInfos<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ +]]>user2user2passtid558tid2Responseapprove<a>{*/*/*/text()}</a>tidPropertiestaskOperationsSOAPgetAttachmentInfos<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ @@ -3994,7 +3994,7 @@ declare namespace ns3='http://www.exampl ${Properties#tid} -]]>user1user1passClaimsHandlingBindingapprove<xml-fragment/>UTF-8${#Project#destination}/ClaimsHandlingService/ +]]>user1user1passClaimsHandlingBindingapprove<xml-fragment/>UTF-8${#Project#destination}/ClaimsHandlingService8/ soapui @@ -4013,7 +4013,7 @@ declare namespace ns3='http://www.exampl -]]>user2user2passtid1006ttidResponseapprove<a>{*/*/*/text()}</a>tidPropertiestaskOperationsSOAPstart<x ml-fragment/>UTF-8${#Project#destination}/taskOperations/ +]]>user2user2passtid557ttidResponseapprove<a>{*/*/*/text()}</a>tidPropertiestaskOperationsSOAPstart<xm l-fragment/>UTF-8${#Project#destination}/taskOperations/ @@ -4032,7 +4032,7 @@ declare namespace ns4='http://www.insura declare namespace ns3='http://www.example.org/WS-HT'; declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/'; declare namespace ns1='http://www.example.org/WS-HT/api/xsd'; -<v>{//ns2:status/text()};{//ns2:name/text()}</v><v>IN_PROGRESS;ns4:Task1</v>falseuser1user1passtaskOperationsSOAPgetComments<xml-fragmen t/>UTF-8${#Project#destination}/taskOperations/ +<v>{//ns2:status/text()};{//ns2:name/text()}</v><v>IN_PROGRESS;ns4:Task8</v>falseuser1user1passtaskOperationsSOAPgetComments<xml-fragmen t/>UTF-8${#Project#destination}/taskOperations/ @@ -4047,7 +4047,7 @@ declare namespace ns1='http://www.exampl first_comment -]]>user1user1passtaskOperationsSOAPaddComment<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ +]]>user5user5passtaskOperationsSOAPaddComment<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ @@ -4067,7 +4067,7 @@ declare namespace ns4='http://www.insura declare namespace ns3='http://www.example.org/WS-HT/api'; declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/'; declare namespace ns1='http://www.example.org/WS-HT/api/xsd'; -<v>{//ns3:addedBy/text()};{//ns3:text/text()}</v><v>user1user2;first_commentsecond_comment</v>falseuser1user1passClaimsHandlingBindingapprove <xml-fragment/>UTF-8${#Project#destination}/ClaimsHandlingService7/ +<v>{//ns3:addedBy/text()};{//ns3:text/text()}</v><v>user5user2;first_commentsecond_comment</v>falseuser1user1passClaimsHandlingBindingapprove <xml-fragment/>UTF-8${#Project#destination}/ClaimsHandlingService7/ user3 Modified: incubator/hise/trunk/itest/task_history.xml URL: http://svn.apache.org/viewvc/incubator/hise/trunk/itest/task_history.xml?rev=979627&r1=979626&r2=979627&view=diff ============================================================================== --- incubator/hise/trunk/itest/task_history.xml (original) +++ incubator/hise/trunk/itest/task_history.xml Tue Jul 27 09:57:48 2010 @@ -4176,7 +4176,7 @@ tid - 354 + 552