← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18006: Removed test

 

------------------------------------------------------------
revno: 18006
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-01-15 16:19:04 +0100
message:
  Removed test
removed:
  dhis-2/dhis-services/dhis-service-sms/src/test/java/org/
  dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/
  dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/
  dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/AppTest.java
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/SimplisticHttpGetGateWay.java
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/DataValueSMSListener.java
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/J2MEDataValueSMSListener.java
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/ProgramStageDataEntrySMSListener.java
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/TrackedEntityRegistrationSMSListener.java
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/UnregisteredSMSListener.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java


--
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-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/SimplisticHttpGetGateWay.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/SimplisticHttpGetGateWay.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/SimplisticHttpGetGateWay.java	2015-01-15 15:19:04 +0000
@@ -178,7 +178,6 @@
     @Override
     public int getQueueSchedulingInterval()
     {
-        // FIXME: ?
         return 500;
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/DataValueSMSListener.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/DataValueSMSListener.java	2015-01-15 15:11:38 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/DataValueSMSListener.java	2015-01-15 15:19:04 +0000
@@ -68,6 +68,7 @@
 import org.hisp.dhis.sms.incoming.SmsMessageStatus;
 import org.hisp.dhis.sms.parse.ParserType;
 import org.hisp.dhis.sms.parse.SMSParserException;
+import org.hisp.dhis.system.util.TextUtils;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserService;
 import org.springframework.transaction.annotation.Transactional;
@@ -253,13 +254,16 @@
     {
         HashMap<String, String> output = new HashMap<>();
         Pattern pattern = Pattern.compile( defaultPattern );
+        
         if ( !StringUtils.isBlank( smsCommand.getSeparator() ) )
         {
             String x = "(\\w+)\\s*\\" + smsCommand.getSeparator().trim() + "\\s*([\\w ]+)\\s*(\\"
                 + smsCommand.getSeparator().trim() + "|$)*\\s*";
             pattern = Pattern.compile( x );
         }
+        
         Matcher m = pattern.matcher( sms );
+        
         while ( m.find() )
         {
             String key = m.group( 1 );
@@ -346,15 +350,18 @@
         if ( orgUnit == null && orgUnits.size() > 1 )
         {
             String messageListingOrgUnits = smsCommand.getMoreThanOneOrgUnitMessage();
+            
             for ( Iterator<OrganisationUnit> i = orgUnits.iterator(); i.hasNext(); )
             {
                 OrganisationUnit o = i.next();
-                messageListingOrgUnits += " " + o.getName() + ":" + o.getCode();
+                messageListingOrgUnits += TextUtils.SPACE + o.getName() + ":" + o.getCode();
+                
                 if ( i.hasNext() )
                 {
                     messageListingOrgUnits += ",";
                 }
             }
+            
             throw new SMSParserException( messageListingOrgUnits );
         }
 
@@ -472,8 +479,6 @@
         {
             try
             {
-
-                // +de
                 String formula = code.getFormula();
 
                 String targetDataElementId = formula.substring( 1, formula.length() );
@@ -491,8 +496,10 @@
 
                 DataValue targetDataValue = dataValueService.getDataValue( targetDataElement, period, orgunit,
                     dataElementCategoryService.getDefaultDataElementCategoryOptionCombo() );
+                
                 int targetValue = 0;
                 boolean newTargetDataValue = false;
+                
                 if ( targetDataValue == null )
                 {
                     targetDataValue = new DataValue();
@@ -522,6 +529,7 @@
                 targetDataValue.setValue( String.valueOf( targetValue ) );
                 targetDataValue.setLastUpdated( new java.util.Date() );
                 targetDataValue.setStoredBy( storedBy );
+                
                 if ( newTargetDataValue )
                 {
                     dataValueService.addDataValue( targetDataValue );

=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/J2MEDataValueSMSListener.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/J2MEDataValueSMSListener.java	2015-01-15 15:11:38 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/J2MEDataValueSMSListener.java	2015-01-15 15:19:04 +0000
@@ -64,6 +64,7 @@
 import org.hisp.dhis.sms.incoming.IncomingSmsListener;
 import org.hisp.dhis.sms.parse.ParserType;
 import org.hisp.dhis.sms.parse.SMSParserException;
+import org.hisp.dhis.system.util.TextUtils;
 import org.hisp.dhis.system.util.ValidationUtils;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserService;
@@ -90,7 +91,8 @@
     {
         String message = sms.getText();
         String commandString = null;
-        if ( message.indexOf( " " ) > 0 )
+        
+        if ( message.indexOf( TextUtils.SPACE ) > 0 )
         {
             commandString = message.substring( 0, message.indexOf( " " ) );
             message = message.substring( commandString.length() );
@@ -254,7 +256,6 @@
                 dataValueService.updateDataValue( dv );
             }
         }
-
     }
 
     private OrganisationUnit selectOrganisationUnit( Collection<OrganisationUnit> orgUnits,
@@ -278,6 +279,7 @@
         if ( orgUnit == null && orgUnits.size() > 1 )
         {
             String messageListingOrgUnits = smsCommand.getMoreThanOneOrgUnitMessage();
+            
             for ( Iterator<OrganisationUnit> i = orgUnits.iterator(); i.hasNext(); )
             {
                 OrganisationUnit o = i.next();
@@ -297,6 +299,7 @@
     {
         Collection<OrganisationUnit> orgUnits = new ArrayList<>();
         Collection<User> users = userService.getUsersByPhoneNumber( sender );
+        
         for ( User u : users )
         {
             if ( u.getOrganisationUnits() != null )
@@ -312,6 +315,7 @@
     {
         OrganisationUnit orgunit = null;
         User user = null;
+        
         for ( User u : userService.getUsersByPhoneNumber( sender ) )
         {
             OrganisationUnit ou = u.getOrganisationUnit();
@@ -371,7 +375,6 @@
 
         for ( SMSCode code : command.getCodes() )
         {
-
             DataElementCategoryOptionCombo optionCombo = dataElementCategoryService
                 .getDataElementCategoryOptionCombo( code.getOptionId() );
 
@@ -385,6 +388,7 @@
             else if ( dv != null )
             {
                 String value = dv.getValue();
+                
                 if ( StringUtils.equals( dv.getDataElement().getType(), DataElement.VALUE_TYPE_BOOL ) )
                 {
                     if ( "true".equals( value ) )
@@ -396,6 +400,7 @@
                         value = "No";
                     }
                 }
+                
                 reportBack += code.getCode() + "=" + value + " ";
             }
         }
@@ -441,6 +446,7 @@
             String pattern = "yyyy-MM-dd";
             SimpleDateFormat formatter = new SimpleDateFormat( pattern );
             Date date;
+            
             try
             {
                 date = formatter.parse( periodName );
@@ -450,6 +456,7 @@
                 throw new IllegalArgumentException( "Couldn't make a period of type " + periodType.getName()
                     + " and name " + periodName, e );
             }
+            
             return periodType.createPeriod( date );
         }
 
@@ -514,8 +521,7 @@
 
         }
 
-        throw new IllegalArgumentException( "Couldn't make a period of type " + periodType.getName() + " and name "
-            + periodName );
+        throw new IllegalArgumentException( "Couldn't make a period of type " + periodType.getName() + " and name " + periodName );
     }
 
     public DataValueService getDataValueService()

=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/ProgramStageDataEntrySMSListener.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/ProgramStageDataEntrySMSListener.java	2015-01-15 15:11:38 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/ProgramStageDataEntrySMSListener.java	2015-01-15 15:19:04 +0000
@@ -175,6 +175,7 @@
             cal.setTime( date );
             int year = Calendar.getInstance().get( Calendar.YEAR );
             int month = Calendar.getInstance().get( Calendar.MONTH );
+            
             if ( cal.get( Calendar.MONTH ) < month )
             {
                 cal.set( Calendar.YEAR, year );
@@ -183,6 +184,7 @@
             {
                 cal.set( Calendar.YEAR, year - 1 );
             }
+            
             date = cal.getTime();
         }
         catch ( Exception e )
@@ -197,6 +199,7 @@
     {
         Collection<OrganisationUnit> orgUnits = new ArrayList<>();
         Collection<User> users = userService.getUsersByPhoneNumber( sender );
+        
         for ( User u : users )
         {
             if ( u.getOrganisationUnits() != null )

=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/TrackedEntityRegistrationSMSListener.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/TrackedEntityRegistrationSMSListener.java	2015-01-15 15:11:38 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/TrackedEntityRegistrationSMSListener.java	2015-01-15 15:19:04 +0000
@@ -116,6 +116,7 @@
 
         SMSCommand smsCommand = smsCommandService.getSMSCommand( commandString,
             ParserType.TRACKED_ENTITY_REGISTRATION_PARSER );
+        
         Map<String, String> parsedMessage = this.parse( message, smsCommand );
 
         Date date = lookForDate( message );
@@ -348,8 +349,4 @@
     {
         this.smsSender = smsSender;
     }
-
-
-    
-    
 }

=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/UnregisteredSMSListener.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/UnregisteredSMSListener.java	2015-01-15 15:11:38 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/listener/UnregisteredSMSListener.java	2015-01-15 15:19:04 +0000
@@ -75,6 +75,7 @@
         for ( int i = 0; i < message.length(); i++ )
         {
             String c = String.valueOf( message.charAt( i ) );
+            
             if ( c.matches( "\\W" ) )
             {
                 commandString = message.substring( 0, i );
@@ -165,7 +166,6 @@
                 // update the status of the sms after process
                 sms.setStatus( SmsMessageStatus.PROCESSED );
                 incomingSmsService.update( sms );
-
             }
         }
     }

=== removed directory 'dhis-2/dhis-services/dhis-service-sms/src/test/java/org'
=== removed directory 'dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp'
=== removed directory 'dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis'
=== removed file 'dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/AppTest.java'
--- dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/AppTest.java	2015-01-15 15:11:38 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/AppTest.java	1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
-package org.hisp.dhis;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * Unit test for simple App.
- */
-public class AppTest 
-    extends TestCase
-{
-    /**
-     * Create the test case
-     *
-     * @param testName name of the test case
-     */
-    public AppTest( String testName )
-    {
-        super( testName );
-    }
-
-    /**
-     * @return the suite of tests being tested
-     */
-    public static Test suite()
-    {
-        return new TestSuite( AppTest.class );
-    }
-
-    /**
-     * Rigourous Test :-)
-     */
-    public void testApp()
-    {
-        assertTrue( true );
-    }
-}

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java	2014-12-02 14:07:40 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java	2015-01-15 15:19:04 +0000
@@ -45,7 +45,7 @@
 {
     public static final TextUtils INSTANCE = new TextUtils();
     public static final String EMPTY = "";
-    public static final String SPACE = "";
+    public static final String SPACE = " ";
     public static final String SEP = "-";
     public static final String LN = System.getProperty( "line.separator" );