ruper2/src/java/test/core/org/krysalis/ruper/files DefaultResourceAnalyzerTests.java,1.2,1.3

[email protected]
Newsgroups gmane.comp.krysalis.metamorphosis.cvs
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/ruper2/src/java/test/core/org/krysalis/ruper/files
In directory sc8-pr-cvs1:/tmp/cvs-serv10667/src/java/test/core/org/krysalis/ruper/files

Modified Files:
	DefaultResourceAnalyzerTests.java 
Log Message:
1) listSpecifiers ought not work
2) unit tests run again [need to add those to a project]
3) FilenameAnalyzer a bit smarter (copes w/ -alpha better, ala Ben's soln)
4) FileUpdater does something -- kinda/sorta, try it :-)
5) Ant task same...

Index: DefaultResourceAnalyzerTests.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/test/core/org/krysalis/ruper/files/DefaultResourceAnalyzerTests.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DefaultResourceAnalyzerTests.java	5 Sep 2003 05:51:48 -0000	1.2
--- DefaultResourceAnalyzerTests.java	12 Sep 2003 20:23:44 -0000	1.3
***************
*** 12,16 ****
--- 12,22 ----
  import junit.framework.TestCase;
  
+ import org.krysalis.ruper.RuperException;
  import org.krysalis.ruper.protocols.VirtualResourceLocator;
+ import org.krysalis.ruper.resource.Resource;
+ import org.krysalis.ruper.resource.ResourceType;
+ import org.krysalis.version.Version;
+ import org.krysalis.version.impl.VersionImporter;
+ import org.krysalis.version.util.debug.DebugUtils;
  
  /**
***************
*** 28,32 ****
  
  	public void setUp() throws Exception {
! 		m_analyzer = new DefaultResourceFilenameAnalyzer(VirtualResourceLocator.getTestVRL());
  	}
  
--- 34,40 ----
  
  	public void setUp() throws Exception {
! 		m_analyzer =
! 			new DefaultResourceFilenameAnalyzer(
! 				VirtualResourceLocator.getTestVRL());
  	}
  
***************
*** 56,74 ****
  	}
  
! 	public void testExtensions1() {
  		String testPattern = "mystuff-1.2.fred";
  		List testList = new ArrayList();
  		testList.add("fred");
  		checkExtensionList(testPattern, testList);
  	}
  
! 	public void testExtensions2() {
  		String testPattern = "mystuff-1.2-src.fred";
  		List testList = new ArrayList();
  		testList.add("fred");
  		checkExtensionList(testPattern, testList);
  	}
  
! 	public void testExtensions3() {
  		String testPattern = "mystuff-1.2-src.fred.Z";
  		List testList = new ArrayList();
--- 64,89 ----
  	}
  
! 	public void testExtensions1() throws RuperException {
  		String testPattern = "mystuff-1.2.fred";
  		List testList = new ArrayList();
  		testList.add("fred");
  		checkExtensionList(testPattern, testList);
+ 
+ 		checkResource(
+ 			testPattern,
+ 			createResource(testPattern, "mystuff", "1.2", null));
  	}
  
! 	public void testExtensions2()  throws RuperException{
  		String testPattern = "mystuff-1.2-src.fred";
  		List testList = new ArrayList();
  		testList.add("fred");
  		checkExtensionList(testPattern, testList);
+ 		checkResource(
+ 			testPattern,
+ 			createResource(testPattern, "mystuff", "1.2", "src"));
  	}
  
! 	public void testExtensions3()  throws RuperException{
  		String testPattern = "mystuff-1.2-src.fred.Z";
  		List testList = new ArrayList();
***************
*** 76,79 ****
--- 91,139 ----
  		testList.add("Z");
  		checkExtensionList(testPattern, testList);
+ 		checkResource(
+ 			testPattern,
+ 			createResource(testPattern, "mystuff", "1.2", "src"));
+ 	}
+ 
+ 	private Resource createResource(
+ 		String filename,
+ 		String name,
+ 		String v,
+ 		String t)
+ 		throws RuperException {
+ 		Version version = null;
+ 		if (null != v) {
+ 			try {
+ 				version = VersionImporter.importVersion(v);
+ 			}
+ 			catch (Exception e) {
+ 			}
+ 		}
+ 
+ 		ResourceType resourceType = null;
+ 		resourceType = ResourceType.getFromString(t);
+ 
+ 		return new Resource(
+ 			name,
+ 			version,
+ 			resourceType,
+ 			filename,
+ 			new VirtualResourceLocator(filename));
+ 	}
+ 
+ 	private void checkResource(String pattern, Resource expected)
+ 		throws RuperException {
+ 			
+ 		DebugUtils.printSeparator();
+ 		DebugUtils.dump(expected);
+ 			
+ 		Resource resource = m_analyzer.determineResource(pattern);
+ 
+ 		
+ 		assertNotNull("Determined something", resource);
+ 
+ 		DebugUtils.printSeparator();
+ 		DebugUtils.dump(resource);
+ 		assertEquals("Same Resource", expected, resource);
  	}
  
***************
*** 83,87 ****
  		assertEquals("Same Result List", extns, probableExtns);
  	}
- 
  
  	public static void main(String[] args) {
--- 143,146 ----




-------------------------------------------------------
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.