W3C home > Mailing lists > Public > www-validator-cvs@w3.org > November 2007

2006/unicorn/org/w3c/unicorn/tests HiepTest.java,NONE,1.1

From: Hiep Duong via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 28 Nov 2007 09:00:29 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1IxImT-0006Wp-KD@lionel-hutz.w3.org>

Update of /sources/public/2006/unicorn/org/w3c/unicorn/tests
In directory hutz:/tmp/cvs-serv25077/org/w3c/unicorn/tests

Added Files:
	HiepTest.java 
Log Message:
Simple client

--- NEW FILE: HiepTest.java ---
package org.w3c.unicorn.tests;

import java.io.PrintWriter;
import java.util.LinkedHashMap;
import java.util.Map;

import org.w3c.unicorn.UnicornCall;
import org.w3c.unicorn.contract.EnumInputMethod;
import org.w3c.unicorn.output.OutputFactory;
import org.w3c.unicorn.output.OutputFormater;
import org.w3c.unicorn.output.OutputModule;

public class HiepTest {

	public static void main(String[] args) {
		Map<String, String[]> mapOfParameter = new LinkedHashMap<String, String[]>();
		
		// lang par defaut
		String[] tmp = {"en"};
		mapOfParameter.put("ucn_lang", tmp); 
		
		UnicornCall aUnicornCall = new UnicornCall();
		aUnicornCall.setTask("markup"); //task id
		aUnicornCall.setEnumInputMethod(EnumInputMethod.URI);
		aUnicornCall.setDocumentName("http://w3.org");
		aUnicornCall.setMapOfStringParameter(mapOfParameter);
		aUnicornCall.setInputParameterValue("http://w3.org");
		
		
		try {
			aUnicornCall.doTask();
			
			Map<String, Object> mapOfStringObject = new LinkedHashMap<String, Object>();
			mapOfStringObject.put("unicorncall", aUnicornCall);
			OutputFormater aOutputFormater = OutputFactory.getOutputFormater(
					"xhtml10", // le template --> text ou xhtml10, see unicorn.properties
					"en",   // la langue
					"text/plain"); // MIME Type
			OutputModule aOutputModule = OutputFactory.getOutputModule("simple");
			PrintWriter pw = new PrintWriter(System.out);
			aOutputModule.produceOutput(aOutputFormater, mapOfStringObject, null, pw);
			pw.flush();
		} catch (Exception e) {
			e.printStackTrace();
		}			
	}
}
Received on Wednesday, 28 November 2007 09:00:39 GMT

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