Update of /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper/resource
In directory sc8-pr-cvs1:/tmp/cvs-serv19607/src/java/core/org/krysalis/ruper/resource
Modified Files:
ResourceGroup.java Resource.java
Log Message:
Started a mock repository, for unit testing.
Index: ResourceGroup.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper/resource/ResourceGroup.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ResourceGroup.java 8 Sep 2003 23:21:41 -0000 1.3
--- ResourceGroup.java 25 Sep 2003 23:05:45 -0000 1.4
***************
*** 13,23 ****
public ResourceGroup(String group) {
m_group = group;
! }
!
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object otherGroup) {
! return m_group.equals(((ResourceGroup)otherGroup).m_group);
}
--- 13,23 ----
public ResourceGroup(String group) {
m_group = group;
! }
!
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object otherGroup) {
! return m_group.equals(((ResourceGroup) otherGroup).m_group);
}
***************
*** 42,44 ****
--- 42,51 ----
}
+ public static ResourceGroup getTestGroup() {
+ return getTestGroup("test");
+ }
+
+ public static ResourceGroup getTestGroup(String name) {
+ return new ResourceGroup(name);
+ }
}
Index: Resource.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper/resource/Resource.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Resource.java 6 Sep 2003 23:01:15 -0000 1.11
--- Resource.java 25 Sep 2003 23:05:45 -0000 1.12
***************
*** 5,8 ****
--- 5,10 ----
import java.io.PrintWriter;
+ import java.util.ArrayList;
+ import java.util.List;
import org.krysalis.ruper.protocols.VirtualResourceLocator;
***************
*** 11,14 ****
--- 13,17 ----
import org.krysalis.ruper.util.select.Selectable;
import org.krysalis.version.Version;
+ import org.krysalis.version.impl.KrysalisVersion;
import org.krysalis.version.util.debug.DebugUtils;
import org.krysalis.version.util.debug.Dumpable;
***************
*** 21,25 ****
*
*/
! public class Resource implements Selectable, Referenceable,Dumpable {
// What group is this in ?
--- 24,28 ----
*
*/
! public class Resource implements Selectable, Referenceable, Dumpable {
// What group is this in ?
***************
*** 41,45 ****
//
private Version m_version = null;
!
//:TODO: We want this?
private String m_extension = null;
--- 44,48 ----
//
private Version m_version = null;
!
//:TODO: We want this?
private String m_extension = null;
***************
*** 68,73 ****
// Construct a Resource
//
! public Resource(
! Resource other) {
m_identifier = other.m_identifier;
--- 71,75 ----
// Construct a Resource
//
! public Resource(Resource other) {
m_identifier = other.m_identifier;
***************
*** 226,228 ****
--- 228,276 ----
}
+ public static List getTestResourceList(String group, int count) {
+ List resourceList = new ArrayList();
+
+ // Populate with some test resources...
+ for (int i = 0; i < count; ++i) {
+ String name = group + Integer.toString(1 + i);
+ resourceList.add(
+ Resource.getTestResource(
+ name,
+ new KrysalisVersion(1, i),
+ ResourceType.JAVA_BINARY));
+ resourceList.add(
+ Resource.getTestResource(
+ name,
+ new KrysalisVersion(1, i),
+ ResourceType.SOURCE_CODE));
+
+ // Add some randomness
+ }
+
+ return resourceList;
+ }
+
+ public static Resource getTestResource() {
+ return getTestResource("test");
+ }
+
+ public static Resource getTestResource(String name) {
+ return getTestResource(name, ResourceType.JAVA_BINARY);
+ }
+
+ public static Resource getTestResource(String name, ResourceType type) {
+ return getTestResource(name, new KrysalisVersion(1, 1), type);
+ }
+
+ public static Resource getTestResource(
+ String name,
+ Version version,
+ ResourceType type) {
+ return new Resource(
+ name,
+ version,
+ type,
+ name,
+ new VirtualResourceLocator("http://somewhere/" + name));
+ }
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.