polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [33/34] zest-java git commit: Fixed testcases that seems to have always been wrong... Should be double checked by someone else.
Date Thu, 14 Apr 2016 06:13:39 GMT
Fixed testcases that seems to have always been wrong... Should be double checked by someone
else.


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/612f952a
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/612f952a
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/612f952a

Branch: refs/heads/develop
Commit: 612f952a338ef93e305b90321de04b5ccc9c7930
Parents: 962badc
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Thu Apr 14 09:37:50 2016 +0800
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Thu Apr 14 09:37:50 2016 +0800

----------------------------------------------------------------------
 .../bootstrap/layered/LayeredLayerAssembler.java  | 12 ++++++------
 .../test/indexing/AbstractNamedQueryTest.java     | 18 ++++++++++--------
 .../zest/test/indexing/AbstractQueryTest.java     |  8 ++++----
 .../apache/zest/test/indexing/NameableAssert.java |  4 +++-
 .../org/apache/zest/test/indexing/TestData.java   |  1 +
 5 files changed, 24 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/612f952a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredLayerAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredLayerAssembler.java
b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredLayerAssembler.java
index ccec8d2..46a3a83 100644
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredLayerAssembler.java
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredLayerAssembler.java
@@ -28,15 +28,15 @@ public abstract class LayeredLayerAssembler
 {
     private HashMap<Class<? extends ModuleAssembler>, ModuleAssembler> assemblers
= new HashMap<>();
 
-    protected ModuleAssembly createModule( LayerAssembly layer, Class<? extends ModuleAssembler>
modulerAssemblerClass )
+    protected ModuleAssembly createModule( LayerAssembly layer, Class<? extends ModuleAssembler>
moduleAssemblerClass )
     {
         try
         {
-            ModuleAssembler moduleAssembler = instantiateAssembler( layer, modulerAssemblerClass
);
-            String moduleName = createModuleName( modulerAssemblerClass );
-            LayeredApplicationAssembler.setNameIfPresent( modulerAssemblerClass, moduleName
);
+            ModuleAssembler moduleAssembler = instantiateAssembler( layer, moduleAssemblerClass
);
+            String moduleName = createModuleName( moduleAssemblerClass );
+            LayeredApplicationAssembler.setNameIfPresent( moduleAssemblerClass, moduleName
);
             ModuleAssembly module = layer.module( moduleName );
-            assemblers.put( modulerAssemblerClass, moduleAssembler );
+            assemblers.put( moduleAssemblerClass, moduleAssembler );
             ModuleAssembly assembly = moduleAssembler.assemble( layer, module );
             if( assembly == null )
             {
@@ -46,7 +46,7 @@ public abstract class LayeredLayerAssembler
         }
         catch( Exception e )
         {
-            throw new IllegalArgumentException( "Unable to instantiate module with " + modulerAssemblerClass.getSimpleName(),
e );
+            throw new IllegalArgumentException( "Unable to instantiate module with " + moduleAssemblerClass.getSimpleName(),
e );
         }
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/612f952a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java
b/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java
index cac1c7e..ecfbc2a 100755
--- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java
+++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java
@@ -112,8 +112,8 @@ public abstract class AbstractNamedQueryTest
             .newQueryBuilder( Nameable.class )
             .where( queries.get( "script03" ) ) );
         System.out.println( "*** script03: " + query );
-        verifyUnorderedResults( query, "Joe Doe", "Ann Doe", "Jack Doe", "Penang", "Kuala
Lumpur", "Cooking", "Gaming",
-                                "Programming", "Cars" );
+        verifyUnorderedResults( query, "Joe Doe", "Felix", "Ann Doe", "Jack Doe", "Penang",
"Kuala Lumpur", "Cooking",
+                                "Gaming", "Programming", "Cars" );
     }
 
     @Test
@@ -267,14 +267,15 @@ public abstract class AbstractNamedQueryTest
         throws EntityFinderException
     {
         Nameable nameable = templateFor( Nameable.class );
+        Predicate<Composite> predicate = queries.get( "script17" );
         final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Nameable.class )
-            .where( queries.get( "script17" ) ) );
+            .where( predicate ) );
         query.orderBy( orderBy( nameable.name() ) );
         query.firstResult( 3 );
         query.maxResults( 3 );
         System.out.println( "*** script17: " + query );
-        verifyOrderedResults( query, "Gaming", "Jack Doe", "Joe Doe" );
+        verifyOrderedResults( query, "Felix", "Gaming", "Jack Doe" );
     }
 
     @Test
@@ -282,13 +283,14 @@ public abstract class AbstractNamedQueryTest
         throws EntityFinderException
     {
         Nameable nameable = templateFor( Nameable.class );
+        Predicate<Composite> predicate = queries.get( "script18" );
         final Query<Nameable> query = unitOfWork.newQuery( this.moduleInstance
             .newQueryBuilder( Nameable.class )
-            .where( queries.get( "script18" ) ) );
+            .where( predicate ) );
         query.orderBy( orderBy( nameable.name() ) );
         System.out.println( "*** script18: " + query );
