Author: kono
Date: 2010-09-17 18:23:46 -0700 (Fri, 17 Sep 2010)
New Revision: 21938
Added:
core3/vizmap-impl/branches/vp-tree/src/test/java/org/cytoscape/view/
core3/vizmap-impl/branches/vp-tree/src/test/java/org/cytoscape/view/vizmap/
core3/vizmap-impl/branches/vp-tree/src/test/java/org/cytoscape/view/vizmap/VisualStyleTest.java
Removed:
core3/vizmap-impl/branches/vp-tree/src/test/java/org/cytoscape/vizmap/
Modified:
core3/vizmap-impl/branches/vp-tree/pom.xml
core3/vizmap-impl/branches/vp-tree/src/integration/java/integration/ITVzmapImpl.java
core3/vizmap-impl/branches/vp-tree/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleFactoryImpl.java
core3/vizmap-impl/branches/vp-tree/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
Log:
Start adding tests (both unit and integration).
Modified: core3/vizmap-impl/branches/vp-tree/pom.xml
===================================================================
--- core3/vizmap-impl/branches/vp-tree/pom.xml 2010-09-18 01:21:04 UTC (rev
21937)
+++ core3/vizmap-impl/branches/vp-tree/pom.xml 2010-09-18 01:23:46 UTC (rev
21938)
@@ -157,5 +157,24 @@
<version>1.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>3.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>vizmap-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>presentation-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
Modified:
core3/vizmap-impl/branches/vp-tree/src/integration/java/integration/ITVzmapImpl.java
===================================================================
---
core3/vizmap-impl/branches/vp-tree/src/integration/java/integration/ITVzmapImpl.java
2010-09-18 01:21:04 UTC (rev 21937)
+++
core3/vizmap-impl/branches/vp-tree/src/integration/java/integration/ITVzmapImpl.java
2010-09-18 01:23:46 UTC (rev 21938)
@@ -24,7 +24,7 @@
},
new String[] { "visualStyleFactory",
"visualMappingManager" },
new Class[] { VisualStyleFactory.class,
VisualMappingManager.class },
- new String[] { });
+ new String[] { "org.cytoscape.view.vizmap"});
}
}
Modified:
core3/vizmap-impl/branches/vp-tree/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleFactoryImpl.java
===================================================================
---
core3/vizmap-impl/branches/vp-tree/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleFactoryImpl.java
2010-09-18 01:21:04 UTC (rev 21937)
+++
core3/vizmap-impl/branches/vp-tree/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleFactoryImpl.java
2010-09-18 01:23:46 UTC (rev 21938)
@@ -3,8 +3,8 @@
import java.util.Collection;
import org.cytoscape.event.CyEventHelper;
+import org.cytoscape.view.model.VisualLexicon;
import org.cytoscape.view.model.VisualProperty;
-import org.cytoscape.view.presentation.RenderingEngine;
import org.cytoscape.view.vizmap.VisualMappingFunction;
import org.cytoscape.view.vizmap.VisualStyle;
import org.cytoscape.view.vizmap.VisualStyleFactory;
@@ -40,8 +40,8 @@
@Override
- public VisualStyle createVisualStyle(String title, RenderingEngine<?>
engine) {
- final VisualStyle vs = new VisualStyleImpl(title,
engine.getVisualLexicon());
+ public VisualStyle createVisualStyle(String title, final VisualLexicon
lexicon) {
+ final VisualStyle vs = new VisualStyleImpl(title, lexicon);
eventHelper.fireSynchronousEvent(new
VisualStyleCreatedEvent(this,vs));
return vs;
Modified:
core3/vizmap-impl/branches/vp-tree/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
===================================================================
---
core3/vizmap-impl/branches/vp-tree/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
2010-09-18 01:21:04 UTC (rev 21937)
+++
core3/vizmap-impl/branches/vp-tree/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
2010-09-18 01:23:46 UTC (rev 21938)
@@ -37,6 +37,7 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyNode;
@@ -143,11 +144,11 @@
* @return DOCUMENT ME!
*/
@SuppressWarnings("unchecked")
- public <V> VisualMappingFunction<?, V> removeVisualMappingFunction(
- VisualProperty<V> t) {
- return (VisualMappingFunction<?, V>) mappings.remove(t);
+ @Override public void removeVisualMappingFunction(VisualProperty<?> t) {
+ mappings.remove(t);
}
+
/**
* DOCUMENT ME!
*
@@ -159,7 +160,7 @@
* @return DOCUMENT ME!
*/
@SuppressWarnings("unchecked")
- public <V> V getDefaultValue(final VisualProperty<? extends V> vp) {
+ @Override public <V> V getDefaultValue(final VisualProperty<V> vp) {
// Since setter checks type, this cast is always legal.
return (V) perVSDefaults.get(vp);
}
@@ -174,8 +175,8 @@
* @param value
* DOCUMENT ME!
*/
- public <T> void setDefaultValue(final VisualProperty<? extends T> vp,
- final T value) {
+ @Override public <V, S extends V> void setDefaultValue(final
VisualProperty<V> vp,
+ final S value) {
perVSDefaults.put(vp, value);
}
@@ -210,10 +211,6 @@
logger.debug("Visual Style applied: " + this.title + "\n");
}
- private void traverse() {
-
- }
-
/**
* DOCUMENT ME!
*
@@ -251,7 +248,9 @@
// If mapping is available for this VP, apply the mapping.
if (mapping != null) {
- mapping.apply(views);
+
+ for(View<? extends CyTableEntry> view:views)
+ mapping.apply(view);
} else if (!vp.isIgnoreDefault()) { // Check ignore flag first.
applyStyleDefaults(views, vp);
} else
@@ -311,7 +310,7 @@
return this.title;
}
- public Collection<VisualMappingFunction<?, ?>>
getAllVisualMappingFunctions() {
+ @Override public Collection<VisualMappingFunction<?, ?>>
getAllVisualMappingFunctions() {
return mappings.values();
}
Copied:
core3/vizmap-impl/branches/vp-tree/src/test/java/org/cytoscape/view/vizmap
(from rev 21884,
core3/vizmap-impl/branches/vp-tree/src/test/java/org/cytoscape/vizmap)
Copied:
core3/vizmap-impl/branches/vp-tree/src/test/java/org/cytoscape/view/vizmap/VisualStyleTest.java
(from rev 21916,
core3/vizmap-impl/branches/vp-tree/src/test/java/org/cytoscape/vizmap/VisualStyleTest.java)
===================================================================
---
core3/vizmap-impl/branches/vp-tree/src/test/java/org/cytoscape/view/vizmap/VisualStyleTest.java
(rev 0)
+++
core3/vizmap-impl/branches/vp-tree/src/test/java/org/cytoscape/view/vizmap/VisualStyleTest.java
2010-09-18 01:23:46 UTC (rev 21938)
@@ -0,0 +1,28 @@
+package org.cytoscape.view.vizmap;
+
+import static org.easymock.EasyMock.*;
+
+import org.cytoscape.event.CyEventHelper;
+import org.cytoscape.view.vizmap.AbstractVisualStyleTest;
+import org.cytoscape.view.vizmap.internal.VisualStyleFactoryImpl;
+import org.junit.After;
+import org.junit.Before;
+
+public class VisualStyleTest extends AbstractVisualStyleTest {
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+
+ final CyEventHelper helperMock =
createMock(CyEventHelper.class);
+ final VisualStyleFactoryImpl visualStyleFactory = new
VisualStyleFactoryImpl(helperMock);
+ originalTitle = "Style 1";
+ newTitle = "Style 2";
+ style = visualStyleFactory.createVisualStyle(originalTitle,
lexicon);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.