You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/08/15 09:51:12 UTC

[02/17] git commit: WICKET-5452 Make Wicket-Atmosphere testable - AtmosphereTester

WICKET-5452 Make Wicket-Atmosphere testable - AtmosphereTester

Atmosphere tester - write to the http response (doesn't work)


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/0582a243
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/0582a243
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/0582a243

Branch: refs/heads/wicket-6.x
Commit: 0582a24373b2bcd981f398c39f8cfea85cd08e06
Parents: 2ab1d79
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Aug 12 17:30:46 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Fri Aug 15 09:44:53 2014 +0200

----------------------------------------------------------------------
 .../wicket/atmosphere/AtmosphereBehavior.java   |  1 +
 .../atmosphere/AtmosphereApplication.java       | 79 --------------------
 .../wicket/atmosphere/AtmosphereTest.java       |  3 +
 3 files changed, 4 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/0582a243/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereBehavior.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereBehavior.java b/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereBehavior.java
index 9df55bc..9a863c8 100644
--- a/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereBehavior.java
+++ b/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereBehavior.java
@@ -189,6 +189,7 @@ public class AtmosphereBehavior extends AbstractAjaxBehavior
 	@Override
 	public void renderHead(Component component, IHeaderResponse response)
 	{
+		super.renderHead(component, response);
 		try
 		{
 			CoreLibrariesContributor.contributeAjax(component.getApplication(), response);

http://git-wip-us.apache.org/repos/asf/wicket/blob/0582a243/wicket-experimental/wicket-atmosphere/src/test/java/org/apache/wicket/atmosphere/AtmosphereApplication.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-atmosphere/src/test/java/org/apache/wicket/atmosphere/AtmosphereApplication.java b/wicket-experimental/wicket-atmosphere/src/test/java/org/apache/wicket/atmosphere/AtmosphereApplication.java
deleted file mode 100644
index aca6e62..0000000
--- a/wicket-experimental/wicket-atmosphere/src/test/java/org/apache/wicket/atmosphere/AtmosphereApplication.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.atmosphere;
-
-import java.util.Date;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.wicket.Application;
-import org.apache.wicket.atmosphere.config.AtmosphereLogLevel;
-import org.apache.wicket.atmosphere.config.AtmosphereTransport;
-import org.apache.wicket.protocol.http.WebApplication;
-
-/**
- * Application object for your web application. If you want to run this application without
- * deploying, run the Start class.
- */
-public class AtmosphereApplication extends WebApplication
-{
-	private EventBus eventBus;
-
-	@Override
-	public Class<HomePage> getHomePage()
-	{
-		return HomePage.class;
-	}
-
-	public EventBus getEventBus()
-	{
-		return eventBus;
-	}
-
-	public static AtmosphereApplication get()
-	{
-		return (AtmosphereApplication)Application.get();
-	}
-
-	@Override
-	public void init()
-	{
-		super.init();
-		eventBus = new EventBus(this);
-		eventBus.getParameters().setTransport(AtmosphereTransport.STREAMING);
-		eventBus.getParameters().setLogLevel(AtmosphereLogLevel.DEBUG);
-
-		ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
-		final Runnable beeper = new Runnable()
-		{
-			@Override
-			public void run()
-			{
-				try
-				{
-					eventBus.post(new Date());
-				}
-				catch (Exception e)
-				{
-					e.printStackTrace();
-				}
-			}
-		};
-		scheduler.scheduleWithFixedDelay(beeper, 2, 2, TimeUnit.SECONDS);
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/0582a243/wicket-experimental/wicket-atmosphere/src/test/java/org/apache/wicket/atmosphere/AtmosphereTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-atmosphere/src/test/java/org/apache/wicket/atmosphere/AtmosphereTest.java b/wicket-experimental/wicket-atmosphere/src/test/java/org/apache/wicket/atmosphere/AtmosphereTest.java
index 5accac5..e8a5b30 100644
--- a/wicket-experimental/wicket-atmosphere/src/test/java/org/apache/wicket/atmosphere/AtmosphereTest.java
+++ b/wicket-experimental/wicket-atmosphere/src/test/java/org/apache/wicket/atmosphere/AtmosphereTest.java
@@ -42,6 +42,7 @@ public class AtmosphereTest extends Assert
 				super.updateTime(target, event);
 
 				System.err.println("updateTime");
+				target.appendJavaScript("updateTime is executed");
 			}
 
 			@Subscribe(contextAwareFilter = ReceiverFilter.class)
@@ -60,6 +61,8 @@ public class AtmosphereTest extends Assert
 		Date payload = new Date();
 		waTester.post(payload);
 
+		System.err.println(tester.getLastResponseAsString());
+
 		tester.destroy();
 	}
 }