Author: mes
Date: 2010-10-05 14:08:37 -0700 (Tue, 05 Oct 2010)
New Revision: 22157
Modified:
core3/session-api/trunk/pom.xml
core3/session-api/trunk/src/main/java/org/cytoscape/session/CySession.java
core3/session-api/trunk/src/test/java/org/cytoscape/session/CySessionTest.java
Log:
updated to reflect changes in property-api
Modified: core3/session-api/trunk/pom.xml
===================================================================
--- core3/session-api/trunk/pom.xml 2010-10-05 20:57:02 UTC (rev 22156)
+++ core3/session-api/trunk/pom.xml 2010-10-05 21:08:37 UTC (rev 22157)
@@ -133,6 +133,11 @@
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>property-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
Modified:
core3/session-api/trunk/src/main/java/org/cytoscape/session/CySession.java
===================================================================
--- core3/session-api/trunk/src/main/java/org/cytoscape/session/CySession.java
2010-10-05 20:57:02 UTC (rev 22156)
+++ core3/session-api/trunk/src/main/java/org/cytoscape/session/CySession.java
2010-10-05 21:08:37 UTC (rev 22157)
@@ -28,10 +28,11 @@
*/
package org.cytoscape.session;
-import org.cytoscape.session.CySession;
import org.cytoscape.model.CyTable;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.vizmap.VisualStyle;
+import org.cytoscape.property.bookmark.Bookmarks;
+import org.cytoscape.property.session.Cysession;
import java.util.Properties;
import java.util.Set;
import java.util.HashSet;
@@ -69,8 +70,9 @@
private final Map<CyNetworkView,String> vsMap;
private final Properties cyProps;
private final Properties vProps;
- private final Properties dProps;
private final Map<String, List<File>> pluginFiles;
+ private final Bookmarks bookmarks;
+ private final Cysession cysession;
private static final Logger logger =
LoggerFactory.getLogger(CySession.class);
@@ -102,15 +104,20 @@
else
vProps = b.vProps;
- if ( b.dProps == null )
- dProps = new Properties();
- else
- dProps = b.dProps;
-
if ( b.pluginFiles == null )
pluginFiles = new HashMap<String, List<File>>();
else
pluginFiles = b.pluginFiles;
+
+ if ( b.bookmarks == null )
+ bookmarks = new Bookmarks();
+ else
+ bookmarks = b.bookmarks;
+
+ if ( b.cysession == null )
+ cysession = new Cysession();
+ else
+ cysession = b.cysession;
}
public static class Builder {
@@ -120,8 +127,9 @@
private Map<CyNetworkView,String> vsMap;
private Properties cyProps;
private Properties vProps;
- private Properties dProps;
private Map<String, List<File>> pluginFiles;
+ private Bookmarks bookmarks;
+ private Cysession cysession;
/**
* Returns a complete instance of CySession based upon the
methods
@@ -187,26 +195,37 @@
}
/**
- * @param p A Properties object that contains properties
defining
- * the current state of the Desktop in Cytoscape.
+ * @param p A map of plugin names to a list of File objects
that the
+ * given plugin wants stored in the session file.
* @return An instance of Builder that has at least been
configured
- * with the specified properties.
+ * with the specified plugin file list map.
*/
- public Builder desktopProperties(final Properties p) {
- dProps = p;
+ public Builder pluginFileListMap(final Map<String, List<File>>
p) {
+ this.pluginFiles = p;
return this;
}
/**
- * @param p A map of plugin names to a list of File objects
that the
- * given plugin wants stored in the session file.
+ * @param b A Bookmarks object containing all bookmarks defined
+ * for this session.
* @return An instance of Builder that has at least been
configured
- * with the specified plugin file list map.
+ * with the specified bookmarks.
*/
- public Builder pluginFileListMap(final Map<String, List<File>>
p) {
- this.pluginFiles = p;
+ public Builder bookmarks(final Bookmarks b) {
+ this.bookmarks = b;
return this;
}
+
+ /**
+ * @param s A {...@link Cysession} object containing the
session descriptor
+ * for this session.
+ * @return An instance of Builder that has at least been
configured
+ * with the specified session descriptor.
+ */
+ public Builder cysession(final Cysession s) {
+ this.cysession = s;
+ return this;
+ }
}
/**
@@ -238,12 +257,16 @@
public Properties getVizmapProperties() { return vProps; }
/**
- * @return A Propeties object containing all desktop configuration
properties
- * for this session.
+ * @return A {...@link Bookmarks} object containing all bookmarks for
this session.
*/
- public Properties getDesktopProperties() { return dProps; }
+ public Bookmarks getBookmarks() { return bookmarks; }
/**
+ * @return A {...@link Cysession} object containing a description of
this session.
+ */
+ public Cysession getCysession() { return cysession; }
+
+ /**
* @return A map of plugin names to lists of File objects that are
stored
* as part of the session for the specified plugin.
*/
Modified:
core3/session-api/trunk/src/test/java/org/cytoscape/session/CySessionTest.java
===================================================================
---
core3/session-api/trunk/src/test/java/org/cytoscape/session/CySessionTest.java
2010-10-05 20:57:02 UTC (rev 22156)
+++
core3/session-api/trunk/src/test/java/org/cytoscape/session/CySessionTest.java
2010-10-05 21:08:37 UTC (rev 22157)
@@ -7,6 +7,8 @@
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.model.CyTable;
import org.cytoscape.session.CySession;
+import org.cytoscape.property.session.Cysession;
+import org.cytoscape.property.bookmark.Bookmarks;
import org.junit.Before;
import org.junit.Test;
import static org.mockito.Mockito.*;
@@ -162,28 +164,52 @@
}
@Test
- public void testDefaultGetDesktopProperties() {
+ public void testDefaultGetBookmarks() {
session = new CySession.Builder().build();
assertNotNull(session);
- assertNotNull(session.getDesktopProperties());
+ assertNotNull(session.getBookmarks());
}
@Test
- public void testSetNullDesktopProperties() {
- session = new
CySession.Builder().desktopProperties(null).build();
+ public void testSetNullBookmarks() {
+ session = new CySession.Builder().bookmarks(null).build();
assertNotNull(session);
- assertNotNull(session.getDesktopProperties());
- assertEquals(0,session.getDesktopProperties().size());
+ assertNotNull(session.getBookmarks());
}
@Test
- public void testSetDesktopProperties() {
- session = new
CySession.Builder().desktopProperties(getFakeProps()).build();
+ public void testSetBookmarks() {
+ Bookmarks b = mock(Bookmarks.class);
+ session = new CySession.Builder().bookmarks(b).build();
assertNotNull(session);
- checkProps(session.getDesktopProperties());
+ assertNotNull(session.getBookmarks());
+ assertEquals(b, session.getBookmarks());
}
@Test
+ public void testDefaultGetSession() {
+ session = new CySession.Builder().build();
+ assertNotNull(session);
+ assertNotNull(session.getCysession());
+ }
+
+ @Test
+ public void testSetNullSession() {
+ session = new CySession.Builder().cysession(null).build();
+ assertNotNull(session);
+ assertNotNull(session.getCysession());
+ }
+
+ @Test
+ public void testSetSession() {
+ Cysession b = mock(Cysession.class);
+ session = new CySession.Builder().cysession(b).build();
+ assertNotNull(session);
+ assertNotNull(session.getCysession());
+ assertEquals(b, session.getCysession());
+ }
+
+ @Test
public void testDefaultGetPluginFileListMap() {
session = new CySession.Builder().build();
assertNotNull(session);
--
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.