W3C home > Mailing lists > Public > www-validator-cvs@w3.org > September 2009

2006/unicorn/src/org/w3c/unicorn/tests UnicornClientDirectInputTest.java,1.3,1.4 UnicornCallTest.java,1.2,1.3 CommandLine.java,1.3,1.4 HiepTest.java,1.3,1.4 UnicornClient.java,1.5,1.6

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 17 Sep 2009 15:42:43 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1MoJ87-0004iZ-7b@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/tests
In directory hutz:/tmp/cvs-serv18075/src/org/w3c/unicorn/tests

Modified Files:
	UnicornClientDirectInputTest.java UnicornCallTest.java 
	CommandLine.java HiepTest.java UnicornClient.java 
Log Message:
make use of the new InputParameter classes

Index: CommandLine.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/tests/CommandLine.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CommandLine.java	1 Sep 2009 16:00:24 -0000	1.3
+++ CommandLine.java	17 Sep 2009 15:42:41 -0000	1.4
@@ -110,7 +110,7 @@
 		CommandLine.logger.info("Initialize framework.");
 		UnicornCall aUnicornCall = new UnicornCall();
 		aUnicornCall.setTask(CommandLine.sTaskID);
-		aUnicornCall.setEnumInputMethod(CommandLine.aEnumInputMethod);
+		//aUnicornCall.setEnumInputMethod(CommandLine.aEnumInputMethod);
 		// CommandLine.sEnumInputMethodValue
 		aUnicornCall.setMapOfStringParameter(CommandLine.mapOfParameter);
 		if (CommandLine.logger.isDebugEnabled()) {

Index: UnicornClient.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/tests/UnicornClient.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- UnicornClient.java	4 Sep 2009 17:09:59 -0000	1.5
+++ UnicornClient.java	17 Sep 2009 15:42:41 -0000	1.6
@@ -9,12 +9,11 @@
 
 import org.w3c.unicorn.Framework;
 import org.w3c.unicorn.UnicornCall;
-import org.w3c.unicorn.contract.EnumInputMethod;
-import org.w3c.unicorn.exceptions.InitializationFailedException;
+import org.w3c.unicorn.input.DirectInputParameter;
+import org.w3c.unicorn.input.URIInputParameter;
 import org.w3c.unicorn.output.OutputFactory;
 import org.w3c.unicorn.output.OutputFormater;
 import org.w3c.unicorn.output.OutputModule;
-import org.w3c.unicorn.util.Property;
 
 public class UnicornClient {
 
@@ -95,12 +94,12 @@
 			// "file=text/css=./style/base.css"
 			String[] pInput = pageToValid.split("=");
 			if (pInput[0].equals("uri")) {
-				aUnicornCall.setEnumInputMethod(EnumInputMethod.URI);
-				aUnicornCall.setDocumentName(pInput[1]);
-				aUnicornCall.setInputParameterValue(pInput[1]);
+				//aUnicornCall.setEnumInputMethod(EnumInputMethod.URI);
+				//aUnicornCall.setDocumentName(pInput[1]);
+				aUnicornCall.setInputParameter(new URIInputParameter(pInput[1]));
 			} else { // direct input
 				try {
-					aUnicornCall.setEnumInputMethod(EnumInputMethod.DIRECT);
+					//aUnicornCall.setEnumInputMethod(EnumInputMethod.DIRECT);
 
 					// read content in the file pInput[2], example:
 					// pInput[2]=base.css alors content=".h1{color:#FA0012}";
@@ -113,7 +112,8 @@
 					bfr.close();
 
 					// Ajouter mime type dans map of parameter
-					Map<String, String[]> mapOfParameter = aUnicornCall
+					// TODO check if this is necessary (mime-type is added to DirectInputParameter object)
+					/*Map<String, String[]> mapOfParameter = aUnicornCall
 							.getMapOfStringParameter();
 					if (mapOfParameter == null) {
 						mapOfParameter = new LinkedHashMap<String, String[]>();
@@ -121,10 +121,11 @@
 					}
 					String[] tmp = { pInput[1] };
 					mapOfParameter.put(Property.get("UNICORN_PARAMETER_PREFIX")
-							+ "mime", tmp);
-
-					aUnicornCall.setInputParameterValue(content);
+							+ "mime", tmp);*/
 
+					//aUnicornCall.setInputParameterValue(content);
+					aUnicornCall.setInputParameter(new DirectInputParameter(content, pInput[1]));
+					
 				} catch (IOException e) {
 					e.printStackTrace();
 				}

Index: UnicornClientDirectInputTest.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/tests/UnicornClientDirectInputTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- UnicornClientDirectInputTest.java	1 Sep 2009 16:00:24 -0000	1.3
+++ UnicornClientDirectInputTest.java	17 Sep 2009 15:42:41 -0000	1.4
@@ -5,33 +5,31 @@
 import java.util.Map;
 
 import org.w3c.unicorn.UnicornCall;
-import org.w3c.unicorn.contract.EnumInputMethod;
+import org.w3c.unicorn.input.DirectInputParameter;
 import org.w3c.unicorn.output.OutputFactory;
 import org.w3c.unicorn.output.OutputFormater;
 import org.w3c.unicorn.output.OutputModule;
-import org.w3c.unicorn.util.Property;
 
 public class UnicornClientDirectInputTest {
 
 	public static void main(String[] args) {
 
 		UnicornCall aUnicornCall = new UnicornCall();
-		aUnicornCall.setTask("css"); // task id
-		aUnicornCall.setEnumInputMethod(EnumInputMethod.DIRECT);
+		aUnicornCall.setTask("full-css"); // task id
+		//aUnicornCall.setEnumInputMethod(EnumInputMethod.DIRECT);
 		aUnicornCall.setLang("en");
 
-		aUnicornCall
-				.setDocumentName("D:/stageW3C/unicorn/style/base_result.css");
+		//aUnicornCall.setDocumentName("D:/stageW3C/unicorn/style/base_result.css");
 
-		Map<String, String[]> mapOfParameter = new LinkedHashMap<String, String[]>();
+		/*Map<String, String[]> mapOfParameter = new LinkedHashMap<String, String[]>();
 		String[] tmp = { "text/css" };
 		mapOfParameter.put(Property.get("UNICORN_PARAMETER_PREFIX") + "mime",
 				tmp);
-		aUnicornCall.setMapOfStringParameter(mapOfParameter);
-
-		aUnicornCall
-				.setInputParameterValue("p#msie { /* msie-bug note for text/plain */ float: right; border: 1px solid black; background: white;}");
+		aUnicornCall.setMapOfStringParameter(mapOfParameter);*/
 
+		//aUnicornCall.setInputParameterValue("p#msie { /* msie-bug note for text/plain */ float: right; border: 1px solid black; background: white;}");
+		aUnicornCall.setInputParameter(new DirectInputParameter("p#msie { /* msie-bug note for text/plain */ float: right; border: 1px solid black; background: white;}", "text/css"));
+		
 		try {
 
 			aUnicornCall.doTask();

Index: UnicornCallTest.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/tests/UnicornCallTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- UnicornCallTest.java	28 Aug 2009 12:39:59 -0000	1.2
+++ UnicornCallTest.java	17 Sep 2009 15:42:41 -0000	1.3
@@ -3,7 +3,6 @@
 import java.io.InputStream;
 import java.util.Iterator;
 
-import javax.activation.MimeType;
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -14,9 +13,9 @@
 import javax.xml.xpath.XPathFactory;
 
 import org.w3c.dom.Document;
-import org.w3c.unicorn.contract.EnumInputMethod;
-import org.w3c.unicorn.input.InputFactory;
 import org.w3c.unicorn.input.InputModule;
+import org.w3c.unicorn.input.InputParameter;
+import org.w3c.unicorn.input.URIInputParameter;
 import org.w3c.unicorn.request.Request;
 import org.w3c.unicorn.response.Response;
 import org.xml.sax.InputSource;
@@ -93,8 +92,12 @@
 			 * 
 			 */
 
-			InputModule inputMod = InputFactory.createInputModule(
-					(new MimeType()), EnumInputMethod.URI, "http://www.w3.org");
+			//InputModule inputMod = InputFactory.createInputModule((new MimeType()), EnumInputMethod.URI, "http://www.w3.org");
+			
+			InputParameter inputParameter = new URIInputParameter("http://www.w3.org");
+			inputParameter.check();
+			InputModule inputMod = inputParameter.getInputModule();
+			
 			Request req = Request.createRequest(inputMod,
 					"http://validator.w3.org/check", "uri", false, "ucn");
 			req.setLang("en");

Index: HiepTest.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/tests/HiepTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- HiepTest.java	1 Sep 2009 16:00:24 -0000	1.3
+++ HiepTest.java	17 Sep 2009 15:42:41 -0000	1.4
@@ -5,7 +5,7 @@
 import java.util.Map;
 
 import org.w3c.unicorn.UnicornCall;
-import org.w3c.unicorn.contract.EnumInputMethod;
+import org.w3c.unicorn.input.URIInputParameter;
 import org.w3c.unicorn.output.OutputFactory;
 import org.w3c.unicorn.output.OutputFormater;
 import org.w3c.unicorn.output.OutputModule;
@@ -16,9 +16,7 @@
 
 		UnicornCall aUnicornCall = new UnicornCall();
 		aUnicornCall.setTask("conformance"); // task id
-		aUnicornCall.setEnumInputMethod(EnumInputMethod.URI);
-		aUnicornCall.setDocumentName("http://w3.org");
-		aUnicornCall.setInputParameterValue("http://w3.org");
+		aUnicornCall.setInputParameter(new URIInputParameter("http://w3.org"));
 		aUnicornCall.setLang("en");
 
 		try {
Received on Thursday, 17 September 2009 15:42:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:14 GMT