dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11438
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3259: Improved testing
------------------------------------------------------------
revno: 3259
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-04-01 17:44:51 +0200
message:
Improved testing
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/message/MessageServiceTest.java
dhis-2/dhis-support/dhis-support-hibernate/pom.xml
dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/hibernate-default.properties
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendMessageAction.java
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/menu.vm
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/message.vm
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/sendMessage.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2011-04-01 09:57:53 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2011-04-01 15:44:51 +0000
@@ -38,7 +38,6 @@
import org.hisp.dhis.common.AbstractNameableObject;
import org.hisp.dhis.common.CombinationGenerator;
import org.hisp.dhis.common.NameableObject;
-import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java 2011-03-31 16:28:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java 2011-04-01 15:44:51 +0000
@@ -104,6 +104,12 @@
return surname.equals( other.getSurname() )
&& firstName.equals( other.getFirstName() );
}
+
+ @Override
+ public String toString()
+ {
+ return "[" + surname + " " + firstName + "]";
+ }
// -------------------------------------------------------------------------
// Logic
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-03-30 16:14:30 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-04-01 15:44:51 +0000
@@ -5,8 +5,7 @@
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
-http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
-">
+http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<!-- Store definitions -->
@@ -221,12 +220,6 @@
<property name="clazz" value="org.hisp.dhis.message.UserMessage"/>
</bean>
- <bean id="org.hisp.dhis.message.MessageService" class="org.hisp.dhis.message.DefaultMessageService">
- <property name="messageStore" ref="org.hisp.dhis.message.MessageStore"/>
- <property name="userMessageStore" ref="org.hisp.dhis.message.UserMessageStore"/>
- <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService"/>
- </bean>
-
<!-- Service definitions -->
<bean id="org.hisp.dhis.dataelement.DataElementOperandService"
@@ -437,6 +430,12 @@
ref="org.hisp.dhis.aggregation.AggregatedDataValueStore"/>
</bean>
+ <bean id="org.hisp.dhis.message.MessageService" class="org.hisp.dhis.message.DefaultMessageService">
+ <property name="messageStore" ref="org.hisp.dhis.message.MessageStore"/>
+ <property name="userMessageStore" ref="org.hisp.dhis.message.UserMessageStore"/>
+ <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService"/>
+ </bean>
+
<!-- Concept Name -->
<bean id="org.hisp.dhis.concept.ConceptStore"
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/message/MessageServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/message/MessageServiceTest.java 2011-03-31 16:28:24 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/message/MessageServiceTest.java 2011-04-01 15:44:51 +0000
@@ -32,7 +32,9 @@
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.user.User;
@@ -90,6 +92,25 @@
}
@Test
+ public void testSendMessage()
+ {
+ messageA = new Message( "SubjectA", "TextA", sender );
+
+ Set<User> users = new HashSet<User>();
+ users.add( userA );
+ users.add( userB );
+
+ int idA = messageService.sendMessage( messageA, users );
+
+ messageA = messageService.getMessage( idA );
+
+ assertNotNull( messageA );
+ assertEquals( "SubjectA", messageA.getSubject() );
+ assertEquals( "TextA", messageA.getText() );
+ assertEquals( 2, messageA.getUserMessages().size() );
+ }
+
+ @Test
public void testSaveMessage()
{
int idA = messageService.saveMessage( messageA );
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/pom.xml'
--- dhis-2/dhis-support/dhis-support-hibernate/pom.xml 2011-03-02 00:23:51 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/pom.xml 2011-04-01 15:44:51 +0000
@@ -79,14 +79,6 @@
<artifactId>commons-logging</artifactId>
</dependency>
- <!-- Monitoring -->
- <!--
- <dependency>
- <groupId>com.elvyx</groupId>
- <artifactId>elvyx</artifactId>
- <version>1.0.24</version>
- </dependency> -->
-
</dependencies>
<properties>
<rootDir>../../</rootDir>
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/hibernate-default.properties'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/hibernate-default.properties 2010-11-10 10:42:34 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/hibernate-default.properties 2011-04-01 15:44:51 +0000
@@ -6,7 +6,7 @@
# hibernate-test.properties files in:
#
# 1) The classpath (src/main/resources)
-# 2) $USER_HOME/dhis
+# 2) $DHIS2_HOME
# H2 In-Memory setup:
@@ -43,3 +43,9 @@
# hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
# hibernate.connection.driver_class = org.postgresql.Driver
# hibernate.connection.url = jdbc:postgresql:dhis2
+
+# Monitoring
+
+# hibernate.show_sql = true
+# hibernate.format_sql = true
+# hibernate.use_sql_comments = true
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendMessageAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendMessageAction.java 2011-04-01 13:46:34 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendMessageAction.java 2011-04-01 15:44:51 +0000
@@ -104,7 +104,7 @@
{
users.addAll( unit.getUsers() );
}
-
+
messageService.sendMessage( message, users );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/menu.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/menu.vm 2011-04-01 13:46:34 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/menu.vm 2011-04-01 15:44:51 +0000
@@ -7,7 +7,7 @@
<ul>
<li><a href="index.action">$i18n.getString( "dashboard" ) </a></li>
- <li><a href="showSendMessage.action">$i18n.getString( "messages" ) </a></li>
+ <li><a href="message.action">$i18n.getString( "messages" ) </a></li>
</ul>
<h2>$i18n.getString( "dhis2_online" ) </h2>
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/message.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/message.vm 2011-04-01 13:46:34 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/message.vm 2011-04-01 15:44:51 +0000
@@ -1,7 +1,7 @@
<h3>$i18n.getString( "messages" )</h3>
-<div style="margin-bottom:15px"><input type="button" value="$i18n.getString( 'new_message' )" onclick="window.location.href='message.action'"></div>
+<div style="margin-bottom:15px"><input type="button" value="$i18n.getString( 'new_message' )" onclick="window.location.href='showSendMessage.action'"></div>
<table class="listTable" style="width:75%">
<tr>
@@ -12,10 +12,10 @@
</tr>
#foreach( $message in $messages )
<tr>
- <td>$encoder.htmlEncode( $message.message.sender )</td>
- <td>$encoder.htmlEncode( $message.message.messageDate )</td>
- <td>$encoder.htmlEncode( $message.message.subject )</td>
- <td><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/>
+ <td style="width:28%">$encoder.htmlEncode( $message.message.sender )</td>
+ <td style="width:10%">$format.formatDate( $message.messageDate )</td>
+ <td style="width:70%">$encoder.htmlEncode( $message.message.subject )</td>
+ <td style="width:2%"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/>
</tr>
#end
</table>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/sendMessage.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/sendMessage.vm 2011-04-01 13:46:34 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/sendMessage.vm 2011-04-01 15:44:51 +0000
@@ -12,7 +12,7 @@
<tr>
<td style="min-width:80px">$i18n.getString( "recipient" )</td>
<td>
-<div id="selectionTree" style="width:325px; height:200px"></div>
+<div id="selectionTree" style="width:350px; height:180px"></div>
<script type="text/javascript">
selectionTreeSelection.setMultipleSelectionAllowed( true );
selectionTreeSelection.setListenerFunction( organisationUnitSelected );
@@ -24,12 +24,12 @@
<tr>
<td>$i18n.getString( "subject" )</td>
-<td><input type="text" name="subject" style="width:400px"></td>
+<td><input type="text" name="subject" style="width:350px"></td>
</tr>
<tr>
<td>$i18n.getString( "text" )</td>
-<td><textarea name="text" style="width:400px;height:400px"></textarea></td>
+<td><textarea name="text" style="width:350px;height:200px"></textarea></td>
</tr>
<tr>