-        verifyOrderedResults( query, "Ann Doe", "Cars", "Cooking", "Gaming", "Jack Doe",
"Joe Doe", "Kuala Lumpur",
-                              "Penang", "Programming" );
+        verifyOrderedResults( query, "Ann Doe", "Cars", "Cooking", "Felix", "Gaming", "Jack
Doe", "Joe Doe",
+                              "Kuala Lumpur", "Penang", "Programming" );
     }
 
     @Test
@@ -301,7 +303,7 @@ public abstract class AbstractNamedQueryTest
             .where( queries.get( "script19" ) ) );
         query.orderBy( orderBy( nameable.name() ) );
         System.out.println( "*** script19: " + query );
-        verifyOrderedResults( query, "Gaming", "Jack Doe", "Joe Doe", "Kuala Lumpur", "Penang",
"Programming" );
+        verifyOrderedResults( query, "Felix", "Gaming", "Jack Doe", "Joe Doe", "Kuala Lumpur",
"Penang", "Programming" );
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/zest-java/blob/612f952a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java
b/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java
index 852094a..b442434 100644
--- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java
+++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java
@@ -117,7 +117,7 @@ public abstract class AbstractQueryTest
         QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class
);
         Query<Nameable> query = unitOfWork.newQuery( qb );
         System.out.println( "*** script03: " + query );
-        verifyUnorderedResults( query, "Joe Doe", "Ann Doe", "Jack Doe", "Penang", "Kuala
Lumpur", "Cooking", "Gaming",
+        verifyUnorderedResults( query,  "Felix", "Joe Doe", "Ann Doe", "Jack Doe", "Penang",
"Kuala Lumpur", "Cooking", "Gaming",
                                 "Programming", "Cars" );
     }
 
@@ -314,7 +314,7 @@ public abstract class AbstractQueryTest
         query.firstResult( 3 );
         query.maxResults( 2 );
         System.out.println( "*** script17: " + query );
-        verifyOrderedResults( query, "Gaming", "Jack Doe" );
+        verifyOrderedResults( query, "Felix", "Gaming" );
     }
 
     @Test
@@ -327,7 +327,7 @@ public abstract class AbstractQueryTest
         Query<Nameable> query = unitOfWork.newQuery( qb );
         query.orderBy( orderBy( nameable.name() ) );
         System.out.println( "*** script18: " + query );
-        verifyOrderedResults( query, "Ann Doe", "Cars", "Cooking", "Gaming", "Jack Doe",
"Joe Doe", "Kuala Lumpur",
+        verifyOrderedResults( query, "Ann Doe", "Cars", "Cooking", "Felix", "Gaming", "Jack
Doe", "Joe Doe", "Kuala Lumpur",
                               "Penang", "Programming" );
     }
 
@@ -341,7 +341,7 @@ public abstract class AbstractQueryTest
         Query<Nameable> query = unitOfWork.newQuery( qb.where( gt( nameable.name(),
"D" ) ) );
         query.orderBy( orderBy( nameable.name() ) );
         System.out.println( "*** script19: " + query );
-        verifyOrderedResults( query, "Gaming", "Jack Doe", "Joe Doe", "Kuala Lumpur", "Penang",
"Programming" );
+        verifyOrderedResults( query, "Felix", "Gaming", "Jack Doe", "Joe Doe", "Kuala Lumpur",
"Penang", "Programming" );
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/zest-java/blob/612f952a/core/testsupport/src/main/java/org/apache/zest/test/indexing/NameableAssert.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/NameableAssert.java
b/core/testsupport/src/main/java/org/apache/zest/test/indexing/NameableAssert.java
index e6f8c52..32ee9db 100644
--- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/NameableAssert.java
+++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/NameableAssert.java
@@ -19,6 +19,7 @@ package org.apache.zest.test.indexing;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -97,7 +98,8 @@ public class NameableAssert
 
     public static String[] allNames()
     {
-        return world.values().toArray( new String[ world.size() ] );
+        Collection<String> values = world.values();
+        return values.toArray( new String[ world.size() ] );
     }
 
     public static void verifyUnorderedResults( final Iterable<? extends Nameable> results,
final String... names )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/612f952a/core/testsupport/src/main/java/org/apache/zest/test/indexing/TestData.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/TestData.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/TestData.java
index 48cd6b5..e765eb0 100644
--- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/TestData.java
+++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/TestData.java
@@ -238,6 +238,7 @@ public class TestData
                 Cat felix = catBuilder.instance();
                 felix.name().set( "Felix" );
                 catBuilder.newInstance();
+                NameableAssert.trace( felix );
             }
             unitOfWork.complete();
         }


Mime
View raw message