labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simo...@apache.org
Subject svn commit: r740958 - /labs/magma/trunk/website-velocity/src/test/java/org/apache/magma/website/velocity/TestGettersFormatting.java
Date Thu, 05 Feb 2009 00:43:24 GMT
Author: simoneg
Date: Thu Feb  5 00:43:24 2009
New Revision: 740958

URL: http://svn.apache.org/viewvc?rev=740958&view=rev
Log:
LABS-279 : adapted to new website system.

Modified:
    labs/magma/trunk/website-velocity/src/test/java/org/apache/magma/website/velocity/TestGettersFormatting.java

Modified: labs/magma/trunk/website-velocity/src/test/java/org/apache/magma/website/velocity/TestGettersFormatting.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-velocity/src/test/java/org/apache/magma/website/velocity/TestGettersFormatting.java?rev=740958&r1=740957&r2=740958&view=diff
==============================================================================
--- labs/magma/trunk/website-velocity/src/test/java/org/apache/magma/website/velocity/TestGettersFormatting.java
(original)
+++ labs/magma/trunk/website-velocity/src/test/java/org/apache/magma/website/velocity/TestGettersFormatting.java
Thu Feb  5 00:43:24 2009
@@ -1,17 +1,44 @@
 package org.apache.magma.website.velocity;
 
+import static junit.framework.Assert.assertEquals;
+
 import java.io.ByteArrayOutputStream;
-import java.io.OutputStreamWriter;
-import java.io.StringWriter;
+import java.lang.reflect.Method;
 import java.text.SimpleDateFormat;
 
+import org.apache.magma.basics.context.RunningContext;
+import org.apache.magma.website.HtmlProducer;
 import org.apache.magma.website.WebHandler;
+import org.apache.magma.website.context.WebMethodContextElement;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
 import org.junit.Test;
-import static junit.framework.Assert.*;
 
 
 public class TestGettersFormatting extends WebHandler {
 
+	@AfterClass
+	public static void cleanAll() {
+		RunningContext.cleanup();
+	}
+	
+	@Before
+	public void setupContext() throws Exception {
+		Method m = this.getClass().getMethod("doFake");
+		WebMethodContextElement wce = new WebMethodContextElement(m, new Object[0], this);
+		RunningContext.get().push(wce);
+	}
+	
+	@After
+	public void cleanContext() {
+		RunningContext.get().pop(WebMethodContextElement.class);
+	}
+	
+	public HtmlProducer doFake() {
+		return null;
+	}
+	
 	@Test
 	public void formattedDate() throws Exception {
 		FakeBean fb = new FakeBean();
@@ -19,7 +46,6 @@
 		fb.setDate(sdf.parse("1979-03-05"));
 		VelocityHtmlProducer prod = new VelocityHtmlProducer("testGettersFormatting.vm");
 		prod.addParameter("bean", fb);
-		prod.setCreatingHandler(this);
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
 		prod.produce(baos);
 		String str = new String(baos.toByteArray(), "UTF-8");
@@ -32,7 +58,6 @@
 		fb.setString("this is <b>bold</b>");
 		VelocityHtmlProducer prod = new VelocityHtmlProducer("testEscapeHtml.vm");
 		prod.addParameter("bean", fb);
-		prod.setCreatingHandler(this);
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
 		prod.produce(baos);
 		String str = new String(baos.toByteArray(), "UTF-8");
@@ -45,7 +70,6 @@
 		fb.setString("this is <b>bold</b>");
 		VelocityHtmlProducer prod = new VelocityHtmlProducer("testNested.vm");
 		prod.addParameter("bean", fb);
-		prod.setCreatingHandler(this);
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
 		prod.produce(baos);
 		String str = new String(baos.toByteArray(), "UTF-8");



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message