Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Dumoulin2013-12-15 21:21:07 +0000
committerCedric Dumoulin2014-01-27 13:56:55 +0000
commitd3d76e9101dddbc2a35bbcfb876f80b537c58b75 (patch)
tree0ff2eab3d0c1b24010365e4cebc3a12215a21401 /extraplugins/layers/org.eclipse.papyrus.layers.stackmodel
parent692fe0e743339ef6d0c5284b7842782587d0305b (diff)
downloadorg.eclipse.papyrus-d3d76e9101dddbc2a35bbcfb876f80b537c58b75.tar.gz
org.eclipse.papyrus-d3d76e9101dddbc2a35bbcfb876f80b537c58b75.tar.xz
org.eclipse.papyrus-d3d76e9101dddbc2a35bbcfb876f80b537c58b75.zip
bug 330199 - rename NotyfyingList to ObservableListView
Diffstat (limited to 'extraplugins/layers/org.eclipse.papyrus.layers.stackmodel')
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/exprmatcher/ExpressionMatcher.java12
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayersStackImpl.java4
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/RegExpLayerImpl.java6
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/util/ObservableListView.java (renamed from extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/util/NotyfyingList.java)38
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/exprmatcher/ExpressionMatcherTest.java16
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionInitWithApplicationImplTest.java3
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/util/FakeObservableListListener.java (renamed from extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/util/FakeNotifyingListListener.java)6
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/util/ObservableListTest.java (renamed from extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/util/NotyfyingListTest.java)106
8 files changed, 100 insertions, 91 deletions
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/exprmatcher/ExpressionMatcher.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/exprmatcher/ExpressionMatcher.java
index 8d33a4547c9..9280527e5ae 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/exprmatcher/ExpressionMatcher.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/exprmatcher/ExpressionMatcher.java
@@ -34,7 +34,7 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.ocl.ParserException;
import org.eclipse.ocl.ecore.OCL;
import org.eclipse.papyrus.layers.stackmodel.LayersException;
-import org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList;
+import org.eclipse.papyrus.layers.stackmodel.util.ObservableListView;
import com.google.common.collect.Lists;
@@ -57,7 +57,7 @@ public class ExpressionMatcher {
* List of element matching the expression.
* This class maintains the list.
*/
- protected NotyfyingList<View> matchingElements;
+ protected ObservableListView<View> matchingElements;
/**
* List of element used as starting point for search.
@@ -75,7 +75,7 @@ public class ExpressionMatcher {
this.expression = "";
this.searchRoots = Collections.emptyList();
// init matchingElements
- matchingElements = new NotyfyingList<View>(new ArrayList<View>());
+ matchingElements = new ObservableListView<View>(new ArrayList<View>());
}
/**
@@ -89,7 +89,7 @@ public class ExpressionMatcher {
this.expression = "";
this.searchRoots = searchRoots;
// init matchingElements
- matchingElements = new NotyfyingList<View>(new ArrayList<View>());
+ matchingElements = new ObservableListView<View>(new ArrayList<View>());
}
/**
@@ -112,7 +112,7 @@ public class ExpressionMatcher {
*/
public ExpressionMatcher(String expression, List<EObject> searchRoots) throws LayersException {
this.searchRoots = searchRoots;
- matchingElements = new NotyfyingList<View>(new ArrayList<View>());
+ matchingElements = new ObservableListView<View>(new ArrayList<View>());
// compute expr
setExpression(expression);
@@ -266,7 +266,7 @@ public class ExpressionMatcher {
/**
* @return the matchingElements
*/
- public NotyfyingList<View> getMatchingElements() {
+ public ObservableListView<View> getMatchingElements() {
return matchingElements;
}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayersStackImpl.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayersStackImpl.java
index ce18474b5a5..e5dcf98361c 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayersStackImpl.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayersStackImpl.java
@@ -527,6 +527,10 @@ MinimalEObjectImpl.Container implements LayersStack {
* @param addedLayer The added layer.
*/
protected void layerAdded(LayerExpression addedLayer) {
+ // Stop if there is no layer
+ if( addedLayer == null) {
+ return;
+ }
// init the layer
addedLayer.initLayer(this);
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/RegExpLayerImpl.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/RegExpLayerImpl.java
index 965885ead09..ede42349c03 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/RegExpLayerImpl.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/RegExpLayerImpl.java
@@ -41,7 +41,7 @@ import org.eclipse.papyrus.layers.stackmodel.layers.LayersStack;
import org.eclipse.papyrus.layers.stackmodel.layers.RegExpLayer;
import org.eclipse.papyrus.layers.stackmodel.notifier.DiagramViewEventNotifier;
import org.eclipse.papyrus.layers.stackmodel.notifier.IDiagramViewEventListener;
-import org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList;
+import org.eclipse.papyrus.layers.stackmodel.util.ObservableListView;
import com.google.common.eventbus.Subscribe;
@@ -419,7 +419,7 @@ public class RegExpLayerImpl extends AbstractLayerImpl implements RegExpLayer {
}
/**
- * Listener on {@link NotyfyingList} eventBus. This method is called each time a change occurs in the
+ * Listener on {@link ObservableListView} eventBus. This method is called each time a change occurs in the
* result of the expression.
* When the result change, the list of attached views is updated accordingly.
*
@@ -427,7 +427,7 @@ public class RegExpLayerImpl extends AbstractLayerImpl implements RegExpLayer {
* @param event
*/
@Subscribe
- public void expressionResultChanged( NotyfyingList<View>.NotifyingListEvent event) {
+ public void expressionResultChanged( ObservableListView<View>.ObservableListEvent event) {
System.out.println( this.getClass().getSimpleName() + ".expressionResultChanged()");
if( ! event.getAddedElements().isEmpty()) {
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/util/NotyfyingList.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/util/ObservableListView.java
index a07fe21e082..a7b8631b5a0 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/util/NotyfyingList.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/util/ObservableListView.java
@@ -24,7 +24,8 @@ import com.google.common.collect.Lists;
import com.google.common.eventbus.EventBus;
/**
- * A delegate list notifying of events on the delegated list.
+ * An observable list notifying of events on the delegated list.
+ * This view allows to observe a provided list.
* The following events are notified:
* <ul>
* <li>elements added</li>
@@ -35,18 +36,19 @@ import com.google.common.eventbus.EventBus;
* @author cedric dumoulin
*
*/
-public class NotyfyingList<E> extends ForwardingList<E>{
+public class ObservableListView<E> extends ForwardingList<E>{
protected List<E> delegate;
- protected EventBus eventBus = new EventBus(NotyfyingList.class.getName());
+ protected EventBus eventBus = new EventBus(ObservableListView.class.getName());
/**
* Constructor.
+ * Build an observable list based on the provided list.
*
* @param delegate
*/
- public NotyfyingList(List<E> delegate) {
+ public ObservableListView(List<E> delegate) {
this.delegate = delegate;
}
@@ -66,7 +68,7 @@ public class NotyfyingList<E> extends ForwardingList<E>{
public boolean add(E element) {
boolean isModified = delegate().add( element);
if( isModified) {
- eventBus.post(new NotifyingListEvent(element));
+ eventBus.post(new ObservableListEvent(element));
}
return isModified;
@@ -76,7 +78,7 @@ public class NotyfyingList<E> extends ForwardingList<E>{
public boolean addAll(Collection<? extends E> collection) {
boolean isModified = delegate().addAll(collection);
if( isModified) {
- eventBus.post(new NotifyingListEvent(collection));
+ eventBus.post(new ObservableListEvent(collection));
}
return isModified;
@@ -85,7 +87,7 @@ public class NotyfyingList<E> extends ForwardingList<E>{
@Override
public void add(int index, E element) {
delegate().add(index, element);
- eventBus.post(new NotifyingListEvent(element));
+ eventBus.post(new ObservableListEvent(element));
}
@Override
@@ -93,7 +95,7 @@ public class NotyfyingList<E> extends ForwardingList<E>{
// TODO Auto-generated method stub
boolean isModified = delegate().addAll(index, elements);
if( isModified) {
- eventBus.post(new NotifyingListEvent(elements));
+ eventBus.post(new ObservableListEvent(elements));
}
return isModified;
@@ -102,7 +104,7 @@ public class NotyfyingList<E> extends ForwardingList<E>{
@Override
public E remove(int index) {
E removed = super.remove(index);
- getEventBus().post( new NotifyingListEvent(null, removed));
+ getEventBus().post( new ObservableListEvent(null, removed));
return removed;
}
@@ -112,7 +114,7 @@ public class NotyfyingList<E> extends ForwardingList<E>{
public boolean remove(Object object) {
boolean isRemoved = super.remove(object);
if( isRemoved ) {
- getEventBus().post( new NotifyingListEvent(null, (E)object));
+ getEventBus().post( new ObservableListEvent(null, (E)object));
}
return isRemoved;
}
@@ -133,7 +135,7 @@ public class NotyfyingList<E> extends ForwardingList<E>{
// Do remove
boolean isRemoved = super.removeAll(collection);
if( isRemoved ) {
- getEventBus().post( new NotifyingListEvent(null, (Collection<? extends E>) removedElements));
+ getEventBus().post( new ObservableListEvent(null, (Collection<? extends E>) removedElements));
}
return isRemoved;
}
@@ -181,7 +183,7 @@ public class NotyfyingList<E> extends ForwardingList<E>{
// Fire event
boolean isModified = !(elementsToAdd.isEmpty() && elementsToRemove.isEmpty() );
if( isModified ) {
- getEventBus().post( new NotifyingListEvent(elementsToAdd, elementsToRemove));
+ getEventBus().post( new ObservableListEvent(elementsToAdd, elementsToRemove));
}
return isModified;
@@ -192,7 +194,7 @@ public class NotyfyingList<E> extends ForwardingList<E>{
* @author cedric dumoulin
*
*/
- public class NotifyingListEvent {
+ public class ObservableListEvent {
Collection<? extends E> addedElements = Collections.emptyList();
Collection<? extends E> removedElements = Collections.emptyList();
@@ -202,7 +204,7 @@ public class NotyfyingList<E> extends ForwardingList<E>{
* Constructor.
*
*/
- public NotifyingListEvent() {
+ public ObservableListEvent() {
this.addedElements = Collections.emptyList();
this.removedElements = Collections.emptyList();
}
@@ -212,7 +214,7 @@ public class NotyfyingList<E> extends ForwardingList<E>{
* Constructor.
*
*/
- public NotifyingListEvent(Collection<? extends E> addedElements) {
+ public ObservableListEvent(Collection<? extends E> addedElements) {
if( addedElements!=null ) {
this.addedElements = addedElements;
}
@@ -229,7 +231,7 @@ public class NotyfyingList<E> extends ForwardingList<E>{
* @param addedElements added elements or null
* @param removedElements removed elements or null
*/
- public NotifyingListEvent(Collection<? extends E> addedElements, Collection<? extends E> removedElements) {
+ public ObservableListEvent(Collection<? extends E> addedElements, Collection<? extends E> removedElements) {
if( addedElements!=null ) {
this.addedElements = addedElements;
}
@@ -252,7 +254,7 @@ public class NotyfyingList<E> extends ForwardingList<E>{
* @param addedElement An element added or null;
* @param removedElement An element added or null
*/
- public NotifyingListEvent( E addedElement, E removedElement) {
+ public ObservableListEvent( E addedElement, E removedElement) {
if( addedElement!=null ) {
addedElements = Collections.singletonList(addedElement);
@@ -275,7 +277,7 @@ public class NotyfyingList<E> extends ForwardingList<E>{
*
* @param addedElement An element added or null;
*/
- public NotifyingListEvent( E addedElement) {
+ public ObservableListEvent( E addedElement) {
if( addedElement!=null ) {
addedElements = Collections.singletonList(addedElement);
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/exprmatcher/ExpressionMatcherTest.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/exprmatcher/ExpressionMatcherTest.java
index 6f4ec02543c..8342bd85bf6 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/exprmatcher/ExpressionMatcherTest.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/exprmatcher/ExpressionMatcherTest.java
@@ -35,8 +35,8 @@ import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.Shape;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.layers.stackmodel.LayersException;
-import org.eclipse.papyrus.layers.stackmodel.util.FakeNotifyingListListener;
-import org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList;
+import org.eclipse.papyrus.layers.stackmodel.util.FakeObservableListListener;
+import org.eclipse.papyrus.layers.stackmodel.util.ObservableListView;
import org.eclipse.uml2.uml.NamedElement;
import org.junit.After;
import org.junit.Before;
@@ -312,7 +312,7 @@ public class ExpressionMatcherTest {
int addedElementCount = 0;
int expectedEventCount = 1;
- FakeNotifyingListListener<View> notifyingListListener = new FakeNotifyingListListener<View>();
+ FakeObservableListListener<View> notifyingListListener = new FakeObservableListListener<View>();
ExpressionMatcher expressionMatcher = new ExpressionMatcher(expression, diagram);
expressionMatcher.getMatchingElements().getEventBus().register(notifyingListListener);
@@ -325,7 +325,7 @@ public class ExpressionMatcherTest {
// Assert
assertSame("event propagated", expectedEventCount, notifyingListListener.traces.size());
- NotyfyingList<View>.NotifyingListEvent event = notifyingListListener.traces.get(0).notifier;
+ ObservableListView<View>.ObservableListEvent event = notifyingListListener.traces.get(0).notifier;
assertEquals("expected removed count", removedElementCount, event.getRemovedElements().size());
assertEquals("expected added count", addedElementCount, event.getAddedElements().size());
@@ -350,7 +350,7 @@ public class ExpressionMatcherTest {
int expectedEventCount = 1;
int viewsCount = diagram.getChildren().size();
- FakeNotifyingListListener<View> notifyingListListener = new FakeNotifyingListListener<View>();
+ FakeObservableListListener<View> notifyingListListener = new FakeObservableListListener<View>();
ExpressionMatcher expressionMatcher = new ExpressionMatcher(expression, diagram);
expressionMatcher.getMatchingElements().getEventBus().register(notifyingListListener);
@@ -366,7 +366,7 @@ public class ExpressionMatcherTest {
assertSame("event propagated", expectedEventCount, notifyingListListener.traces.size());
- NotyfyingList<View>.NotifyingListEvent event = notifyingListListener.traces.get(0).notifier;
+ ObservableListView<View>.ObservableListEvent event = notifyingListListener.traces.get(0).notifier;
assertEquals("expected removed count", removedElementCount, event.getRemovedElements().size());
assertEquals("expected added count", addedElementCount, event.getAddedElements().size());
@@ -391,7 +391,7 @@ public class ExpressionMatcherTest {
int expectedEventCount = 1;
int viewsCount = diagram.getChildren().size();
- FakeNotifyingListListener<View> notifyingListListener = new FakeNotifyingListListener<View>();
+ FakeObservableListListener<View> notifyingListListener = new FakeObservableListListener<View>();
ExpressionMatcher expressionMatcher = new ExpressionMatcher(expression, diagram);
expressionMatcher.getMatchingElements().getEventBus().register(notifyingListListener);
@@ -407,7 +407,7 @@ public class ExpressionMatcherTest {
assertSame("event propagated", expectedEventCount, notifyingListListener.traces.size());
- NotyfyingList<View>.NotifyingListEvent event = notifyingListListener.traces.get(0).notifier;
+ ObservableListView<View>.ObservableListEvent event = notifyingListListener.traces.get(0).notifier;
assertEquals("expected removed count", removedElementCount, event.getRemovedElements().size());
assertEquals("expected added count", addedElementCount, event.getAddedElements().size());
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionInitWithApplicationImplTest.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionInitWithApplicationImplTest.java
index 979a03aa816..f2c151717cc 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionInitWithApplicationImplTest.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionInitWithApplicationImplTest.java
@@ -30,6 +30,7 @@ import org.eclipse.papyrus.layers.stackmodel.layers.TopLayerOperator;
import org.eclipse.papyrus.layers.stackmodel.layers.util.LayersFactoryTestUtils;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
/**
@@ -157,6 +158,7 @@ public class LayerExpressionInitWithApplicationImplTest {
* Test method for {@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerExpressionImpl#isLayerEnabled()}.
*/
@Test
+ @Ignore
public void testIsLayerEnabled() {
fail("Not yet implemented");
}
@@ -165,6 +167,7 @@ public class LayerExpressionInitWithApplicationImplTest {
* Test method for {@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerExpressionImpl#isBranchEnabled()}.
*/
@Test
+ @Ignore
public void testIsBranchEnabled() {
fail("Not yet implemented");
}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/util/FakeNotifyingListListener.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/util/FakeObservableListListener.java
index cfc45543aca..b9fa49ebb0e 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/util/FakeNotifyingListListener.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/util/FakeObservableListListener.java
@@ -22,12 +22,12 @@ import com.google.common.eventbus.Subscribe;
* @author cedric dumoulin
*
*/
-public class FakeNotifyingListListener<E> {
+public class FakeObservableListListener<E> {
/**
* Trace object tracking events
*/
- public TriggeredEventTraces<NotyfyingList<E>.NotifyingListEvent> traces = new TriggeredEventTraces<NotyfyingList<E>.NotifyingListEvent>();
+ public TriggeredEventTraces<ObservableListView<E>.ObservableListEvent> traces = new TriggeredEventTraces<ObservableListView<E>.ObservableListEvent>();
/**
@@ -35,7 +35,7 @@ public class FakeNotifyingListListener<E> {
* @param event
*/
@Subscribe
- public void elementAddedToList(NotyfyingList<E>.NotifyingListEvent event) {
+ public void elementAddedToList(ObservableListView<E>.ObservableListEvent event) {
traces.addTrace("elementAddedToList", event);
}
}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/util/NotyfyingListTest.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/util/ObservableListTest.java
index 7179a150157..f27d9bdc95b 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/util/NotyfyingListTest.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/util/ObservableListTest.java
@@ -27,10 +27,10 @@ import org.junit.Test;
import com.google.common.collect.Lists;
/**
- * @author dumoulin
+ * @author cedric dumoulin
*
*/
-public class NotyfyingListTest {
+public class ObservableListTest {
/**
* @throws java.lang.Exception
@@ -47,44 +47,44 @@ public class NotyfyingListTest {
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#NotyfyingList(java.util.List)}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#ObservableList(java.util.List)}.
*/
@Test
- public void testNotyfyingList() {
+ public void testObservableList() {
List<String> list = Lists.newArrayList( "red", "orange", "yellow", "green", "blue", "purple");
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
assertNotNull("Object created", notyfyingList);
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#delegate()}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#delegate()}.
*/
@Test
public void testDelegate() {
List<String> list = Lists.newArrayList( "red", "orange", "yellow", "green", "blue", "purple");
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
assertSame("delegate is set", list, notyfyingList.delegate() );
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#getEventBus()}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#getEventBus()}.
*/
@Test
public void testGetEventBus() {
List<String> list = Lists.newArrayList( "red", "orange", "yellow", "green", "blue", "purple");
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
assertNotNull("eventBus found", notyfyingList.getEventBus() );
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#add(java.lang.Object)}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#add(java.lang.Object)}.
*/
@Test
public void testAddE() {
@@ -93,8 +93,8 @@ public class NotyfyingListTest {
int listSizeBefore = list.size();
int expectedListSizeAfter = listSizeBefore+1;
- FakeNotifyingListListener<String> notifyingListListener = new FakeNotifyingListListener<String>();
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
+ FakeObservableListListener<String> notifyingListListener = new FakeObservableListListener<String>();
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
notyfyingList.getEventBus().register(notifyingListListener );
@@ -113,7 +113,7 @@ public class NotyfyingListTest {
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#addAll(java.util.Collection)}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#addAll(java.util.Collection)}.
*/
@Test
public void testAddAllCollectionOfQextendsE() {
@@ -122,8 +122,8 @@ public class NotyfyingListTest {
int listSizeBefore = list.size();
int expectedListSizeAfter = listSizeBefore+addedElements.size();
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
- FakeNotifyingListListener<String> notifyingListListener = new FakeNotifyingListListener<String>();
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
+ FakeObservableListListener<String> notifyingListListener = new FakeObservableListListener<String>();
notyfyingList.getEventBus().register(notifyingListListener );
@@ -140,7 +140,7 @@ public class NotyfyingListTest {
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#add(int, java.lang.Object)}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#add(int, java.lang.Object)}.
*/
@Test
public void testAddIntE() {
@@ -149,8 +149,8 @@ public class NotyfyingListTest {
int listSizeBefore = list.size();
int expectedListSizeAfter = listSizeBefore+1;
- FakeNotifyingListListener<String> notifyingListListener = new FakeNotifyingListListener<String>();
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
+ FakeObservableListListener<String> notifyingListListener = new FakeObservableListListener<String>();
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
notyfyingList.getEventBus().register(notifyingListListener );
@@ -169,7 +169,7 @@ public class NotyfyingListTest {
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#addAll(int, java.util.Collection)}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#addAll(int, java.util.Collection)}.
*/
@Test
public void testAddAllIntCollectionOfQextendsE() {
@@ -178,8 +178,8 @@ public class NotyfyingListTest {
int listSizeBefore = list.size();
int expectedListSizeAfter = listSizeBefore+addedElements.size();
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
- FakeNotifyingListListener<String> notifyingListListener = new FakeNotifyingListListener<String>();
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
+ FakeObservableListListener<String> notifyingListListener = new FakeObservableListListener<String>();
notyfyingList.getEventBus().register(notifyingListListener );
@@ -196,7 +196,7 @@ public class NotyfyingListTest {
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#remove(int)}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#remove(int)}.
*/
@Test
public void testRemoveInt() {
@@ -205,8 +205,8 @@ public class NotyfyingListTest {
int listSizeBefore = list.size();
int expectedListSizeAfter = listSizeBefore-1;
- FakeNotifyingListListener<String> notifyingListListener = new FakeNotifyingListListener<String>();
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
+ FakeObservableListListener<String> notifyingListListener = new FakeObservableListListener<String>();
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
notyfyingList.getEventBus().register(notifyingListListener );
@@ -215,7 +215,7 @@ public class NotyfyingListTest {
// Assertions
assertSame("event propagated", 1, notifyingListListener.traces.size());
- NotyfyingList<String>.NotifyingListEvent event = notifyingListListener.traces.get(0).notifier;
+ ObservableListView<String>.ObservableListEvent event = notifyingListListener.traces.get(0).notifier;
assertTrue("event removesElement is correct", event.getRemovedElements().contains(removedElement));
assertEquals("addedElement size", 0, event.getAddedElements().size() );
@@ -226,7 +226,7 @@ public class NotyfyingListTest {
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#remove(java.lang.Object)}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#remove(java.lang.Object)}.
*/
@Test
public void testRemoveObject() {
@@ -236,8 +236,8 @@ public class NotyfyingListTest {
int listSizeBefore = list.size();
int expectedListSizeAfter = listSizeBefore-1;
- FakeNotifyingListListener<String> notifyingListListener = new FakeNotifyingListListener<String>();
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
+ FakeObservableListListener<String> notifyingListListener = new FakeObservableListListener<String>();
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
notyfyingList.getEventBus().register(notifyingListListener );
@@ -246,7 +246,7 @@ public class NotyfyingListTest {
// Assertions
assertSame("event propagated", 1, notifyingListListener.traces.size());
- NotyfyingList<String>.NotifyingListEvent event = notifyingListListener.traces.get(0).notifier;
+ ObservableListView<String>.ObservableListEvent event = notifyingListListener.traces.get(0).notifier;
assertTrue("event removesElement is correct", event.getRemovedElements().contains(removedElement));
assertEquals("addedElement size", 0, event.getAddedElements().size() );
@@ -257,7 +257,7 @@ public class NotyfyingListTest {
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#removeAll(java.util.Collection)}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#removeAll(java.util.Collection)}.
*/
@Test
public void testRemoveAllCollectionOfQ() {
@@ -267,8 +267,8 @@ public class NotyfyingListTest {
int removedElementsCount = elementsToRemove.size();
int expectedListSizeAfter = listSizeBefore-removedElementsCount;
- FakeNotifyingListListener<String> notifyingListListener = new FakeNotifyingListListener<String>();
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
+ FakeObservableListListener<String> notifyingListListener = new FakeObservableListListener<String>();
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
notyfyingList.getEventBus().register(notifyingListListener );
@@ -278,7 +278,7 @@ public class NotyfyingListTest {
// Assertions
assertSame("event propagated", 1, notifyingListListener.traces.size());
- NotyfyingList<String>.NotifyingListEvent event = notifyingListListener.traces.get(0).notifier;
+ ObservableListView<String>.ObservableListEvent event = notifyingListListener.traces.get(0).notifier;
assertTrue("event removesElement is correct", event.getRemovedElements().containsAll(elementsToRemove));
assertEquals("addedElement size", 0, event.getAddedElements().size() );
@@ -289,7 +289,7 @@ public class NotyfyingListTest {
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#removeAll(java.util.Collection)}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#removeAll(java.util.Collection)}.
*/
@Test
public void testRemoveAllCollectionOfQWithTooMuchElements() {
@@ -299,8 +299,8 @@ public class NotyfyingListTest {
int removedElementsCount = elementsToRemove.size()-2; // 2 = falseColors
int expectedListSizeAfter = listSizeBefore-removedElementsCount;
- FakeNotifyingListListener<String> notifyingListListener = new FakeNotifyingListListener<String>();
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
+ FakeObservableListListener<String> notifyingListListener = new FakeObservableListListener<String>();
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
notyfyingList.getEventBus().register(notifyingListListener );
@@ -310,7 +310,7 @@ public class NotyfyingListTest {
// Assertions
assertSame("event propagated", 1, notifyingListListener.traces.size());
- NotyfyingList<String>.NotifyingListEvent event = notifyingListListener.traces.get(0).notifier;
+ ObservableListView<String>.ObservableListEvent event = notifyingListListener.traces.get(0).notifier;
// assertTrue("event removesElement is correct", event.getRemovedElements().containsAll(elementsToRemove));
assertTrue("removed elements are from the required list", elementsToRemove.containsAll(event.getRemovedElements()));
@@ -322,7 +322,7 @@ public class NotyfyingListTest {
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#resetTo(java.util.Collection)}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#resetTo(java.util.Collection)}.
*/
@Test
public void testResetTo() {
@@ -334,8 +334,8 @@ public class NotyfyingListTest {
int expectedEventCount = 1;
- FakeNotifyingListListener<String> notifyingListListener = new FakeNotifyingListListener<String>();
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
+ FakeObservableListListener<String> notifyingListListener = new FakeObservableListListener<String>();
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
notyfyingList.getEventBus().register(notifyingListListener );
@@ -346,13 +346,13 @@ public class NotyfyingListTest {
assertSame("event propagated", expectedEventCount, notifyingListListener.traces.size());
assertArrayEquals("List equals", listToReset.toArray(), notyfyingList.toArray());
- NotyfyingList<String>.NotifyingListEvent event = notifyingListListener.traces.get(0).notifier;
+ ObservableListView<String>.ObservableListEvent event = notifyingListListener.traces.get(0).notifier;
assertArrayEquals("Removed list ok", expectedRemovedElement.toArray(), event.getRemovedElements().toArray());
assertArrayEquals("Added list ok", expectedAddedElement.toArray(), event.getAddedElements().toArray());
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#resetTo(java.util.Collection)}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#resetTo(java.util.Collection)}.
*/
@Test
public void testResetToNoAdded() {
@@ -364,8 +364,8 @@ public class NotyfyingListTest {
int expectedEventCount = 1;
- FakeNotifyingListListener<String> notifyingListListener = new FakeNotifyingListListener<String>();
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
+ FakeObservableListListener<String> notifyingListListener = new FakeObservableListListener<String>();
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
notyfyingList.getEventBus().register(notifyingListListener );
@@ -376,13 +376,13 @@ public class NotyfyingListTest {
assertSame("event propagated", expectedEventCount, notifyingListListener.traces.size());
assertArrayEquals("List equals", listToReset.toArray(), notyfyingList.toArray());
- NotyfyingList<String>.NotifyingListEvent event = notifyingListListener.traces.get(0).notifier;
+ ObservableListView<String>.ObservableListEvent event = notifyingListListener.traces.get(0).notifier;
assertArrayEquals("Removed list ok", expectedRemovedElement.toArray(), event.getRemovedElements().toArray());
assertArrayEquals("Added list ok", expectedAddedElement.toArray(), event.getAddedElements().toArray());
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#resetTo(java.util.Collection)}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#resetTo(java.util.Collection)}.
*/
@Test
public void testResetToWithAddition() {
@@ -394,8 +394,8 @@ public class NotyfyingListTest {
int expectedEventCount = 1;
- FakeNotifyingListListener<String> notifyingListListener = new FakeNotifyingListListener<String>();
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
+ FakeObservableListListener<String> notifyingListListener = new FakeObservableListListener<String>();
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
notyfyingList.getEventBus().register(notifyingListListener );
@@ -406,13 +406,13 @@ public class NotyfyingListTest {
assertSame("event propagated", expectedEventCount, notifyingListListener.traces.size());
assertArrayEquals("List equals", listToReset.toArray(), notyfyingList.toArray());
- NotyfyingList<String>.NotifyingListEvent event = notifyingListListener.traces.get(0).notifier;
+ ObservableListView<String>.ObservableListEvent event = notifyingListListener.traces.get(0).notifier;
assertArrayEquals("Removed list ok", expectedRemovedElement.toArray(), event.getRemovedElements().toArray());
assertArrayEquals("Added list ok", expectedAddedElement.toArray(), event.getAddedElements().toArray());
}
/**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList#resetTo(java.util.Collection)}.
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.util.ObservableListView#resetTo(java.util.Collection)}.
*/
@Test
public void testResetToNoChanges() {
@@ -425,8 +425,8 @@ public class NotyfyingListTest {
// No change, no events
int expectedEventCount = 0;
- FakeNotifyingListListener<String> notifyingListListener = new FakeNotifyingListListener<String>();
- NotyfyingList<String> notyfyingList = new NotyfyingList<String>(list);
+ FakeObservableListListener<String> notifyingListListener = new FakeObservableListListener<String>();
+ ObservableListView<String> notyfyingList = new ObservableListView<String>(list);
notyfyingList.getEventBus().register(notifyingListListener );
@@ -437,7 +437,7 @@ public class NotyfyingListTest {
assertSame("event propagated", expectedEventCount, notifyingListListener.traces.size());
assertArrayEquals("List equals", listToReset.toArray(), notyfyingList.toArray());
-// NotyfyingList<String>.NotifyingListEvent event = notifyingListListener.traces.get(0).notifier;
+// ObservableList<String>.NotifyingListEvent event = notifyingListListener.traces.get(0).notifier;
// assertArrayEquals("Removed list ok", expectedRemovedElement.toArray(), event.getRemovedElements().toArray());
// assertArrayEquals("Added list ok", expectedAddedElement.toArray(), event.getAddedElements().toArray());
}

Back to the top