Author: max.ross
Date: 2007-07-28 00:20:45 -0400 (Sat, 28 Jul 2007)
New Revision: 12838
Modified:
shards/trunk/src/java/org/hibernate/shards/criteria/ExitOperationsCriteriaCollector.java
shards/trunk/src/java/org/hibernate/shards/query/QueryResult.java
shards/trunk/src/java/org/hibernate/shards/session/CrossShardRelationshipDetectingInterceptor.java
shards/trunk/src/java/org/hibernate/shards/session/ShardedSessionImpl.java
shards/trunk/src/java/org/hibernate/shards/stat/ShardedSessionStatistics.java
shards/trunk/src/java/org/hibernate/shards/strategy/exit/AggregateExitOperation.java
shards/trunk/src/java/org/hibernate/shards/strategy/exit/ExitOperationUtils.java
shards/trunk/src/java/org/hibernate/shards/strategy/exit/OrderExitOperation.java
shards/trunk/src/java/org/hibernate/shards/strategy/exit/ProjectionExitOperationFactory.java
shards/trunk/src/java/org/hibernate/shards/strategy/exit/ShardedAvgExitOperation.java
shards/trunk/src/test/org/hibernate/shards/integration/BaseShardingIntegrationTestCase.java
shards/trunk/src/test/org/hibernate/shards/integration/model/ModelCriteriaPermutedIntegrationTest.java
shards/trunk/src/test/org/hibernate/shards/integration/model/ModelPermutedIntegrationTest.java
shards/trunk/src/test/org/hibernate/shards/strategy/exit/AggregateExitOperationTest.java
shards/trunk/src/test/org/hibernate/shards/strategy/exit/FirstResultExitOperationTest.java
shards/trunk/src/test/org/hibernate/shards/strategy/exit/OrderExitOperationTest.java
Log:
cleaned up a bunch of compiler warnings
Modified:
shards/trunk/src/java/org/hibernate/shards/criteria/ExitOperationsCriteriaCollector.java
===================================================================
---
shards/trunk/src/java/org/hibernate/shards/criteria/ExitOperationsCriteriaCollector.java 2007-07-28
03:20:18 UTC (rev 12837)
+++
shards/trunk/src/java/org/hibernate/shards/criteria/ExitOperationsCriteriaCollector.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -154,7 +154,7 @@
}
for(Order order : orders) {
- result = new OrderExitOperation(order, sessionFactoryImplementor).apply(result);
+ result = new OrderExitOperation(order).apply(result);
}
if (firstResult != null) {
result = new FirstResultExitOperation(firstResult).apply(result);
Modified: shards/trunk/src/java/org/hibernate/shards/query/QueryResult.java
===================================================================
--- shards/trunk/src/java/org/hibernate/shards/query/QueryResult.java 2007-07-28 03:20:18
UTC (rev 12837)
+++ shards/trunk/src/java/org/hibernate/shards/query/QueryResult.java 2007-07-28 04:20:45
UTC (rev 12838)
@@ -33,13 +33,13 @@
private final Map<Shard, List> resultMap = Maps.newHashMap();
- private final List entityList = Lists.newArrayList();
+ private final List<Object> entityList = Lists.newArrayList();
public Map<Shard, List> getResultMap() {
return Collections.unmodifiableMap(resultMap);
}
- public void add(Shard shard, List list) {
+ public void add(Shard shard, List<Object> list) {
resultMap.put(shard, list);
entityList.addAll(list);
}
@@ -49,7 +49,7 @@
entityList.addAll(result.getEntityList());
}
- public List getEntityList() {
+ public List<Object> getEntityList() {
return entityList;
}
Modified:
shards/trunk/src/java/org/hibernate/shards/session/CrossShardRelationshipDetectingInterceptor.java
===================================================================
---
shards/trunk/src/java/org/hibernate/shards/session/CrossShardRelationshipDetectingInterceptor.java 2007-07-28
03:20:18 UTC (rev 12837)
+++
shards/trunk/src/java/org/hibernate/shards/session/CrossShardRelationshipDetectingInterceptor.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -75,7 +75,9 @@
if(collections == null) {
collections = Lists.newArrayList();
}
- collections.add((Collection<Object>) pair.getSecond());
+ @SuppressWarnings("unchecked")
+ Collection<Object> objColl = (Collection<Object>) pair.getSecond();
+ collections.add(objColl);
} else {
checkForConflictingShardId(entity.getClass().getName(), expectedShardId,
pair.getSecond());
}
@@ -107,7 +109,7 @@
}
void checkForConflictingShardId(String classOfUpdatedObject, ShardId expectedShardId,
Object associatedObject) {
- ShardId localShardId = null;
+ ShardId localShardId;
/*
* Here's something you wish you didn't need to know: If the associated
* object is an unitialized proxy and the object is not on the same
@@ -154,7 +156,9 @@
throws CallbackException {
ShardId expectedShardId =
getAndRefreshExpectedShardId(((PersistentCollection)collection).getOwner());
Preconditions.checkNotNull(expectedShardId);
- checkIterable("<Unknown>", expectedShardId, (Iterable<Object>)
collection);
+ @SuppressWarnings("unchecked")
+ Iterable<Object> iterable = (Iterable<Object>) collection;
+ checkIterable("<Unknown>", expectedShardId, iterable);
}
private ShardId getAndRefreshExpectedShardId(Object object) {
Modified: shards/trunk/src/java/org/hibernate/shards/session/ShardedSessionImpl.java
===================================================================
--- shards/trunk/src/java/org/hibernate/shards/session/ShardedSessionImpl.java 2007-07-28
03:20:18 UTC (rev 12837)
+++ shards/trunk/src/java/org/hibernate/shards/session/ShardedSessionImpl.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -710,7 +710,9 @@
if(collections == null) {
collections = Lists.newArrayList();
}
- collections.add((Collection<Object>) pair.getSecond());
+ @SuppressWarnings("unchecked")
+ Collection<Object> coll = (Collection<Object>) pair.getSecond();
+ collections.add(coll);
} else {
shardId = checkForConflictingShardId(shardId, obj.getClass(), pair.getSecond());
/**
Modified: shards/trunk/src/java/org/hibernate/shards/stat/ShardedSessionStatistics.java
===================================================================
---
shards/trunk/src/java/org/hibernate/shards/stat/ShardedSessionStatistics.java 2007-07-28
03:20:18 UTC (rev 12837)
+++
shards/trunk/src/java/org/hibernate/shards/stat/ShardedSessionStatistics.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -19,6 +19,8 @@
package org.hibernate.shards.stat;
import org.hibernate.Session;
+import org.hibernate.engine.CollectionKey;
+import org.hibernate.engine.EntityKey;
import org.hibernate.shards.Shard;
import org.hibernate.shards.engine.ShardedSessionImplementor;
import org.hibernate.shards.session.OpenSessionEvent;
@@ -69,18 +71,22 @@
return count;
}
- public Set getEntityKeys() {
- Set entityKeys = Sets.newHashSet();
+ public Set<EntityKey> getEntityKeys() {
+ Set<EntityKey> entityKeys = Sets.newHashSet();
for (SessionStatistics s : sessionStatistics) {
- entityKeys.addAll(s.getEntityKeys());
+ @SuppressWarnings("unchecked")
+ Set<EntityKey> shardEntityKeys = (Set<EntityKey>)s.getEntityKeys();
+ entityKeys.addAll(shardEntityKeys);
}
return entityKeys;
}
- public Set getCollectionKeys() {
- Set collectionKeys = Sets.newHashSet();
+ public Set<CollectionKey> getCollectionKeys() {
+ Set<CollectionKey> collectionKeys = Sets.newHashSet();
for (SessionStatistics s : sessionStatistics) {
- collectionKeys.addAll(s.getCollectionKeys());
+ @SuppressWarnings("unchecked")
+ Set<CollectionKey> shardCollectionKeys =
(Set<CollectionKey>)s.getCollectionKeys();
+ collectionKeys.addAll(shardCollectionKeys);
}
return collectionKeys;
}
Modified:
shards/trunk/src/java/org/hibernate/shards/strategy/exit/AggregateExitOperation.java
===================================================================
---
shards/trunk/src/java/org/hibernate/shards/strategy/exit/AggregateExitOperation.java 2007-07-28
03:20:18 UTC (rev 12837)
+++
shards/trunk/src/java/org/hibernate/shards/strategy/exit/AggregateExitOperation.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -21,8 +21,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.criterion.AggregateProjection;
-import org.hibernate.engine.SessionFactoryImplementor;
-import org.hibernate.shards.util.Preconditions;
import java.math.BigDecimal;
import java.util.Collections;
@@ -35,7 +33,6 @@
private final SupportedAggregations aggregate;
- private final SessionFactoryImplementor sessionFactoryImplementor;
private final String fieldName;
private final Log log = LogFactory.getLog(getClass());
@@ -58,9 +55,7 @@
}
- public AggregateExitOperation(AggregateProjection projection, SessionFactoryImplementor
sessionFactoryImplementor) {
- Preconditions.checkNotNull(sessionFactoryImplementor);
- this.sessionFactoryImplementor = sessionFactoryImplementor;
+ public AggregateExitOperation(AggregateProjection projection) {
/**
* an aggregateProjection's toString returns
* min( ..., max( ..., sum( ..., or avg( ...
Modified:
shards/trunk/src/java/org/hibernate/shards/strategy/exit/ExitOperationUtils.java
===================================================================
---
shards/trunk/src/java/org/hibernate/shards/strategy/exit/ExitOperationUtils.java 2007-07-28
03:20:18 UTC (rev 12837)
+++
shards/trunk/src/java/org/hibernate/shards/strategy/exit/ExitOperationUtils.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -40,12 +40,14 @@
return nonNullList;
}
- public static List<Comparable> getComparableList(List<Object> results) {
- return (List<Comparable>) (List) results; // I feel dirty
+ public static List<Comparable<Object>> getComparableList(List<Object>
results) {
+ @SuppressWarnings("unchecked")
+ List<Comparable<Object>> result = (List<Comparable<Object>>)
(List) results;
+ return result;
}
- public static Comparable getPropertyValue(Object obj, String propertyName) {
+ public static Comparable<Object> getPropertyValue(Object obj, String
propertyName) {
/**
* TODO(maulik) respect the client's choice in how Hibernate accesses
* property values.
@@ -72,15 +74,17 @@
}
String[] methods = ("get" +
propertyPath.toString().replaceAll("\\.",
".get")).split("\\.");
Object root = obj;
- for (int i=0; i < methods.length; i++) {
+ for (String method : methods) {
Class clazz = root.getClass();
- Method m = clazz.getMethod(methods[i]);
+ Method m = clazz.getMethod(method);
root = m.invoke(root);
if (root == null) {
break;
}
}
- return (Comparable) root;
+ @SuppressWarnings("unchecked")
+ Comparable<Object> result = (Comparable<Object>) root;
+ return result;
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
Modified:
shards/trunk/src/java/org/hibernate/shards/strategy/exit/OrderExitOperation.java
===================================================================
---
shards/trunk/src/java/org/hibernate/shards/strategy/exit/OrderExitOperation.java 2007-07-28
03:20:18 UTC (rev 12837)
+++
shards/trunk/src/java/org/hibernate/shards/strategy/exit/OrderExitOperation.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -19,7 +19,6 @@
package org.hibernate.shards.strategy.exit;
import org.hibernate.criterion.Order;
-import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.shards.util.Preconditions;
import java.util.Collections;
@@ -32,28 +31,26 @@
public class OrderExitOperation implements ExitOperation {
private final Order order;
- private final SessionFactoryImplementor sessionFactoryImplementor;
private final String propertyName;
- public OrderExitOperation(Order order, SessionFactoryImplementor
sessionFactoryImplementor) {
+ public OrderExitOperation(Order order) {
//TODO(maulik) support Ignore case!
Preconditions.checkState(order.toString().endsWith("asc") ||
order.toString().endsWith("desc"));
this.order = order;
this.propertyName = getSortingProperty(order);
- this.sessionFactoryImplementor = sessionFactoryImplementor;
}
public List<Object> apply(List<Object> results) {
- List nonNullList = ExitOperationUtils.getNonNullList(results);
- Comparator comparator = new Comparator() {
+ List<Object> nonNullList = ExitOperationUtils.getNonNullList(results);
+ Comparator<Object> comparator = new Comparator<Object>() {
public int compare(Object o1, Object o2) {
if (o1 == o2) {
return 0;
}
- Comparable o1Value = ExitOperationUtils.getPropertyValue(o1, propertyName);
- Comparable o2Value = ExitOperationUtils.getPropertyValue(o2, propertyName);
+ Comparable<Object> o1Value = ExitOperationUtils.getPropertyValue(o1,
propertyName);
+ Comparable<Object> o2Value = ExitOperationUtils.getPropertyValue(o2,
propertyName);
if (o1Value == null) {
return -1;
}
Modified:
shards/trunk/src/java/org/hibernate/shards/strategy/exit/ProjectionExitOperationFactory.java
===================================================================
---
shards/trunk/src/java/org/hibernate/shards/strategy/exit/ProjectionExitOperationFactory.java 2007-07-28
03:20:18 UTC (rev 12837)
+++
shards/trunk/src/java/org/hibernate/shards/strategy/exit/ProjectionExitOperationFactory.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -42,7 +42,7 @@
return new RowCountExitOperation(projection);
}
if (projection instanceof AggregateProjection) {
- return new AggregateExitOperation((AggregateProjection) projection,
sessionFactoryImplementor);
+ return new AggregateExitOperation((AggregateProjection) projection);
}
Modified:
shards/trunk/src/java/org/hibernate/shards/strategy/exit/ShardedAvgExitOperation.java
===================================================================
---
shards/trunk/src/java/org/hibernate/shards/strategy/exit/ShardedAvgExitOperation.java 2007-07-28
03:20:18 UTC (rev 12837)
+++
shards/trunk/src/java/org/hibernate/shards/strategy/exit/ShardedAvgExitOperation.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -42,11 +42,12 @@
public List<Object> apply(List<Object> results) {
BigDecimal value = new BigDecimal(0.0);
BigDecimal count = new BigDecimal(0.0);
- for(Object obj : results) {
- Pair<Number, Number> pair = (Pair<Number, Number>) obj;
+ @SuppressWarnings("unchecked")
+ List<Pair<Double, Integer>> pairList = (List<Pair<Double,
Integer>>) (List) results;
+ for(Pair<Double, Integer> pair : pairList) {
// we know the order of the pair (avg, count) by convention of
ShardedAvgProjection
- value = value.add(new BigDecimal(pair.first.toString()));
- count = count.add(new BigDecimal(pair.second.toString()));
+ value = value.add(new BigDecimal(pair.first));
+ count = count.add(new BigDecimal(pair.second));
}
return Lists.newArrayList((Object)value.divide(count));
}
Modified:
shards/trunk/src/test/org/hibernate/shards/integration/BaseShardingIntegrationTestCase.java
===================================================================
---
shards/trunk/src/test/org/hibernate/shards/integration/BaseShardingIntegrationTestCase.java 2007-07-28
03:20:18 UTC (rev 12837)
+++
shards/trunk/src/test/org/hibernate/shards/integration/BaseShardingIntegrationTestCase.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -19,6 +19,9 @@
package org.hibernate.shards.integration;
import junit.framework.TestCase;
+
+import org.hibernate.Criteria;
+import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.cfg.Configuration;
import org.hibernate.shards.ShardId;
@@ -126,7 +129,7 @@
Map<Integer, Integer> virtualShardToShardMap = Maps.newHashMap();
if (isVirtualShardingEnabled()) {
for(int i = 0; i < getNumShards(); ++i) {
- virtualShardToShardMap.put(Integer.valueOf(i), Integer.valueOf(i %
getNumDatabases()));
+ virtualShardToShardMap.put(i, i % getNumDatabases());
}
}
return virtualShardToShardMap;
@@ -249,12 +252,16 @@
/**
* Override if you want additional tables in your schema
+ * @param conn the connection
+ * @throws SQLException thrown if any of the operations performed with the
+ * connection throws the same
*/
protected void createDatabaseHook(Connection conn) throws SQLException {
}
/**
* Override if you want more than the default
+ * @return the number of databases
*/
protected int getNumDatabases() {
return perm.getNumDbs();
@@ -290,32 +297,26 @@
}
protected <T> T reloadAssertNotNull(Session session, T reloadMe) {
- T result = (T) reloadAll(session, reloadMe)[0];
+ T result = reload(session, reloadMe);
assertNotNull(result);
return result;
}
protected <T> T reload(Session session, T reloadMe) {
- return (T) reloadAll(session, reloadMe)[0];
- }
-
- protected Object[] reloadAll(Session session, Object... reloadMe) {
- List<Object> retVal = Lists.newArrayList();
- for(Object obj : reloadMe) {
- Class clazz = obj.getClass();
- String className = clazz.getSimpleName();
- try {
- Method m = clazz.getMethod("get" + className + "Id");
- retVal.add(session.get(clazz, (Serializable) m.invoke(obj)));
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
+ Class<?> clazz = reloadMe.getClass();
+ String className = clazz.getSimpleName();
+ try {
+ Method m = clazz.getMethod("get" + className + "Id");
+ @SuppressWarnings("unchecked")
+ T result = (T) get(session, clazz, (Serializable) m.invoke(reloadMe));
+ return result;
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
}
- return retVal.toArray();
}
protected ShardId getShardIdForObject(Object obj) {
@@ -361,6 +362,30 @@
// TODO(maxr) handel assertion failure separately so they get properly reported
}
}
+
+ protected <T> List<T> list(Criteria crit) {
+ @SuppressWarnings("unchecked")
+ List<T> result = crit.list();
+ return result;
+ }
+
+ protected <T> List<T> list(Query query) {
+ @SuppressWarnings("unchecked")
+ List<T> result = query.list();
+ return result;
+ }
+
+ protected <T> T uniqueResult(Criteria crit) {
+ @SuppressWarnings("unchecked")
+ T result = (T) crit.uniqueResult();
+ return result;
+ }
+
+ protected <T> T get(Session session, Class<?> clazz, Serializable id) {
+ @SuppressWarnings("unchecked")
+ T result = (T) session.get(clazz, id);
+ return result;
+ }
}
Modified:
shards/trunk/src/test/org/hibernate/shards/integration/model/ModelCriteriaPermutedIntegrationTest.java
===================================================================
---
shards/trunk/src/test/org/hibernate/shards/integration/model/ModelCriteriaPermutedIntegrationTest.java 2007-07-28
03:20:18 UTC (rev 12837)
+++
shards/trunk/src/test/org/hibernate/shards/integration/model/ModelCriteriaPermutedIntegrationTest.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -281,13 +281,5 @@
List<Office> answer = Lists.newArrayList(b2f1o1, b1f3o1, b1f3o2);
assertTrue(answer.equals(l));
}
-
- private <T> List<T> list(Criteria crit) {
- return crit.list();
- }
-
- private <T> T uniqueResult(Criteria crit) {
- return (T) crit.uniqueResult();
- }
}
Modified:
shards/trunk/src/test/org/hibernate/shards/integration/model/ModelPermutedIntegrationTest.java
===================================================================
---
shards/trunk/src/test/org/hibernate/shards/integration/model/ModelPermutedIntegrationTest.java 2007-07-28
03:20:18 UTC (rev 12837)
+++
shards/trunk/src/test/org/hibernate/shards/integration/model/ModelPermutedIntegrationTest.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -108,7 +108,7 @@
buildings.add(b);
}
commitAndResetSession();
- List<Integer> counts =
session.createCriteria(Building.class).setProjection(Projections.rowCount()).list();
+ List<Integer> counts =
list(session.createCriteria(Building.class).setProjection(Projections.rowCount()));
int total = 0;
for(Integer count : counts) {
total += count;
@@ -656,7 +656,7 @@
for(int i=0; i<getNumShards(); i++) {
saveBuilding("building-"+i);
}
- List<Building> buildings = session.createQuery("from
Building").list();
+ List<Building> buildings = list(session.createQuery("from
Building"));
assertEquals(getNumShards(), buildings.size());
resetSession();
@@ -686,7 +686,7 @@
// do we only search certain shards?
// we should only get back the buildings that were on shard 0, i.e. a single
building
Session sessionWithParticularShards = ssfWithParticularShards.openSession();
- List<Building> buildingsFromDesiredShards =
sessionWithParticularShards.createQuery("from Building").list();
+ List<Building> buildingsFromDesiredShards =
list(sessionWithParticularShards.createQuery("from Building"));
if (!isVirtualShardingEnabled()) {
assertEquals(1, buildingsFromDesiredShards.size());
Modified:
shards/trunk/src/test/org/hibernate/shards/strategy/exit/AggregateExitOperationTest.java
===================================================================
---
shards/trunk/src/test/org/hibernate/shards/strategy/exit/AggregateExitOperationTest.java 2007-07-28
03:20:18 UTC (rev 12837)
+++
shards/trunk/src/test/org/hibernate/shards/strategy/exit/AggregateExitOperationTest.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -19,6 +19,7 @@
package org.hibernate.shards.strategy.exit;
import junit.framework.TestCase;
+
import org.hibernate.EntityMode;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
@@ -76,38 +77,38 @@
public void testCtor() throws Exception {
try {
- new AggregateExitOperation(new AvgProjection("foo"), new
SessionFactoryMock());
+ new AggregateExitOperation(new AvgProjection("foo"));
fail();
} catch (IllegalArgumentException e) {
// good
}
try {
- new AggregateExitOperation(new AvgProjection("foo"), new
SessionFactoryDefaultMock());
+ new AggregateExitOperation(new AvgProjection("foo"));
fail();
} catch (IllegalArgumentException e) {
// good
}
- new AggregateExitOperation(Projections.max("foo"), new
SessionFactoryDefaultMock());
- new AggregateExitOperation(Projections.min("foo"), new
SessionFactoryDefaultMock());
- new AggregateExitOperation(Projections.sum("foo"), new
SessionFactoryDefaultMock());
+ new AggregateExitOperation(Projections.max("foo"));
+ new AggregateExitOperation(Projections.min("foo"));
+ new AggregateExitOperation(Projections.sum("foo"));
}
public void testSum() throws Exception {
- AggregateExitOperation exitOp = new
AggregateExitOperation(Projections.sum("value"), new SessionFactoryMock());
+ AggregateExitOperation exitOp = new
AggregateExitOperation(Projections.sum("value"));
List<Object> result = exitOp.apply(data);
assertEquals(new BigDecimal(11.0), (BigDecimal)result.get(0));
}
public void testMax() throws Exception {
- AggregateExitOperation exitOp = new
AggregateExitOperation(Projections.max("value"), new SessionFactoryMock());
+ AggregateExitOperation exitOp = new
AggregateExitOperation(Projections.max("value"));
List<Object> result = exitOp.apply(data);
assertEquals(5, ((MyInt)result.get(0)).getValue());
}
public void testMin() throws Exception {
- AggregateExitOperation exitOp = new
AggregateExitOperation(Projections.min("value"), new SessionFactoryMock());
+ AggregateExitOperation exitOp = new
AggregateExitOperation(Projections.min("value"));
List<Object> result = exitOp.apply(data);
assertEquals(0, ((MyInt)result.get(0)).getValue());
Modified:
shards/trunk/src/test/org/hibernate/shards/strategy/exit/FirstResultExitOperationTest.java
===================================================================
---
shards/trunk/src/test/org/hibernate/shards/strategy/exit/FirstResultExitOperationTest.java 2007-07-28
03:20:18 UTC (rev 12837)
+++
shards/trunk/src/test/org/hibernate/shards/strategy/exit/FirstResultExitOperationTest.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -20,6 +20,7 @@
import junit.framework.TestCase;
+
import org.hibernate.shards.util.Lists;
import java.util.List;
@@ -56,7 +57,8 @@
List<Object> objects = exitOp.apply(list);
assertTrue(objects.isEmpty());
- list = Lists.newArrayList(null, null, null);
+ Object nullObj = null;
+ list = Lists.newArrayList(nullObj, nullObj, nullObj);
objects = exitOp.apply(list);
assertTrue(objects.isEmpty());
Modified:
shards/trunk/src/test/org/hibernate/shards/strategy/exit/OrderExitOperationTest.java
===================================================================
---
shards/trunk/src/test/org/hibernate/shards/strategy/exit/OrderExitOperationTest.java 2007-07-28
03:20:18 UTC (rev 12837)
+++
shards/trunk/src/test/org/hibernate/shards/strategy/exit/OrderExitOperationTest.java 2007-07-28
04:20:45 UTC (rev 12838)
@@ -19,6 +19,7 @@
package org.hibernate.shards.strategy.exit;
import junit.framework.TestCase;
+
import org.hibernate.EntityMode;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
@@ -102,7 +103,7 @@
public void testApply() throws Exception {
Order order = Order.asc("value");
- OrderExitOperation oeo = new OrderExitOperation(order, new SessionFactoryMock());
+ OrderExitOperation oeo = new OrderExitOperation(order);
List unShuffledList = oeo.apply(shuffledList);
assertTrue(nonNullData.equals(unShuffledList));
@@ -112,8 +113,8 @@
Order orderValue = Order.asc("value");
Order orderName = Order.desc("name");
- OrderExitOperation oeoValue = new OrderExitOperation(orderValue, new
SessionFactoryMock());
- OrderExitOperation oeoName = new OrderExitOperation(orderName, new
SessionFactoryMock());
+ OrderExitOperation oeoValue = new OrderExitOperation(orderValue);
+ OrderExitOperation oeoName = new OrderExitOperation(orderName);
List<MyInt> answer =
Lists.newArrayList(