WICKET-5674 Use jquery.atmosphere.js as a Webjar
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/d7775b1d Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/d7775b1d Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/d7775b1d Branch: refs/heads/5674-jquery-atmo-webjar Commit: d7775b1d2d38053dcadbbc9466d3f141b3072d06 Parents: eb86367 Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Fri Aug 15 11:59:41 2014 +0200 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Fri Aug 15 11:59:41 2014 +0200 ---------------------------------------------------------------------- wicket-experimental/wicket-atmosphere/pom.xml | 6 ++ .../apache/wicket/atmosphere/Initializer.java | 28 +++++++- .../src/main/resources/wicket.properties | 14 ++++ .../wicket/atmosphere/AtmosphereTest.java | 68 -------------------- 4 files changed, 46 insertions(+), 70 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/d7775b1d/wicket-experimental/wicket-atmosphere/pom.xml ---------------------------------------------------------------------- diff --git a/wicket-experimental/wicket-atmosphere/pom.xml b/wicket-experimental/wicket-atmosphere/pom.xml index a55ad3c..1ac31b2 100644 --- a/wicket-experimental/wicket-atmosphere/pom.xml +++ b/wicket-experimental/wicket-atmosphere/pom.xml @@ -77,6 +77,12 @@ </dependency> </dependencies> <build> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>false</filtering> + </resource> + </resources> <plugins> <plugin> <groupId>net.alchim31.maven</groupId> http://git-wip-us.apache.org/repos/asf/wicket/blob/d7775b1d/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/Initializer.java ---------------------------------------------------------------------- diff --git a/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/Initializer.java b/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/Initializer.java index e39e056..5b3a790 100644 --- a/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/Initializer.java +++ b/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/Initializer.java @@ -1,3 +1,19 @@ +/* + * 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 de.agilecoders.wicket.webjars.WicketWebjars; @@ -13,8 +29,16 @@ public class Initializer implements IInitializer @Override public void init(Application application) { - WicketWebjars.settings(); - WicketWebjars.install((org.apache.wicket.protocol.http.WebApplication) application); + try + { + WicketWebjars.settings(); + } + catch (IllegalStateException x) + { + // try to install only if it is not already installed + // TODO simplify once wicket-webjars has WicketWebjars#isInstalled(application) + WicketWebjars.install((org.apache.wicket.protocol.http.WebApplication) application); + } } @Override http://git-wip-us.apache.org/repos/asf/wicket/blob/d7775b1d/wicket-experimental/wicket-atmosphere/src/main/resources/wicket.properties ---------------------------------------------------------------------- diff --git a/wicket-experimental/wicket-atmosphere/src/main/resources/wicket.properties b/wicket-experimental/wicket-atmosphere/src/main/resources/wicket.properties index 8e54aa0..c07947f 100644 --- a/wicket-experimental/wicket-atmosphere/src/main/resources/wicket.properties +++ b/wicket-experimental/wicket-atmosphere/src/main/resources/wicket.properties @@ -1 +1,15 @@ +# 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. initializer=org.apache.wicket.atmosphere.Initializer http://git-wip-us.apache.org/repos/asf/wicket/blob/d7775b1d/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 deleted file mode 100644 index 368367d..0000000 --- a/wicket-experimental/wicket-atmosphere/src/test/java/org/apache/wicket/atmosphere/AtmosphereTest.java +++ /dev/null @@ -1,68 +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 org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.atmosphere.tester.AtmosphereTester; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.util.tester.WicketTester; -import org.junit.Assert; -import org.junit.Test; - -/** - * - */ -public class AtmosphereTest extends Assert -{ - @Test - public void atmospherePush() - { - final String updateTimeIsExecuted = "updateTime is executed!"; - - WicketTester tester = new WicketTester(); - HomePage page = new HomePage(new PageParameters()) - { - @Subscribe - public void updateTime(AjaxRequestTarget target, Date event) - { - super.updateTime(target, event); - - target.appendJavaScript(updateTimeIsExecuted); - } - - @Subscribe(contextAwareFilter = ReceiverFilter.class) - public void receiveMessage(AjaxRequestTarget target, ChatMessage message) - { - super.receiveMessage(target, message); - - System.err.println("receiveMessage"); - } - }; - - AtmosphereTester waTester = new AtmosphereTester(tester, page); - - Date payload = new Date(); - waTester.post(payload); - -// System.err.println("Ajax response:\n" + tester.getLastResponseAsString()); - tester.assertContains(updateTimeIsExecuted); - - tester.destroy(); - } -}
