Author: aching
Date: Sun Dec 18 07:42:15 2011
New Revision: 1220343
URL: http://svn.apache.org/viewvc?rev=1220343&view=rev
Log:
GIRAPH-80: Don't expose the list holding the messages in
BasicVertex. (ssc via aching)
Added:
incubator/giraph/trunk/src/main/java/org/apache/giraph/utils/ComparisonUtils.java
incubator/giraph/trunk/src/test/java/org/apache/giraph/utils/ComparisonUtilsTest.java
Modified:
incubator/giraph/trunk/CHANGELOG
incubator/giraph/trunk/src/main/java/org/apache/giraph/comm/BasicRPCCommunications.java
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/BasicVertex.java
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/BasicVertexResolver.java
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/EdgeListVertex.java
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/GraphMapper.java
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/LongDoubleFloatDoubleVertex.java
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/Vertex.java
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/VertexResolver.java
incubator/giraph/trunk/src/main/java/org/apache/giraph/utils/MemoryUtils.java
Modified: incubator/giraph/trunk/CHANGELOG
URL:
http://svn.apache.org/viewvc/incubator/giraph/trunk/CHANGELOG?rev=1220343&r1=1220342&r2=1220343&view=diff
==============================================================================
--- incubator/giraph/trunk/CHANGELOG (original)
+++ incubator/giraph/trunk/CHANGELOG Sun Dec 18 07:42:15 2011
@@ -2,6 +2,9 @@ Giraph Change Log
Release 0.70.0 - unreleased
+ GIRAPH-80: Don't expose the list holding the messages in
+ BasicVertex. (ssc via aching)
+
GIRAPH-103: Added properties for commonly used package version to
pom.xml. (aching)
Modified:
incubator/giraph/trunk/src/main/java/org/apache/giraph/comm/BasicRPCCommunications.java
URL:
http://svn.apache.org/viewvc/incubator/giraph/trunk/src/main/java/org/apache/giraph/comm/BasicRPCCommunications.java?rev=1220343&r1=1220342&r2=1220343&view=diff
==============================================================================
---
incubator/giraph/trunk/src/main/java/org/apache/giraph/comm/BasicRPCCommunications.java
(original)
+++
incubator/giraph/trunk/src/main/java/org/apache/giraph/comm/BasicRPCCommunications.java
Sun Dec 18 07:42:15 2011
@@ -1001,7 +1001,6 @@ end[HADOOP_FACEBOOK]*/
for (Partition<I, V, E, M> partition :
service.getPartitionMap().values()) {
for (BasicVertex<I, V, E, M> vertex : partition.getVertices())
{
- vertex.getMsgList().clear();
List<M> msgList = inMessages.get(vertex.getVertexId());
if (msgList != null) {
if (LOG.isDebugEnabled()) {
@@ -1015,7 +1014,7 @@ end[HADOOP_FACEBOOK]*/
"in inMessages");
}
}
- vertex.getMsgList().addAll(msgList);
+ vertex.setMessages(msgList);
msgList.clear();
if (inMessages.remove(vertex.getVertexId()) == null) {
throw new IllegalStateException(
@@ -1063,16 +1062,16 @@ end[HADOOP_FACEBOOK]*/
conf, service.getGraphMapper().getGraphState());
BasicVertex<I, V, E, M> originalVertex =
service.getVertex(vertexIndex);
- List<M> msgList = inMessages.get(vertexIndex);
+ Iterable<M> messages = inMessages.get(vertexIndex);
if (originalVertex != null) {
- msgList = originalVertex.getMsgList();
+ messages = originalVertex.getMessages();
}
VertexMutations<I, V, E, M> vertexMutations =
inVertexMutationsMap.get(vertexIndex);
BasicVertex<I, V, E, M> vertex =
vertexResolver.resolve(originalVertex,
vertexMutations,
- msgList);
+ messages);
if (LOG.isDebugEnabled()) {
LOG.debug("prepareSuperstep: Resolved vertex index " +
vertexIndex + " with original vertex " +
Modified:
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/BasicVertex.java
URL:
http://svn.apache.org/viewvc/incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/BasicVertex.java?rev=1220343&r1=1220342&r2=1220343&view=diff
==============================================================================
---
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/BasicVertex.java
(original)
+++
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/BasicVertex.java
Sun Dec 18 07:42:15 2011
@@ -180,11 +180,23 @@ public abstract class BasicVertex<I exte
return halt;
}
+ /**
+ * Get the list of incoming messages from the previous superstep. Same
as
+ * the message iterator passed to compute().
+ */
+ public abstract Iterable<M> getMessages();
+
+ /**
+ * Set the messages this vertex should process in the current superstep
+ *
+ * @param messages the messages sent to this vertex in the previous
superstep
+ */
+ public abstract void setMessages(Iterable<M> messages);
+
/**
- * Get the list of incoming messages from the previous superstep. Same as
- * the message iterator passed to compute().
- */
- public abstract List<M> getMsgList();
+ * Release unnecessary resources (will be called after vertex chose to
halt)
+ */
+ abstract void releaseResources();
/**
* Get the graph state for all workers.
Modified:
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/BasicVertexResolver.java
URL:
http://svn.apache.org/viewvc/incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/BasicVertexResolver.java?rev=1220343&r1=1220342&r2=1220343&view=diff
==============================================================================
---
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/BasicVertexResolver.java
(original)
+++
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/BasicVertexResolver.java
Sun Dec 18 07:42:15 2011
@@ -41,14 +41,13 @@ public interface BasicVertexResolver<
*
* @param vertex Original vertex or null if none
* @param vertexChanges Changes that happened to this vertex or null if
none
- * @param msgList List of messages received in the last superstep or null
- * if none
+ * @param messages messages received in the last superstep or null if none
* @return Vertex to be returned, if null, and a vertex currently exists
* it will be removed
*/
BasicVertex<I, V, E, M> resolve(BasicVertex<I, V, E, M> vertex,
VertexChanges<I, V, E, M> vertexChanges,
- List<M> msgList);
+ Iterable<M> messages);
/**
* Create a default vertex that can be used to return from resolve().
Modified:
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/EdgeListVertex.java
URL:
http://svn.apache.org/viewvc/incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/EdgeListVertex.java?rev=1220343&r1=1220342&r2=1220343&view=diff
==============================================================================
---
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/EdgeListVertex.java
(original)
+++
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/EdgeListVertex.java
Sun Dec 18 07:42:15 2011
@@ -18,6 +18,8 @@
package org.apache.giraph.graph;
+import com.google.common.collect.Iterables;
+import org.apache.giraph.utils.ComparisonUtils;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;
import org.apache.log4j.Logger;
@@ -61,7 +63,7 @@ public abstract class EdgeListVertex<I e
/** Map of destination vertices and their edge values */
private List<E> destEdgeValueList;
/** List of incoming messages from the previous superstep */
- private final List<M> msgList = new ArrayList<M>();
+ private final List<M> msgList = Lists.newArrayList();
@Override
public void initialize(I vertexId, V vertexValue,
@@ -103,20 +105,11 @@ public abstract class EdgeListVertex<I e
if (!getVertexValue().equals(otherVertex.getVertexValue())) {
return false;
}
- if (!getMsgList().equals(otherVertex.getMsgList())) {
+ if (!ComparisonUtils.equal(getMessages(),
+ ((EdgeListVertex) other).getMessages())) {
return false;
}
- Iterator<I> iterator = iterator();
- Iterator<I> otherIterator = otherVertex.iterator();
- while (iterator.hasNext() && otherIterator.hasNext()) {
- I index = iterator.next();
- I otherIndex = otherIterator.next();
- if (!(index == null ? otherIndex == null :
- index.equals(otherIndex))) {
- return false;
- }
- }
- return !(iterator.hasNext() || otherIterator.hasNext());
+ return ComparisonUtils.equal(iterator(), otherVertex.iterator());
}
return false;
}
@@ -318,8 +311,22 @@ public abstract class EdgeListVertex<I e
}
@Override
- public List<M> getMsgList() {
- return msgList;
+ public void setMessages(Iterable<M> messages) {
+ msgList.clear();
+ for (M message : messages) {
+ msgList.add(message);
+ }
+ }
+
+ @Override
+ public Iterable<M> getMessages() {
+ return Iterables.unmodifiableIterable(msgList);
+ }
+
+ @Override
+ void releaseResources() {
+ // Hint to GC to free the messages
+ msgList.clear();
}
@Override
Modified:
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/GraphMapper.java
URL:
http://svn.apache.org/viewvc/incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/GraphMapper.java?rev=1220343&r1=1220342&r2=1220343&view=diff
==============================================================================
---
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/GraphMapper.java
(original)
+++
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/GraphMapper.java
Sun Dec 18 07:42:15 2011
@@ -18,6 +18,7 @@
package org.apache.giraph.graph;
+import com.google.common.collect.Iterables;
import org.apache.giraph.bsp.CentralizedServiceWorker;
import org.apache.giraph.graph.partition.Partition;
import org.apache.giraph.graph.partition.PartitionOwner;
@@ -565,17 +566,16 @@ public class GraphMapper<I extends Writa
// Make sure every vertex has the current
// graphState before computing
basicVertex.setGraphState(graphState);
- if (basicVertex.isHalted() &&
- !basicVertex.getMsgList().isEmpty()) {
+ if (basicVertex.isHalted()
+ && !Iterables.isEmpty(basicVertex.getMessages())) {
basicVertex.halt = false;
}
if (!basicVertex.isHalted()) {
Iterator<M> vertexMsgIt =
- basicVertex.getMsgList().iterator();
+ basicVertex.getMessages().iterator();
context.progress();
basicVertex.compute(vertexMsgIt);
- // Hint to GC to free the messages
- basicVertex.getMsgList().clear();
+ basicVertex.releaseResources();
}
if (basicVertex.isHalted()) {
partitionStats.incrFinishedVertexCount();
Modified:
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/LongDoubleFloatDoubleVertex.java
URL:
http://svn.apache.org/viewvc/incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/LongDoubleFloatDoubleVertex.java?rev=1220343&r1=1220342&r2=1220343&view=diff
==============================================================================
---
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/LongDoubleFloatDoubleVertex.java
(original)
+++
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/LongDoubleFloatDoubleVertex.java
Sun Dec 18 07:42:15 2011
@@ -17,6 +17,7 @@
*/
package org.apache.giraph.graph;
+import com.google.common.collect.UnmodifiableIterator;
import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.FloatWritable;
import org.apache.hadoop.io.LongWritable;
@@ -27,8 +28,6 @@ import org.apache.mahout.math.map.OpenLo
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-import java.util.AbstractList;
-import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -243,31 +242,22 @@ public abstract class LongDoubleFloatDou
}
@Override
- public List<DoubleWritable> getMsgList() {
- return new AbstractList<DoubleWritable>() {
- @Override public DoubleWritable get(int i) {
- return new DoubleWritable(messageList.get(i));
- }
- @Override public int size() {
- return messageList.size();
- }
- @Override public boolean add(DoubleWritable dw) {
- messageList.add(dw.get());
- return true;
- }
- @Override public boolean addAll(Collection<? extends
DoubleWritable> collection) {
- for(DoubleWritable dw : collection) {
- messageList.add(dw.get());
- }
- return true;
- }
- @Override public void clear() {
- messageList.clear();
- }
- @Override public boolean isEmpty() {
- return messageList.isEmpty();
- }
- };
+ public void setMessages(Iterable<DoubleWritable> messages) {
+ messageList.clear();
+ for (DoubleWritable message : messages) {
+ messageList.add(message.get());
+ }
+ }
+
+ @Override
+ void releaseResources() {
+ // Hint to GC to free the messages
+ messageList.clear();
+ }
+
+ @Override
+ public Iterable<DoubleWritable> getMessages() {
+ return new UnmodifiableDoubleWritableIterable(messageList);
}
@Override
@@ -275,4 +265,42 @@ public abstract class LongDoubleFloatDou
return "Vertex(id=" + getVertexId() + ",value=" + getVertexValue() +
",#edges=" + getNumOutEdges() + ")";
}
+
+ private class UnmodifiableDoubleWritableIterable
+ implements Iterable<DoubleWritable> {
+
+ private final DoubleArrayList elementList;
+
+ public UnmodifiableDoubleWritableIterable(DoubleArrayList elementList)
{
+ this.elementList = elementList;
+ }
+
+ @Override
+ public Iterator<DoubleWritable> iterator() {
+ return new UnmodifiableDoubleWritableIterator(
+ elementList.elements());
+ }
+ }
+
+ private class UnmodifiableDoubleWritableIterator
+ extends UnmodifiableIterator<DoubleWritable> {
+
+ private final double[] elements;
+ private int offset;
+
+ UnmodifiableDoubleWritableIterator(double[] elements) {
+ offset = 0;
+ this.elements = elements;
+ }
+
+ @Override
+ public boolean hasNext() {
+ return offset < elements.length;
+ }
+
+ @Override
+ public DoubleWritable next() {
+ return new DoubleWritable(elements[offset++]);
+ }
+ }
}
Modified:
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/Vertex.java
URL:
http://svn.apache.org/viewvc/incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/Vertex.java?rev=1220343&r1=1220342&r2=1220343&view=diff
==============================================================================
--- incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/Vertex.java
(original)
+++ incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/Vertex.java
Sun Dec 18 07:42:15 2011
@@ -18,6 +18,8 @@
package org.apache.giraph.graph;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;
import org.apache.log4j.Logger;
@@ -58,7 +60,7 @@ public abstract class Vertex<I extends W
protected final Map<I, Edge<I, E>> destEdgeMap =
new HashMap<I, Edge<I, E>>();
/** List of incoming messages from the previous superstep */
- private final List<M> msgList = new ArrayList<M>();
+ private final List<M> msgList = Lists.newArrayList();
@Override
public void initialize(I vertexId, V vertexValue, Map<I, E> edges, List<M>
messages) {
@@ -241,8 +243,22 @@ public abstract class Vertex<I extends W
}
@Override
- public List<M> getMsgList() {
- return msgList;
+ public void setMessages(Iterable<M> messages) {
+ msgList.clear();
+ for (M message : messages) {
+ msgList.add(message);
+ }
+ }
+
+ @Override
+ public Iterable<M> getMessages() {
+ return Iterables.unmodifiableIterable(msgList);
+ }
+
+ @Override
+ void releaseResources() {
+ // Hint to GC to free the messages
+ msgList.clear();
}
@Override
Modified:
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/VertexResolver.java
URL:
http://svn.apache.org/viewvc/incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/VertexResolver.java?rev=1220343&r1=1220342&r2=1220343&view=diff
==============================================================================
---
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/VertexResolver.java
(original)
+++
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/VertexResolver.java
Sun Dec 18 07:42:15 2011
@@ -18,6 +18,7 @@
package org.apache.giraph.graph;
+import com.google.common.collect.Iterables;
import org.apache.hadoop.conf.Configurable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Writable;
@@ -51,7 +52,7 @@ public class VertexResolver<I extends Wr
public BasicVertex<I, V, E, M> resolve(
BasicVertex<I, V, E, M> vertex,
VertexChanges<I, V, E, M> vertexChanges,
- List<M> msgList) {
+ Iterable<M> messages) {
// Default algorithm:
// 1. If the vertex exists, first prune the edges
// 2. If vertex removal desired, remove the vertex.
@@ -83,7 +84,8 @@ public class VertexResolver<I extends Wr
vertex = vertexChanges.getAddedVertexList().get(0);
}
}
- if ((vertex == null) && (msgList != null) && (!msgList.isEmpty()))
{
+ if (vertex == null && messages != null
+ && !Iterables.isEmpty(messages)) {
vertex = instantiateVertex();
V vertexValue = BspUtils.<V>createVertexValue(getConf());
vertex.setVertexValue(vertexValue);
Added:
incubator/giraph/trunk/src/main/java/org/apache/giraph/utils/ComparisonUtils.java
URL:
http://svn.apache.org/viewvc/incubator/giraph/trunk/src/main/java/org/apache/giraph/utils/ComparisonUtils.java?rev=1220343&view=auto
==============================================================================
---
incubator/giraph/trunk/src/main/java/org/apache/giraph/utils/ComparisonUtils.java
(added)
+++
incubator/giraph/trunk/src/main/java/org/apache/giraph/utils/ComparisonUtils.java
Sun Dec 18 07:42:15 2011
@@ -0,0 +1,48 @@
+/*
+ * 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
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.giraph.utils;
+
+import java.util.Iterator;
+
+/** simple helper class for comparisons and equality checking */
+public class ComparisonUtils {
+
+ private ComparisonUtils() {
+ }
+
+ /** compare elements, sort order and length */
+ public static <T> boolean equal(Iterable<T> first, Iterable<T> second) {
+ return equal(first.iterator(), second.iterator());
+ }
+
+ /** compare elements, sort order and length */
+ public static <T> boolean equal(Iterator<T> first, Iterator<T> second) {
+ while (first.hasNext() && second.hasNext()) {
+ T message = first.next();
+ T otherMessage = second.next();
+ /* element-wise equality */
+ if (!(message == null ? otherMessage == null :
+ message.equals(otherMessage))) {
+ return false;
+ }
+ }
+ /* length must also be equal */
+ return !(first.hasNext() || second.hasNext());
+ }
+}
Modified:
incubator/giraph/trunk/src/main/java/org/apache/giraph/utils/MemoryUtils.java
URL:
http://svn.apache.org/viewvc/incubator/giraph/trunk/src/main/java/org/apache/giraph/utils/MemoryUtils.java?rev=1220343&r1=1220342&r2=1220343&view=diff
==============================================================================
---
incubator/giraph/trunk/src/main/java/org/apache/giraph/utils/MemoryUtils.java
(original)
+++
incubator/giraph/trunk/src/main/java/org/apache/giraph/utils/MemoryUtils.java
Sun Dec 18 07:42:15 2011
@@ -1,3 +1,21 @@
+/*
+ * 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
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.giraph.utils;
/**
Added:
incubator/giraph/trunk/src/test/java/org/apache/giraph/utils/ComparisonUtilsTest.java
URL:
http://svn.apache.org/viewvc/incubator/giraph/trunk/src/test/java/org/apache/giraph/utils/ComparisonUtilsTest.java?rev=1220343&view=auto
==============================================================================
---
incubator/giraph/trunk/src/test/java/org/apache/giraph/utils/ComparisonUtilsTest.java
(added)
+++
incubator/giraph/trunk/src/test/java/org/apache/giraph/utils/ComparisonUtilsTest.java
Sun Dec 18 07:42:15 2011
@@ -0,0 +1,67 @@
+/*
+ * 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
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.giraph.utils;
+
+import com.google.common.collect.Lists;
+import junit.framework.TestCase;
+
+public class ComparisonUtilsTest extends TestCase {
+
+ public void testEquality() {
+ Iterable<String> one = Lists.newArrayList("one", "two", "three");
+ Iterable<String> two = Lists.newArrayList("one", "two", "three");
+
+ assertTrue(ComparisonUtils.equal(one, one));
+ assertTrue(ComparisonUtils.equal(one, two));
+ assertTrue(ComparisonUtils.equal(two, two));
+ assertTrue(ComparisonUtils.equal(two, one));
+ }
+
+ public void testEqualityEmpty() {
+ Iterable<String> one = Lists.newArrayList();
+ Iterable<String> two = Lists.newArrayList();
+
+ assertTrue(ComparisonUtils.equal(one, one));
+ assertTrue(ComparisonUtils.equal(one, two));
+ assertTrue(ComparisonUtils.equal(two, two));
+ assertTrue(ComparisonUtils.equal(two, one));
+ }
+
+ public void testInEquality() {
+ Iterable<String> one = Lists.newArrayList("one", "two", "three");
+ Iterable<String> two = Lists.newArrayList("two", "three", "four");
+ Iterable<String> three = Lists.newArrayList();
+
+ assertFalse(ComparisonUtils.equal(one, two));
+ assertFalse(ComparisonUtils.equal(one, three));
+ assertFalse(ComparisonUtils.equal(two, one));
+ assertFalse(ComparisonUtils.equal(two, three));
+ assertFalse(ComparisonUtils.equal(three, one));
+ assertFalse(ComparisonUtils.equal(three, two));
+ }
+
+ public void testInEqualityDifferentLengths() {
+ Iterable<String> one = Lists.newArrayList("one", "two", "three");
+ Iterable<String> two = Lists.newArrayList("one", "two", "three",
"four");
+
+ assertFalse(ComparisonUtils.equal(one, two));
+ assertFalse(ComparisonUtils.equal(two, one));
+ }
+
+}