diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-04-15 11:06:18 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-04-15 14:00:58 +0300 |
commit | 6b8412033e680ce6e5c7827ac504adf132305726 (patch) | |
tree | 0df05d16c324b285610af8910c126b58f4c490c5 /uitest/src/com/vaadin/tests/push | |
parent | 9192b0bb5e5e699b506b3d3e7df4cf295fbea44a (diff) | |
download | vaadin-framework-6b8412033e680ce6e5c7827ac504adf132305726.tar.gz vaadin-framework-6b8412033e680ce6e5c7827ac504adf132305726.zip |
Build uitest war with maven
Change-Id: I32625901ca27a282253df44c6e776cf9632bacda
Diffstat (limited to 'uitest/src/com/vaadin/tests/push')
68 files changed, 0 insertions, 3841 deletions
diff --git a/uitest/src/com/vaadin/tests/push/BarInUIDL.java b/uitest/src/com/vaadin/tests/push/BarInUIDL.java deleted file mode 100644 index a5d23dcd1f..0000000000 --- a/uitest/src/com/vaadin/tests/push/BarInUIDL.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.ui.Transport; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Label; - -@Push(transport = Transport.STREAMING) -public class BarInUIDL extends AbstractTestUI { - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. - * VaadinRequest) - */ - @Override - protected void setup(VaadinRequest request) { - addButton("Click Me", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - addComponent(new Label("Thank you for clicking | bar")); - } - }); - - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() - */ - @Override - protected String getTestDescription() { - return "Verify that there is no problem with messages containing | by clicking the button repeatedly"; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() - */ - @Override - protected Integer getTicketNumber() { - return 12404; - } - -} diff --git a/uitest/src/com/vaadin/tests/push/BarInUIDLTest.java b/uitest/src/com/vaadin/tests/push/BarInUIDLTest.java deleted file mode 100644 index 7bd1de5803..0000000000 --- a/uitest/src/com/vaadin/tests/push/BarInUIDLTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.WebElement; - -import com.vaadin.testbench.parallel.TestCategory; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@TestCategory("push") -public class BarInUIDLTest extends MultiBrowserTest { - @Test - public void sendBarInUIDL() { - openTestURL(); - getButton().click(); - Assert.assertEquals( - "Thank you for clicking | bar", - vaadinElement( - "/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]") - .getText()); - getButton().click(); - Assert.assertEquals( - "Thank you for clicking | bar", - vaadinElement( - "/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VLabel[0]") - .getText()); - } - - private WebElement getButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]"); - } -} diff --git a/uitest/src/com/vaadin/tests/push/BasicPush.java b/uitest/src/com/vaadin/tests/push/BasicPush.java deleted file mode 100644 index 7379b08f5b..0000000000 --- a/uitest/src/com/vaadin/tests/push/BasicPush.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import java.util.Timer; -import java.util.TimerTask; - -import com.vaadin.annotations.Push; -import com.vaadin.data.util.ObjectProperty; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.label.ContentMode; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Label; - -@Push -public class BasicPush extends AbstractTestUI { - - public static final String CLIENT_COUNTER_ID = "clientCounter"; - - public static final String STOP_TIMER_ID = "stopTimer"; - - public static final String START_TIMER_ID = "startTimer"; - - public static final String SERVER_COUNTER_ID = "serverCounter"; - - public static final String INCREMENT_BUTTON_ID = "incrementCounter"; - - private ObjectProperty<Integer> counter = new ObjectProperty<Integer>(0); - - private ObjectProperty<Integer> counter2 = new ObjectProperty<Integer>(0); - - private final Timer timer = new Timer(true); - - private TimerTask task; - - @Override - protected void setup(VaadinRequest request) { - getReconnectDialogConfiguration().setDialogModal(false); - spacer(); - - /* - * Client initiated push. - */ - Label lbl = new Label(counter); - lbl.setCaption("Client counter (click 'increment' to update):"); - lbl.setId(CLIENT_COUNTER_ID); - addComponent(lbl); - - Button incrementButton = new Button("Increment", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - counter.setValue(counter.getValue() + 1); - } - }); - incrementButton.setId(INCREMENT_BUTTON_ID); - addComponent(incrementButton); - - spacer(); - - /* - * Server initiated push. - */ - lbl = new Label(counter2); - lbl.setCaption("Server counter (updates each 3s by server thread) :"); - lbl.setId(SERVER_COUNTER_ID); - addComponent(lbl); - - Button startTimer = new Button("Start timer", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - counter2.setValue(0); - if (task != null) { - task.cancel(); - } - task = new TimerTask() { - - @Override - public void run() { - access(new Runnable() { - @Override - public void run() { - counter2.setValue(counter2.getValue() + 1); - } - }); - } - }; - timer.scheduleAtFixedRate(task, 3000, 3000); - } - }); - startTimer.setId(START_TIMER_ID); - addComponent(startTimer); - - Button stopTimer = new Button("Stop timer", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - if (task != null) { - task.cancel(); - task = null; - } - } - }); - stopTimer.setId(STOP_TIMER_ID); - addComponent(stopTimer); - } - - @Override - protected String getTestDescription() { - return "This test tests the very basic operations of push. " - + "It tests that client initiated changes are " - + "recieved back to the client as well as server " - + "initiated changes are correctly updated to the client."; - } - - @Override - protected Integer getTicketNumber() { - return 11494; - } - - private void spacer() { - addComponent(new Label("<hr/>", ContentMode.HTML)); - } - - @Override - public void attach() { - super.attach(); - } - - @Override - public void detach() { - super.detach(); - timer.cancel(); - } -} diff --git a/uitest/src/com/vaadin/tests/push/BasicPushLongPolling.java b/uitest/src/com/vaadin/tests/push/BasicPushLongPolling.java deleted file mode 100644 index 8b6f634aae..0000000000 --- a/uitest/src/com/vaadin/tests/push/BasicPushLongPolling.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.ui.Transport; -import com.vaadin.shared.ui.ui.UIState.PushConfigurationState; - -@Push(transport = Transport.LONG_POLLING) -public class BasicPushLongPolling extends BasicPush { - - @Override - public void init(VaadinRequest request) { - super.init(request); - // Don't use fallback so we can easier detect if long polling fails - getPushConfiguration().setParameter( - PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none"); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/BasicPushLongPollingTest.java b/uitest/src/com/vaadin/tests/push/BasicPushLongPollingTest.java deleted file mode 100644 index a060d5a57a..0000000000 --- a/uitest/src/com/vaadin/tests/push/BasicPushLongPollingTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Test; - -public class BasicPushLongPollingTest extends BasicPushTest { - - @Test - public void pushAfterServerTimeout() throws InterruptedException { - getDriver().get( - getTestUrl().replace("/run/", "/run-push-timeout/") - + "?debug=push"); - sleep(11000); // Wait for server timeout (10s) - - getServerCounterStartButton().click(); - waitUntilServerCounterChanges(); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/BasicPushStreaming.java b/uitest/src/com/vaadin/tests/push/BasicPushStreaming.java deleted file mode 100644 index c906c5f6e1..0000000000 --- a/uitest/src/com/vaadin/tests/push/BasicPushStreaming.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.ui.Transport; - -@Push(transport = Transport.STREAMING) -public class BasicPushStreaming extends BasicPush { - @Override - public void init(VaadinRequest request) { - super.init(request); - // Don't use fallback so we can easier detect if streaming fails - getPushConfiguration().setFallbackTransport(Transport.STREAMING); - - } -} diff --git a/uitest/src/com/vaadin/tests/push/BasicPushStreamingTest.java b/uitest/src/com/vaadin/tests/push/BasicPushStreamingTest.java deleted file mode 100644 index ceb0b28c76..0000000000 --- a/uitest/src/com/vaadin/tests/push/BasicPushStreamingTest.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -public class BasicPushStreamingTest extends BasicPushTest { -} diff --git a/uitest/src/com/vaadin/tests/push/BasicPushTest.java b/uitest/src/com/vaadin/tests/push/BasicPushTest.java deleted file mode 100644 index 157e3f74ae..0000000000 --- a/uitest/src/com/vaadin/tests/push/BasicPushTest.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.ExpectedCondition; - -import com.vaadin.testbench.parallel.TestCategory; -import com.vaadin.tests.tb3.AbstractTB3Test; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@TestCategory("push") -public abstract class BasicPushTest extends MultiBrowserTest { - - @Override - public void setup() throws Exception { - super.setup(); - } - - @Test - public void testPush() throws InterruptedException { - openTestURL(); - - getIncrementButton().click(); - testBench().disableWaitForVaadin(); - - waitUntilClientCounterChanges(1); - - getIncrementButton().click(); - getIncrementButton().click(); - getIncrementButton().click(); - waitUntilClientCounterChanges(4); - - // Test server initiated push - getServerCounterStartButton().click(); - waitUntilServerCounterChanges(); - } - - public static int getClientCounter(AbstractTB3Test t) { - WebElement clientCounterElem = t.findElement(By - .id(BasicPush.CLIENT_COUNTER_ID)); - return Integer.parseInt(clientCounterElem.getText()); - } - - protected WebElement getIncrementButton() { - return getIncrementButton(this); - } - - protected WebElement getServerCounterStartButton() { - return getServerCounterStartButton(this); - } - - public static int getServerCounter(AbstractTB3Test t) { - WebElement serverCounterElem = t.findElement(By - .id(BasicPush.SERVER_COUNTER_ID)); - return Integer.parseInt(serverCounterElem.getText()); - } - - public static WebElement getServerCounterStartButton(AbstractTB3Test t) { - return t.findElement(By.id(BasicPush.START_TIMER_ID)); - } - - public static WebElement getServerCounterStopButton(AbstractTB3Test t) { - return t.findElement(By.id(BasicPush.STOP_TIMER_ID)); - } - - public static WebElement getIncrementButton(AbstractTB3Test t) { - return t.findElement(By.id(BasicPush.INCREMENT_BUTTON_ID)); - } - - protected void waitUntilClientCounterChanges(final int expectedValue) { - waitUntil(new ExpectedCondition<Boolean>() { - - @Override - public Boolean apply(WebDriver input) { - return BasicPushTest.getClientCounter(BasicPushTest.this) == expectedValue; - } - }, 10); - } - - protected void waitUntilServerCounterChanges() { - final int counter = BasicPushTest.getServerCounter(this); - waitUntil(new ExpectedCondition<Boolean>() { - - @Override - public Boolean apply(WebDriver input) { - return BasicPushTest.getServerCounter(BasicPushTest.this) > counter; - } - }, 10); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/BasicPushWebsocket.java b/uitest/src/com/vaadin/tests/push/BasicPushWebsocket.java deleted file mode 100644 index 84c0b19ce8..0000000000 --- a/uitest/src/com/vaadin/tests/push/BasicPushWebsocket.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.ui.Transport; -import com.vaadin.shared.ui.ui.UIState.PushConfigurationState; - -@Push(transport = Transport.WEBSOCKET) -public class BasicPushWebsocket extends BasicPush { - - @Override - public void init(VaadinRequest request) { - super.init(request); - // Don't use fallback so we can easier detect if websocket fails - getPushConfiguration().setParameter( - PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none"); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/BasicPushWebsocketTest.java b/uitest/src/com/vaadin/tests/push/BasicPushWebsocketTest.java deleted file mode 100644 index cd779a7318..0000000000 --- a/uitest/src/com/vaadin/tests/push/BasicPushWebsocketTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import java.util.List; - -import org.openqa.selenium.remote.DesiredCapabilities; - -import com.vaadin.tests.tb3.WebsocketTest; - -public class BasicPushWebsocketTest extends BasicPushTest { - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - return getBrowsersSupportingWebSocket(); - } -} diff --git a/uitest/src/com/vaadin/tests/push/BasicPushWebsocketXhr.java b/uitest/src/com/vaadin/tests/push/BasicPushWebsocketXhr.java deleted file mode 100644 index e31eb2a369..0000000000 --- a/uitest/src/com/vaadin/tests/push/BasicPushWebsocketXhr.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.ui.Transport; -import com.vaadin.shared.ui.ui.UIState.PushConfigurationState; - -@Push(transport = Transport.WEBSOCKET_XHR) -public class BasicPushWebsocketXhr extends BasicPush { - - @Override - public void init(VaadinRequest request) { - super.init(request); - // Don't use fallback so we can easier detect if websocket fails - getPushConfiguration().setParameter( - PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none"); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/BasicPushWebsocketXhrTest.java b/uitest/src/com/vaadin/tests/push/BasicPushWebsocketXhrTest.java deleted file mode 100644 index 430246d66a..0000000000 --- a/uitest/src/com/vaadin/tests/push/BasicPushWebsocketXhrTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import java.util.List; - -import org.openqa.selenium.remote.DesiredCapabilities; - -import com.vaadin.tests.tb3.WebsocketTest; - -public class BasicPushWebsocketXhrTest extends BasicPushTest { - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - return getBrowsersSupportingWebSocket(); - } -} diff --git a/uitest/src/com/vaadin/tests/push/EnableDisablePush.java b/uitest/src/com/vaadin/tests/push/EnableDisablePush.java deleted file mode 100644 index d5646c976b..0000000000 --- a/uitest/src/com/vaadin/tests/push/EnableDisablePush.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.vaadin.tests.push; - -import java.util.Date; -import java.util.Timer; -import java.util.TimerTask; -import java.util.concurrent.TimeUnit; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.communication.PushMode; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.util.Log; -import com.vaadin.ui.Button; -import com.vaadin.ui.UIDetachedException; - -public class EnableDisablePush extends AbstractTestUI { - - private int c = 0; - - private Log log = new Log(15); - - private final Timer timer = new Timer(true); - - private final class CounterTask extends TimerTask { - - @Override - public void run() { - - try { - while (true) { - TimeUnit.MILLISECONDS.sleep(500); - - access(new Runnable() { - @Override - public void run() { - log.log("Counter = " + c++); - if (c == 3) { - log.log("Disabling polling, enabling push"); - getPushConfiguration().setPushMode( - PushMode.AUTOMATIC); - setPollInterval(-1); - log.log("Polling disabled, push enabled"); - } - } - }); - if (c == 3) { - return; - } - } - } catch (InterruptedException e) { - } catch (UIDetachedException e) { - } - } - } - - @Override - protected void setup(VaadinRequest request) { - - getPushConfiguration().setPushMode(PushMode.AUTOMATIC); - log.log("Push enabled"); - - addComponent(new Button("Disable push", new Button.ClickListener() { - @Override - public void buttonClick(Button.ClickEvent event) { - log.log("Disabling push"); - getPushConfiguration().setPushMode(PushMode.DISABLED); - log.log("Push disabled"); - } - })); - - addComponent(new Button("Enable push", new Button.ClickListener() { - @Override - public void buttonClick(Button.ClickEvent event) { - log.log("Enabling push"); - getPushConfiguration().setPushMode(PushMode.AUTOMATIC); - log.log("Push enabled"); - } - })); - - addComponent(new Button("Disable polling", new Button.ClickListener() { - @Override - public void buttonClick(Button.ClickEvent event) { - log.log("Disabling poll"); - setPollInterval(-1); - log.log("Poll disabled"); - } - })); - - addComponent(new Button("Enable polling", new Button.ClickListener() { - @Override - public void buttonClick(Button.ClickEvent event) { - log.log("Enabling poll"); - setPollInterval(1000); - log.log("Poll enabled"); - } - })); - - addComponent(new Button( - "Disable push, re-enable from background thread", - new Button.ClickListener() { - @Override - public void buttonClick(Button.ClickEvent event) { - log.log("Disabling push, enabling polling"); - getPushConfiguration().setPushMode(PushMode.DISABLED); - setPollInterval(1000); - timer.schedule(new CounterTask(), new Date()); - log.log("Push disabled, polling enabled"); - } - })); - - addComponent(log); - } - - @Override - protected String getTestDescription() { - return "Test dynamically enablind and disabling push"; - } - - @Override - protected Integer getTicketNumber() { - return 12226; - } -} diff --git a/uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java b/uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java deleted file mode 100644 index 654108f8f9..0000000000 --- a/uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openqa.selenium.WebElement; - -import com.vaadin.testbench.parallel.TestCategory; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@TestCategory("push") -public class EnableDisablePushTest extends MultiBrowserTest { - @Test - public void testEnablePushWhenUsingPolling() throws Exception { - openTestURL(); - - assertEquals("1. Push enabled", getLogRow(0)); - - getDisablePushButton().click(); - assertEquals("3. Push disabled", getLogRow(0)); - - getEnablePollButton().click(); - assertEquals("5. Poll enabled", getLogRow(0)); - - getEnablePushButton().click(); - assertEquals("7. Push enabled", getLogRow(0)); - - getDisablePollButton().click(); - assertEquals("9. Poll disabled", getLogRow(0)); - - getDisablePushButtonAndReenableFromBackground().click(); - Thread.sleep(2500); - assertEquals("16. Polling disabled, push enabled", getLogRow(0)); - - getDisablePushButton().click(); - assertEquals("18. Push disabled", getLogRow(0)); - } - - private WebElement getDisablePushButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]"); - } - - private WebElement getEnablePushButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]"); - } - - private WebElement getDisablePollButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]"); - } - - private WebElement getEnablePollButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]"); - } - - private WebElement getDisablePushButtonAndReenableFromBackground() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VButton[0]"); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTime.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTime.java deleted file mode 100644 index 815b85ecc4..0000000000 --- a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTime.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.server.VaadinRequest; - -public abstract class ExtremelyLongPushTime extends PushLargeData { - - private static final int DURATION_MS = 48 * 60 * 60 * 1000; // 48 H - private static int INTERVAL_MS = 60 * 1000; // 1 minute - private static int PAYLOAD_SIZE = 100 * 1024; // 100 KB - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. - * VaadinRequest) - */ - @Override - protected void setup(VaadinRequest request) { - super.setup(request); - duration.setConvertedValue(DURATION_MS); - interval.setConvertedValue(INTERVAL_MS); - dataSize.setConvertedValue(PAYLOAD_SIZE); - } - - @Override - protected String getTestDescription() { - return "Test which pushes data every minute for 48 hours"; - } - - @Override - protected Integer getTicketNumber() { - return null; - } - -} diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeLongPolling.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeLongPolling.java deleted file mode 100644 index 3080b96ec4..0000000000 --- a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeLongPolling.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.ui.Transport; -import com.vaadin.shared.ui.ui.UIState.PushConfigurationState; - -@Push(transport = Transport.LONG_POLLING) -public class ExtremelyLongPushTimeLongPolling extends ExtremelyLongPushTime { - - @Override - public void init(VaadinRequest request) { - super.init(request); - // Don't use fallback so we can easier detect failures - getPushConfiguration().setParameter( - PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none"); - } -} diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeLongPollingTest.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeLongPollingTest.java deleted file mode 100644 index 13f601da7a..0000000000 --- a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeLongPollingTest.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -public class ExtremelyLongPushTimeLongPollingTest extends - ExtremelyLongPushTimeTest { - -} diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreaming.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreaming.java deleted file mode 100644 index 04a9c68e32..0000000000 --- a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreaming.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.ui.Transport; -import com.vaadin.shared.ui.ui.UIState.PushConfigurationState; - -@Push(transport = Transport.STREAMING) -public class ExtremelyLongPushTimeStreaming extends ExtremelyLongPushTime { - - @Override - public void init(VaadinRequest request) { - super.init(request); - // Don't use fallback so we can easier detect failures - getPushConfiguration().setParameter( - PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none"); - } -} diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreamingTest.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreamingTest.java deleted file mode 100644 index 4af6179e81..0000000000 --- a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreamingTest.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -public class ExtremelyLongPushTimeStreamingTest extends - ExtremelyLongPushTimeTest { - -} diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java deleted file mode 100644 index 5dc15f8fc6..0000000000 --- a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.support.ui.ExpectedConditions; - -import com.vaadin.tests.tb3.ExcludeFromSuite; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@ExcludeFromSuite -public abstract class ExtremelyLongPushTimeTest extends MultiBrowserTest { - - private static final int ONE_HOUR_IN_MS = 20 * 1000; - - @Test - public void test24HourPush() throws Exception { - openTestURL(); - - // Without this there is a large chance that we will wait for all pushes - // to complete before moving on - testBench(driver).disableWaitForVaadin(); - - // Wait for startButton to be present - waitForElementVisible(vaadinLocatorById("startButton")); - - String logRow0Id = "Log_row_0"; - By logRow0 = vaadinLocatorById(logRow0Id); - - // Start the test - vaadinElementById("startButton").click(); - - // Wait for push to start. Should take 60s - waitUntil(ExpectedConditions.textToBePresentInElement(logRow0, - "Package "), 120); - - // Check every hour that push is still going on - for (int i = 0; i < 24; i++) { - sleep(ONE_HOUR_IN_MS); - ensureStillPushing(logRow0); - } - - } - - private void ensureStillPushing(By logRow0) { - String logValue = getDriver().findElement(logRow0).getText(); - // Wait for the log value to change. Should take max 60s - waitUntilNot( - ExpectedConditions.textToBePresentInElement(logRow0, logValue), - 120); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocket.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocket.java deleted file mode 100644 index f73e7b728c..0000000000 --- a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocket.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.ui.Transport; -import com.vaadin.shared.ui.ui.UIState.PushConfigurationState; - -@Push(transport = Transport.WEBSOCKET) -public class ExtremelyLongPushTimeWebsocket extends ExtremelyLongPushTime { - - @Override - public void init(VaadinRequest request) { - super.init(request); - // Don't use fallback so we can easier detect if websocket fails - getPushConfiguration().setParameter( - PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none"); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocketTest.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocketTest.java deleted file mode 100644 index 54775d572d..0000000000 --- a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocketTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import java.util.List; - -import org.openqa.selenium.remote.DesiredCapabilities; - -import com.vaadin.tests.tb3.WebsocketTest; - -public class ExtremelyLongPushTimeWebsocketTest extends - ExtremelyLongPushTimeTest { - - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - return getBrowsersSupportingWebSocket(); - } -} diff --git a/uitest/src/com/vaadin/tests/push/IdlePushChannelLongPollingTest.java b/uitest/src/com/vaadin/tests/push/IdlePushChannelLongPollingTest.java deleted file mode 100644 index 143960f1b2..0000000000 --- a/uitest/src/com/vaadin/tests/push/IdlePushChannelLongPollingTest.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -public class IdlePushChannelLongPollingTest extends IdlePushChannelTest { - @Override - protected Class<?> getUIClass() { - return BasicPushLongPolling.class; - } -} diff --git a/uitest/src/com/vaadin/tests/push/IdlePushChannelStreamingTest.java b/uitest/src/com/vaadin/tests/push/IdlePushChannelStreamingTest.java deleted file mode 100644 index c5a909385f..0000000000 --- a/uitest/src/com/vaadin/tests/push/IdlePushChannelStreamingTest.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -public class IdlePushChannelStreamingTest extends IdlePushChannelTest { - @Override - protected Class<?> getUIClass() { - return BasicPushStreaming.class; - } -} diff --git a/uitest/src/com/vaadin/tests/push/IdlePushChannelTest.java b/uitest/src/com/vaadin/tests/push/IdlePushChannelTest.java deleted file mode 100644 index 344f551f00..0000000000 --- a/uitest/src/com/vaadin/tests/push/IdlePushChannelTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.testbench.parallel.TestCategory; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@TestCategory("push") -public abstract class IdlePushChannelTest extends MultiBrowserTest { - - private static final int SEVEN_MINUTES_IN_MS = 7 * 60 * 1000; - - @Test - public void longWaitBetweenActions() throws Exception { - openTestURL(); - BasicPushTest.getIncrementButton(this).click(); - Assert.assertEquals(1, BasicPushTest.getClientCounter(this)); - sleep(SEVEN_MINUTES_IN_MS); - BasicPushTest.getIncrementButton(this).click(); - Assert.assertEquals(2, BasicPushTest.getClientCounter(this)); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/IdlePushChannelWebsocketTest.java b/uitest/src/com/vaadin/tests/push/IdlePushChannelWebsocketTest.java deleted file mode 100644 index 7559d22264..0000000000 --- a/uitest/src/com/vaadin/tests/push/IdlePushChannelWebsocketTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import java.util.List; - -import org.openqa.selenium.remote.DesiredCapabilities; - -import com.vaadin.tests.tb3.WebsocketTest; - -public class IdlePushChannelWebsocketTest extends IdlePushChannelTest { - - @Override - protected Class<?> getUIClass() { - return BasicPushWebsocket.class; - } - - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - return getBrowsersSupportingWebSocket(); - } -} diff --git a/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUI.java b/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUI.java deleted file mode 100644 index 190f6daa24..0000000000 --- a/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUI.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.communication.PushMode; -import com.vaadin.shared.ui.ui.Transport; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; - -@Push(value = PushMode.MANUAL, transport = Transport.LONG_POLLING) -public class ManualLongPollingPushUI extends AbstractTestUIWithLog { - - ExecutorService executor = Executors.newFixedThreadPool(1); - - @Override - protected void setup(VaadinRequest request) { - Button b = new Button("Manual push after 1s", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - executor.submit(new Runnable() { - @Override - public void run() { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - access(new Runnable() { - - @Override - public void run() { - log("Logged after 1s, followed by manual push"); - push(); - } - }); - - } - }); - } - }); - addComponent(b); - - b = new Button("Double manual push after 1s", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - executor.submit(new Runnable() { - @Override - public void run() { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - access(new Runnable() { - - @Override - public void run() { - log("First message logged after 1s, followed by manual push"); - push(); - log("Second message logged after 1s, followed by manual push"); - push(); - } - }); - - } - }); - } - }); - addComponent(b); - - } - -} diff --git a/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUITest.java b/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUITest.java deleted file mode 100644 index 096204ff75..0000000000 --- a/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUITest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Test; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.support.ui.ExpectedCondition; - -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.tests.tb3.SingleBrowserTest; - -public class ManualLongPollingPushUITest extends SingleBrowserTest { - - @Test - public void doubleManualPushDoesNotFreezeApplication() { - openTestURL(); - $(ButtonElement.class).caption("Double manual push after 1s").first() - .click(); - waitUntilLogText("2. Second message logged after 1s, followed by manual push"); - $(ButtonElement.class).caption("Manual push after 1s").first().click(); - waitUntilLogText("3. Logged after 1s, followed by manual push"); - } - - private void waitUntilLogText(final String expected) { - waitUntil(new ExpectedCondition<Boolean>() { - private String actual; - - @Override - public Boolean apply(WebDriver arg0) { - actual = getLogRow(0); - return expected.equals(actual); - } - - @Override - public String toString() { - return String.format("log text to become '%s' (was: '%s')", - expected, actual); - } - }); - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushConfiguration.java b/uitest/src/com/vaadin/tests/push/PushConfiguration.java deleted file mode 100644 index 5e56a5f361..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushConfiguration.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import java.util.Date; -import java.util.Timer; -import java.util.TimerTask; - -import com.vaadin.data.util.ObjectProperty; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.label.ContentMode; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Label; - -public class PushConfiguration extends AbstractTestUI { - - private ObjectProperty<Integer> counter = new ObjectProperty<Integer>(0); - - private ObjectProperty<Integer> counter2 = new ObjectProperty<Integer>(0); - - private final Timer timer = new Timer(true); - - private final TimerTask task = new TimerTask() { - - @Override - public void run() { - access(new Runnable() { - @Override - public void run() { - counter2.setValue(counter2.getValue() + 1); - } - }); - } - }; - - @Override - protected void setup(VaadinRequest request) { - addComponent(new PushConfigurator(this)); - spacer(); - - /* - * Client initiated push. - */ - Label lbl = new Label(counter); - lbl.setCaption("Client counter (click 'increment' to update):"); - addComponent(lbl); - - addComponent(new Button("Increment", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - counter.setValue(counter.getValue() + 1); - } - })); - - spacer(); - - /* - * Server initiated push. - */ - lbl = new Label(counter2); - lbl.setCaption("Server counter (updates each 1s by server thread) :"); - addComponent(lbl); - - addComponent(new Button("Reset", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - counter2.setValue(0); - } - })); - } - - @Override - protected String getTestDescription() { - return "This test tests the very basic operations of push. " - + "It tests that client initiated changes are " - + "recieved back to the client as well as server " - + "initiated changes are correctly updated to the client."; - } - - @Override - protected Integer getTicketNumber() { - return 11494; - } - - private void spacer() { - addComponent(new Label("<hr/>", ContentMode.HTML)); - } - - @Override - public void attach() { - super.attach(); - timer.scheduleAtFixedRate(task, new Date(), 1000); - } - - @Override - public void detach() { - super.detach(); - timer.cancel(); - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationLongPollingTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationLongPollingTest.java deleted file mode 100644 index 1d5ead7d98..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushConfigurationLongPollingTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.MatcherAssert.assertThat; - -import org.junit.Test; - -public class PushConfigurationLongPollingTest extends PushConfigurationTest { - - @Test - public void testLongPolling() throws InterruptedException { - openDebugLogTab(); - - getTransportSelect().selectByText("Long polling"); - assertThat(getStatusText(), - containsString("fallbackTransport: long-polling")); - assertThat(getStatusText(), containsString("transport: long-polling")); - - clearDebugMessages(); - getPushModeSelect().selectByText("Automatic"); - waitForDebugMessage("Push connection established using long-polling", - 10); - waitForServerCounterToUpdate(); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationStreamingTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationStreamingTest.java deleted file mode 100644 index 202db8d6b7..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushConfigurationStreamingTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.MatcherAssert.assertThat; - -import org.junit.Test; - -public class PushConfigurationStreamingTest extends PushConfigurationTest { - - @Test - public void testStreaming() throws InterruptedException { - openDebugLogTab(); - - getTransportSelect().selectByText("Streaming"); - assertThat(getStatusText(), - containsString("fallbackTransport: long-polling")); - assertThat(getStatusText(), containsString("transport: streaming")); - - clearDebugMessages(); - getPushModeSelect().selectByText("Automatic"); - - waitForDebugMessage("Push connection established using streaming", 10); - waitForServerCounterToUpdate(); - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java deleted file mode 100644 index 14ef9e1144..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import static org.junit.Assert.assertEquals; - -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.ExpectedCondition; - -import com.vaadin.testbench.elements.NativeSelectElement; -import com.vaadin.testbench.parallel.TestCategory; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@TestCategory("push") -abstract class PushConfigurationTest extends MultiBrowserTest { - - @Override - protected Class<?> getUIClass() { - return PushConfiguration.class; - } - - @Override - public void setup() throws Exception { - super.setup(); - setDebug(true); - - openTestURL("restartApplication"); - disablePush(); - } - - protected String getStatusText() { - WebElement statusLabel = vaadinElementById("status"); - - return statusLabel.getText(); - } - - protected void disablePush() throws InterruptedException { - getPushModeSelect().selectByText("Disabled"); - - int counter = getServerCounter(); - sleep(2000); - assertEquals("Server count changed without push enabled", counter, - getServerCounter()); - } - - protected NativeSelectElement getPushModeSelect() { - return $(NativeSelectElement.class).caption("Push mode").first(); - } - - protected NativeSelectElement getTransportSelect() { - return $(NativeSelectElement.class).caption("Transport").first(); - } - - protected int getServerCounter() { - return Integer.parseInt(getServerCounterElement().getText()); - } - - protected WebElement getServerCounterElement() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VLabel[0]"); - } - - protected void waitForServerCounterToUpdate() { - int counter = getServerCounter(); - final int waitCounter = counter + 2; - waitUntil(new ExpectedCondition<Boolean>() { - - @Override - public Boolean apply(WebDriver input) { - return (getServerCounter() >= waitCounter); - } - }); - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationWebSocketTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationWebSocketTest.java deleted file mode 100644 index 501d946fcc..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushConfigurationWebSocketTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.MatcherAssert.assertThat; - -import java.util.List; - -import org.junit.Test; -import org.openqa.selenium.remote.DesiredCapabilities; - -public class PushConfigurationWebSocketTest extends PushConfigurationTest { - - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - return getBrowsersSupportingWebSocket(); - } - - @Test - public void testWebsocket() throws InterruptedException { - getTransportSelect().selectByText("Websocket"); - getPushModeSelect().selectByText("Automatic"); - - assertThat(getStatusText(), - containsString("fallbackTransport: long-polling")); - assertThat(getStatusText(), containsString("transport: websocket")); - - waitForServerCounterToUpdate(); - - // Use debug console to verify we used the correct transport type - assertThat(driver.getPageSource(), - containsString("Push connection established using websocket")); - assertThat( - driver.getPageSource(), - not(containsString("Push connection established using streaming"))); - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurator.java b/uitest/src/com/vaadin/tests/push/PushConfigurator.java deleted file mode 100644 index 7da58af1da..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushConfigurator.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import java.util.ArrayList; -import java.util.Collections; - -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.shared.communication.PushMode; -import com.vaadin.shared.ui.label.ContentMode; -import com.vaadin.shared.ui.ui.Transport; -import com.vaadin.ui.Alignment; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.NativeSelect; -import com.vaadin.ui.PushConfiguration; -import com.vaadin.ui.TextField; -import com.vaadin.ui.UI; -import com.vaadin.ui.VerticalLayout; - -/** - * - * @since 7.1 - * @author Vaadin Ltd - */ -public class PushConfigurator extends VerticalLayout { - private NativeSelect pushMode = new NativeSelect("Push mode"); - private NativeSelect transport = new NativeSelect("Transport"); - private NativeSelect fallbackTransport = new NativeSelect("Fallback"); - private TextField parameter = new TextField("Parameter"); - private TextField value = new TextField("Value"); - private Button set = new Button("Set"); - private HorizontalLayout paramValue = new HorizontalLayout(); - private VerticalLayout vl = new VerticalLayout(); - private UI ui; - - private Label status = new Label("", ContentMode.PREFORMATTED); - - public PushConfigurator(UI ui) { - this.ui = ui; - construct(); - refreshStatus(); - } - - /** - * @since - */ - private void refreshStatus() { - PushConfiguration pc = ui.getPushConfiguration(); - String value = ""; - ArrayList<String> names = new ArrayList<String>(); - names.addAll(pc.getParameterNames()); - Collections.sort(names); - for (String param : names) { - value += param + ": " + pc.getParameter(param) + "\n"; - } - status.setValue(value); - } - - /** - * @since - */ - private void construct() { - pushMode.addItem(PushMode.DISABLED); - pushMode.addItem(PushMode.MANUAL); - pushMode.addItem(PushMode.AUTOMATIC); - - for (Transport t : Transport.values()) { - transport.addItem(t); - fallbackTransport.addItem(t); - } - - pushMode.setImmediate(true); - transport.setImmediate(true); - fallbackTransport.setImmediate(true); - - listeners(); - - paramValue.setDefaultComponentAlignment(Alignment.BOTTOM_RIGHT); - paramValue.addComponents(parameter, value, set); - status.setId("status"); - vl.addComponents(pushMode, transport, fallbackTransport, paramValue, - new Label("<hr/>", ContentMode.HTML), status); - addComponent(vl); - - } - - /** - * @since - */ - private void listeners() { - pushMode.addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - ui.getPushConfiguration().setPushMode( - (PushMode) pushMode.getValue()); - refreshStatus(); - } - }); - - transport.addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - Transport t = (Transport) transport.getValue(); - ui.getPushConfiguration().setTransport(t); - refreshStatus(); - } - }); - - fallbackTransport.addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - Transport t = (Transport) fallbackTransport.getValue(); - ui.getPushConfiguration().setFallbackTransport(t); - refreshStatus(); - } - }); - - set.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - ui.getPushConfiguration().setParameter(parameter.getValue(), - value.getValue()); - refreshStatus(); - } - }); - - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushErrorHandling.java b/uitest/src/com/vaadin/tests/push/PushErrorHandling.java deleted file mode 100644 index a1182c0daf..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushErrorHandling.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.vaadin.tests.push; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import com.vaadin.data.util.AbstractInMemoryContainer; -import com.vaadin.data.util.BeanContainer; -import com.vaadin.event.ItemClickEvent; -import com.vaadin.event.ItemClickEvent.ItemClickListener; -import com.vaadin.server.ErrorHandler; -import com.vaadin.server.VaadinRequest; -import com.vaadin.server.VaadinSession; -import com.vaadin.shared.communication.PushMode; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Label; -import com.vaadin.ui.Table; - -public class PushErrorHandling extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - getPushConfiguration().setPushMode(PushMode.AUTOMATIC); - - VaadinSession.getCurrent().setErrorHandler(new ErrorHandler() { - - @Override - public void error(com.vaadin.server.ErrorEvent event) { - addComponent(new Label("An error! " - + event.getThrowable().getMessage())); - System.err.println("An error! " - + event.getThrowable().getMessage()); - } - }); - - final Button button = new Button("Click for NPE!", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - ((String) null).length(); // Null-pointer exception - } - }); - button.setId("npeButton"); - addComponent(button); - - final Table view = new Table("testtable"); - view.setId("testtable"); - view.setSelectable(true); - view.setMultiSelect(false); - view.setImmediate(true); - view.setSizeFull(); - - view.addItemClickListener(new ItemClickListener() { - - @Override - public void itemClick(ItemClickEvent event) { - BeanContainer<String, AbstractInMemoryContainer> metaContainer = new BeanContainer<String, AbstractInMemoryContainer>( - AbstractInMemoryContainer.class) { - @Override - public Collection<String> getContainerPropertyIds() { - List<String> cpropIds = new ArrayList<String>(super - .getContainerPropertyIds()); - cpropIds.add("testid"); - return cpropIds; - } - - @Override - public Class<?> getType(Object propertyId) { - ((Object) null).hashCode(); - return super.getType(propertyId); - } - }; - view.setContainerDataSource(metaContainer); - - } - }); - view.addContainerProperty("Column", String.class, "Click for NPE"); - view.addItem(new Object()); - - addComponent(view); - - } - - @Override - protected String getTestDescription() { - return "Error handling should still work w/ push enabled. (Button can be handled properly, table causes internal error)"; - } - - @Override - protected Integer getTicketNumber() { - return 11882; - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushErrorHandlingTest.java b/uitest/src/com/vaadin/tests/push/PushErrorHandlingTest.java deleted file mode 100644 index 2683868db5..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushErrorHandlingTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; - -import com.vaadin.testbench.elements.LabelElement; -import com.vaadin.testbench.parallel.BrowserUtil; -import com.vaadin.testbench.parallel.TestCategory; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@TestCategory("push") -public class PushErrorHandlingTest extends MultiBrowserTest { - - @Test - public void testErrorHandling() { - setPush(true); - openTestURL(); - vaadinElementById("npeButton").click(); - int idx = 1; - if (BrowserUtil.isPhantomJS(getDesiredCapabilities())) { - // PhantomJS sends an extra event when page gets loaded. - // This results as an extra error label. - ++idx; - } - Assert.assertEquals( - "An error! Unable to invoke method click in com.vaadin.shared.ui.button.ButtonServerRpc", - $(LabelElement.class).get(idx).getText()); - - WebElement table = vaadinElementById("testtable"); - WebElement row = table.findElement(By - .xpath("//div[text()='Click for NPE']")); - row.click(); - - Assert.assertEquals("Internal error", - vaadinElement("Root/VNotification[0]/HTML[0]/domChild[0]") - .getText()); - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushFromInit.java b/uitest/src/com/vaadin/tests/push/PushFromInit.java deleted file mode 100644 index 63af3d9ec7..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushFromInit.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.Button; - -@Push -public class PushFromInit extends AbstractTestUIWithLog { - - public static final String LOG_DURING_INIT = "Logged from access run before init ends"; - public static final String LOG_AFTER_INIT = "Logged from background thread run after init has finished"; - - @Override - protected void setup(VaadinRequest request) { - log("Logged in init"); - Thread t = new Thread(new RunBeforeInitEnds()); - t.start(); - try { - t.join(); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - new Thread(new RunAfterInit()).start(); - addComponent(new Button("Sync")); - } - - class RunBeforeInitEnds implements Runnable { - @Override - public void run() { - access(new Runnable() { - @Override - public void run() { - log(LOG_DURING_INIT); - } - }); - } - } - - class RunAfterInit implements Runnable { - @Override - public void run() { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - access(new Runnable() { - @Override - public void run() { - log(LOG_AFTER_INIT); - } - }); - } - } - - @Override - protected String getTestDescription() { - return "Pusing something to a newly created UI should not cause race conditions"; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(11529); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/PushFromInitTest.java b/uitest/src/com/vaadin/tests/push/PushFromInitTest.java deleted file mode 100644 index fe7ebebef1..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushFromInitTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Test; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.support.ui.ExpectedCondition; - -import com.vaadin.testbench.parallel.TestCategory; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@TestCategory("push") -public class PushFromInitTest extends MultiBrowserTest { - @Test - public void testPushFromInit() { - openTestURL(); - - waitUntil(new ExpectedCondition<Boolean>() { - @Override - public Boolean apply(WebDriver input) { - return ("3. " + PushFromInit.LOG_AFTER_INIT) - .equals(getLogRow(0)); - } - }); - - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushLargeData.java b/uitest/src/com/vaadin/tests/push/PushLargeData.java deleted file mode 100644 index f9625b80be..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushLargeData.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.tests.util.LoremIpsum; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Label; -import com.vaadin.ui.TextField; -import com.vaadin.ui.UI; - -public abstract class PushLargeData extends AbstractTestUIWithLog { - - // 200KB - static final int DEFAULT_SIZE_BYTES = 200 * 1000; - - // Every other second - static final int DEFAULT_DELAY_MS = 2000; - - // 3 MB is enough for streaming to reconnect - static final int DEFAULT_DATA_TO_PUSH = 3 * 1000 * 1000; - - static final int DEFAULT_DURATION_MS = DEFAULT_DATA_TO_PUSH - / DEFAULT_SIZE_BYTES * DEFAULT_DELAY_MS; - - private Label dataLabel = new Label(); - - private final ExecutorService executor = Executors - .newSingleThreadExecutor(); - - protected TextField dataSize; - - protected TextField interval; - - protected TextField duration; - - @Override - protected void setup(VaadinRequest request) { - dataLabel.setSizeUndefined(); - dataSize = new TextField("Data size"); - dataSize.setConverter(Integer.class); - interval = new TextField("Interval (ms)"); - interval.setConverter(Integer.class); - duration = new TextField("Duration (ms)"); - duration.setConverter(Integer.class); - - dataSize.setValue(DEFAULT_SIZE_BYTES + ""); - interval.setValue(DEFAULT_DELAY_MS + ""); - duration.setValue(DEFAULT_DURATION_MS + ""); - - addComponent(dataSize); - addComponent(interval); - addComponent(duration); - - Button b = new Button("Start pushing"); - b.setId("startButton"); - b.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - Integer pushSize = (Integer) dataSize.getConvertedValue(); - Integer pushInterval = (Integer) interval.getConvertedValue(); - Integer pushDuration = (Integer) duration.getConvertedValue(); - PushRunnable r = new PushRunnable(pushSize, pushInterval, - pushDuration); - executor.execute(r); - log.log("Starting push, size: " + pushSize + ", interval: " - + pushInterval + "ms, duration: " + pushDuration + "ms"); - } - }); - addComponent(b); - addComponent(dataLabel); - } - - public Label getDataLabel() { - return dataLabel; - } - - @Override - protected String getTestDescription() { - return "Tests that pushing large amounts of data do not cause problems"; - } - - @Override - protected Integer getTicketNumber() { - return 12567; - } - - public static class PushRunnable implements Runnable { - - private Integer size; - private Integer interval; - private Integer duration; - - public PushRunnable(Integer size, Integer interval, Integer duration) { - this.size = size; - this.interval = interval; - this.duration = duration; - } - - @Override - public void run() { - final long endTime = System.currentTimeMillis() + duration; - final String data = LoremIpsum.get(size); - int packageIndex = 1; - while (System.currentTimeMillis() < endTime) { - final int idx = packageIndex++; - UI.getCurrent().access(new Runnable() { - @Override - public void run() { - PushLargeData ui = (PushLargeData) UI.getCurrent(); - // Using description as it is not rendered to the DOM - // immediately - ui.getDataLabel().setDescription( - System.currentTimeMillis() + ": " + data); - ui.log("Package " + idx + " pushed"); - } - }); - try { - Thread.sleep(interval); - } catch (InterruptedException e) { - return; - } - } - UI.getCurrent().access(new Runnable() { - @Override - public void run() { - PushLargeData ui = (PushLargeData) UI.getCurrent(); - ui.log("Push complete"); - } - }); - - } - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataLongPolling.java b/uitest/src/com/vaadin/tests/push/PushLargeDataLongPolling.java deleted file mode 100644 index c2fdb5ae95..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushLargeDataLongPolling.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.ui.Transport; -import com.vaadin.shared.ui.ui.UIState.PushConfigurationState; - -@Push(transport = Transport.LONG_POLLING) -public class PushLargeDataLongPolling extends PushLargeData { - - @Override - protected void setup(VaadinRequest request) { - super.setup(request); - getPushConfiguration().setParameter( - PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none"); - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java deleted file mode 100644 index 23255aadea..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.support.ui.ExpectedConditions; - -import com.vaadin.testbench.parallel.TestCategory; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@TestCategory("push") -public class PushLargeDataLongPollingTest extends MultiBrowserTest { - - @Test - public void testLongPollingLargeData() throws Exception { - openTestURL(); - - // Without this there is a large chance that we will wait for all pushes - // to complete before moving on - testBench(driver).disableWaitForVaadin(); - - push(); - // Push complete. Browser will reconnect now as > 10MB has been sent - // Push again to ensure push still works - push(); - - } - - private void push() throws InterruptedException { - // Wait for startButton to be present - waitForElementVisible(vaadinLocatorById("startButton")); - - String logRow0Id = "Log_row_0"; - By logRow0 = vaadinLocatorById(logRow0Id); - - vaadinElementById("startButton").click(); - // Wait for push to start - waitUntil(ExpectedConditions.textToBePresentInElement(logRow0, - "Package ")); - - // Wait for until push should be done - sleep(PushLargeData.DEFAULT_DURATION_MS); - - // Wait until push is actually done - waitUntil(ExpectedConditions.textToBePresentInElement(logRow0, - "Push complete")); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataStreaming.java b/uitest/src/com/vaadin/tests/push/PushLargeDataStreaming.java deleted file mode 100644 index ef300ab222..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushLargeDataStreaming.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.ui.Transport; -import com.vaadin.shared.ui.ui.UIState.PushConfigurationState; - -@Push(transport = Transport.STREAMING) -public class PushLargeDataStreaming extends PushLargeData { - - @Override - protected void setup(VaadinRequest request) { - super.setup(request); - getPushConfiguration().setTransport(Transport.STREAMING); - getPushConfiguration().setParameter( - PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none"); - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java deleted file mode 100644 index 0c00cf116f..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.support.ui.ExpectedConditions; - -import com.vaadin.testbench.parallel.TestCategory; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@TestCategory("push") -public class PushLargeDataStreamingTest extends MultiBrowserTest { - - @Test - public void testStreamingLargeData() throws InterruptedException { - openTestURL(); - - // Without this there is a large chance that we will wait for all pushes - // to complete before moving on - testBench(driver).disableWaitForVaadin(); - - push(); - // Push complete. Browser will reconnect now as > 10MB has been sent - // Push again to ensure push still works - push(); - - } - - private void push() throws InterruptedException { - // Wait for startButton to be present - waitForElementVisible(vaadinLocatorById("startButton")); - - String logRow0Id = "Log_row_0"; - By logRow0 = vaadinLocatorById(logRow0Id); - - vaadinElementById("startButton").click(); - // Wait for push to start - waitUntil(ExpectedConditions.textToBePresentInElement(logRow0, - "Package ")); - - // Wait for until push should be done - sleep(PushLargeData.DEFAULT_DURATION_MS); - - // Wait until push is actually done - waitUntil(ExpectedConditions.textToBePresentInElement(logRow0, - "Push complete")); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocket.java b/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocket.java deleted file mode 100644 index a893d7f1ef..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocket.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.ui.Transport; -import com.vaadin.shared.ui.ui.UIState.PushConfigurationState; - -@Push(transport = Transport.WEBSOCKET) -public class PushLargeDataWebsocket extends PushLargeData { - - @Override - protected void setup(VaadinRequest request) { - super.setup(request); - getPushConfiguration().setParameter( - PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none"); - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java deleted file mode 100644 index da4999799d..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.support.ui.ExpectedConditions; - -import com.vaadin.tests.tb3.WebsocketTest; - -public class PushLargeDataWebsocketTest extends WebsocketTest { - - @Test - public void testWebsocketLargeData() throws Exception { - openTestURL(); - - // Without this timing will be completly off as pushing "start" can - // remain waiting for all pushes to complete - testBench(driver).disableWaitForVaadin(); - - push(); - // Push complete. Browser will reconnect now as > 10MB has been sent - // Push again to ensure push still works - push(); - - } - - private void push() throws Exception { - // Wait for startButton to be present - waitForElementVisible(vaadinLocatorById("startButton")); - - String logRow0Id = "Log_row_0"; - By logRow0 = vaadinLocatorById(logRow0Id); - - vaadinElementById("startButton").click(); - // Wait for push to start - waitUntil(ExpectedConditions.textToBePresentInElement(logRow0, - "Package")); - - // Wait for until push should be done - sleep(PushLargeData.DEFAULT_DURATION_MS); - - // Wait until push is actually done - waitUntil(ExpectedConditions.textToBePresentInElement(logRow0, - "Push complete")); - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushWithPreserveOnRefresh.java b/uitest/src/com/vaadin/tests/push/PushWithPreserveOnRefresh.java deleted file mode 100644 index af19f8849f..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushWithPreserveOnRefresh.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.vaadin.tests.push; - -import com.vaadin.annotations.PreserveOnRefresh; -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.util.Log; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Label; - -@PreserveOnRefresh -@Push -public class PushWithPreserveOnRefresh extends AbstractTestUI { - - private Log log = new Log(5); - private int times = 0; - - @Override - protected void setup(VaadinRequest request) { - // Internal parameter sent by vaadinBootstrap.js, - addComponent(new Label("window.name: " + request.getParameter("v-wn"))); - addComponent(new Label("UI id: " + getUIId())); - addComponent(log); - - addButton("click me", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log.log("Button has been clicked " + (++times) + " times"); - } - }); - } - - @Override - protected String getTestDescription() { - return "Refreshing the browser window should preserve the state and push should continue to work"; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(13620); - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushWithPreserveOnRefreshTest.java b/uitest/src/com/vaadin/tests/push/PushWithPreserveOnRefreshTest.java deleted file mode 100644 index 3c532b2e55..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushWithPreserveOnRefreshTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class PushWithPreserveOnRefreshTest extends MultiBrowserTest { - - @Test - public void ensurePushWorksAfterRefresh() { - openTestURL(); - $(ButtonElement.class).first().click(); - $(ButtonElement.class).first().click(); - Assert.assertEquals("2. Button has been clicked 2 times", getLogRow(0)); - openTestURL(); - Assert.assertEquals("2. Button has been clicked 2 times", getLogRow(0)); - $(ButtonElement.class).first().click(); - Assert.assertEquals("3. Button has been clicked 3 times", getLogRow(0)); - - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushWithRequireJS.java b/uitest/src/com/vaadin/tests/push/PushWithRequireJS.java deleted file mode 100644 index 93e9d392ee..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushWithRequireJS.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.JavaScript; -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; - -@Push -// https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.20/require.min.js -@JavaScript("require.min.js") -public class PushWithRequireJS extends AbstractTestUI { - @Override - protected void setup(VaadinRequest request) { - } -} diff --git a/uitest/src/com/vaadin/tests/push/PushWithRequireJSTest.java b/uitest/src/com/vaadin/tests/push/PushWithRequireJSTest.java deleted file mode 100644 index 16bc753272..0000000000 --- a/uitest/src/com/vaadin/tests/push/PushWithRequireJSTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Test; - -import com.vaadin.tests.tb3.SingleBrowserTest; - -public class PushWithRequireJSTest extends SingleBrowserTest { - - @Test - public void testPushWithRequireJS() { - setDebug(true); - openTestURL(); - assertNoErrorNotifications(); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/ReconnectLongPollingTest.java b/uitest/src/com/vaadin/tests/push/ReconnectLongPollingTest.java deleted file mode 100644 index 22d020b631..0000000000 --- a/uitest/src/com/vaadin/tests/push/ReconnectLongPollingTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.openqa.selenium.remote.DesiredCapabilities; - -import java.util.List; - -public class ReconnectLongPollingTest extends ReconnectTest { - - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - - // PhantomJS doesn't seem to detect disconnection on - // Long-Polling/Streaming: - // https://github.com/ariya/phantomjs/issues/11938 - return getBrowsersExcludingPhantomJS(); - } - - @Override - protected Class<?> getUIClass() { - return BasicPushLongPolling.class; - } - -} diff --git a/uitest/src/com/vaadin/tests/push/ReconnectStreamingTest.java b/uitest/src/com/vaadin/tests/push/ReconnectStreamingTest.java deleted file mode 100755 index 4a669e723c..0000000000 --- a/uitest/src/com/vaadin/tests/push/ReconnectStreamingTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.openqa.selenium.remote.DesiredCapabilities; - -import java.util.List; - -public class ReconnectStreamingTest extends ReconnectTest { - - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - - // PhantomJS doesn't seem to detect disconnection on - // Long-Polling/Streaming: - // https://github.com/ariya/phantomjs/issues/11938 - return getBrowsersExcludingPhantomJS(); - } - - @Override - protected Class<?> getUIClass() { - return BasicPushStreaming.class; - } - -} diff --git a/uitest/src/com/vaadin/tests/push/ReconnectTest.java b/uitest/src/com/vaadin/tests/push/ReconnectTest.java deleted file mode 100644 index 6a632f2667..0000000000 --- a/uitest/src/com/vaadin/tests/push/ReconnectTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.ExpectedCondition; - -import com.jcraft.jsch.JSchException; -import com.vaadin.tests.tb3.MultiBrowserTestWithProxy; - -public abstract class ReconnectTest extends MultiBrowserTestWithProxy { - - @Override - public void setup() throws Exception { - super.setup(); - - setDebug(true); - openTestURL(); - openDebugLogTab(); - - startTimer(); - waitUntilServerCounterChanges(); - - testBench().disableWaitForVaadin(); - } - - @Test - public void messageIsQueuedOnDisconnect() throws JSchException { - disconnectProxy(); - - clickButtonAndWaitForTwoReconnectAttempts(); - - connectAndVerifyConnectionEstablished(); - waitUntilClientCounterChanges(1); - } - - @Test - public void messageIsNotSentBeforeConnectionIsEstablished() - throws JSchException, InterruptedException { - disconnectProxy(); - - waitForNextReconnectionAttempt(); - clickButtonAndWaitForTwoReconnectAttempts(); - - connectAndVerifyConnectionEstablished(); - waitUntilClientCounterChanges(1); - } - - private void clickButtonAndWaitForTwoReconnectAttempts() { - clickClientButton(); - - // Reconnection attempt is where pending messages can - // falsely be sent to server. - waitForNextReconnectionAttempt(); - - // Waiting for the second reconnection attempt makes sure that the - // first attempt has been completed or aborted. - waitForNextReconnectionAttempt(); - } - - private void clickClientButton() { - getIncrementClientCounterButton().click(); - } - - private void waitForNextReconnectionAttempt() { - clearDebugMessages(); - waitForDebugMessage("Reopening push connection"); - } - - private void connectAndVerifyConnectionEstablished() throws JSchException { - connectProxy(); - waitUntilServerCounterChanges(); - } - - private WebElement getIncrementClientCounterButton() { - return BasicPushTest.getIncrementButton(this); - } - - private void waitUntilServerCounterChanges() { - final int counter = BasicPushTest.getServerCounter(this); - waitUntil(new ExpectedCondition<Boolean>() { - - @Override - public Boolean apply(WebDriver input) { - return BasicPushTest.getServerCounter(ReconnectTest.this) > counter; - } - }, 30); - } - - private void waitUntilClientCounterChanges(final int expectedValue) { - waitUntil(new ExpectedCondition<Boolean>() { - - @Override - public Boolean apply(WebDriver input) { - return BasicPushTest.getClientCounter(ReconnectTest.this) == expectedValue; - } - }, 5); - } - - private void startTimer() { - BasicPushTest.getServerCounterStartButton(this).click(); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/ReconnectWebsocketTest.java b/uitest/src/com/vaadin/tests/push/ReconnectWebsocketTest.java deleted file mode 100644 index bad00eba47..0000000000 --- a/uitest/src/com/vaadin/tests/push/ReconnectWebsocketTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import java.util.List; - -import org.openqa.selenium.remote.DesiredCapabilities; - -import com.vaadin.tests.tb3.WebsocketTest; - -public class ReconnectWebsocketTest extends ReconnectTest { - - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - return getBrowsersSupportingWebSocket(); - } - - @Override - protected Class<?> getUIClass() { - return BasicPushWebsocket.class; - } - -} diff --git a/uitest/src/com/vaadin/tests/push/RefreshCloseConnection.java b/uitest/src/com/vaadin/tests/push/RefreshCloseConnection.java deleted file mode 100644 index 4d02c4e62e..0000000000 --- a/uitest/src/com/vaadin/tests/push/RefreshCloseConnection.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.PreserveOnRefresh; -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUIWithLog; - -@Push -@PreserveOnRefresh -public class RefreshCloseConnection extends AbstractTestUIWithLog { - - @Override - protected void setup(VaadinRequest request) { - log("Init"); - } - - @Override - protected void refresh(VaadinRequest request) { - if (getPushConnection().isConnected()) { - log("Still connected"); - } - log("Refresh"); - new Thread() { - @Override - public void run() { - accessSynchronously(new Runnable() { - @Override - public void run() { - log("Push"); - } - }); - } - }.start(); - } - - @Override - protected String getTestDescription() { - return "A log row should get pushed after reloading the page"; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(14251); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java b/uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java deleted file mode 100644 index 47773b87b6..0000000000 --- a/uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.remote.DesiredCapabilities; - -import com.vaadin.testbench.parallel.TestCategory; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@TestCategory("push") -public class RefreshCloseConnectionTest extends MultiBrowserTest { - - @Test - public void testSessionRefresh() { - openTestURL("restartApplication"); - - Assert.assertEquals("1. Init", getLogRow(0)); - - openTestURL(); - - Assert.assertEquals("2. Refresh", getLogRow(1)); - Assert.assertEquals("3. Push", getLogRow(0)); - } - - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - return getBrowsersSupportingWebSocket(); - } -} diff --git a/uitest/src/com/vaadin/tests/push/RoundTripTest.java b/uitest/src/com/vaadin/tests/push/RoundTripTest.java deleted file mode 100644 index 4e192db7f8..0000000000 --- a/uitest/src/com/vaadin/tests/push/RoundTripTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Widgetset; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.widgetset.TestingWidgetSet; -import com.vaadin.tests.widgetset.server.RoundTripTester; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.TextField; - -@Widgetset(TestingWidgetSet.NAME) -public class RoundTripTest extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - final RoundTripTester roundTripTester = new RoundTripTester(); - final TextField payloadSize = new TextField("Payload size (bytes)"); - payloadSize.setConverter(Integer.class); - payloadSize.setConvertedValue(10000); - if (request.getParameter("payload") != null) { - payloadSize.setValue(request.getParameter("payload")); - } - addComponent(payloadSize); - final TextField testDuration = new TextField("Test duration (ms)"); - testDuration.setConverter(Integer.class); - testDuration.setConvertedValue(10000); - addComponent(testDuration); - if (request.getParameter("duration") != null) { - testDuration.setValue(request.getParameter("duration")); - } - - Button start = new Button("Start test"); - start.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - roundTripTester.start( - (Integer) testDuration.getConvertedValue(), - (Integer) payloadSize.getConvertedValue()); - } - }); - addComponent(roundTripTester); - addComponent(start); - - if (request.getParameter("go") != null) { - start.click(); - } - } - - @Override - protected String getTestDescription() { - return "Tests how many roundtrips per second you can get using the given package size"; - } - - @Override - protected Integer getTicketNumber() { - return 11370; - } - -} diff --git a/uitest/src/com/vaadin/tests/push/SendMultibyteCharacters.java b/uitest/src/com/vaadin/tests/push/SendMultibyteCharacters.java deleted file mode 100644 index e41f769724..0000000000 --- a/uitest/src/com/vaadin/tests/push/SendMultibyteCharacters.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.TextArea; - -@Push -public class SendMultibyteCharacters extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - TextArea textArea = new TextArea(); - textArea.setImmediate(true); - - addComponent(textArea); - } - - @Override - protected Integer getTicketNumber() { - return 14674; - } -} diff --git a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersLongPollingTest.java b/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersLongPollingTest.java deleted file mode 100644 index c00f95a950..0000000000 --- a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersLongPollingTest.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.vaadin.tests.push; - -public class SendMultibyteCharactersLongPollingTest extends - SendMultibyteCharactersTest { - - @Override - protected String getTransport() { - return "long-polling"; - } -} diff --git a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersStreamingTest.java b/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersStreamingTest.java deleted file mode 100644 index bc1debb9da..0000000000 --- a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersStreamingTest.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.vaadin.tests.push; - -public class SendMultibyteCharactersStreamingTest extends - SendMultibyteCharactersTest { - - @Override - protected String getTransport() { - return "streaming"; - } -} diff --git a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersTest.java b/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersTest.java deleted file mode 100644 index 95c03d9959..0000000000 --- a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.vaadin.tests.push; - -import org.junit.Test; - -import com.vaadin.testbench.By; -import com.vaadin.testbench.elements.TextAreaElement; -import com.vaadin.testbench.parallel.TestCategory; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@TestCategory("push") -public abstract class SendMultibyteCharactersTest extends MultiBrowserTest { - - @Override - protected Class<?> getUIClass() { - return SendMultibyteCharacters.class; - } - - protected abstract String getTransport(); - - @Test - public void transportSupportsMultibyteCharacters() { - setDebug(true); - openTestURL("transport=" + getTransport()); - openDebugLogTab(); - - TextAreaElement textArea = $(TextAreaElement.class).first(); - - StringBuilder text = new StringBuilder(); - for (int i = 0; i < 20; i++) { - text.append("之は日本語です、テストです。"); - } - - textArea.sendKeys(text.toString()); - - clearDebugMessages(); - - findElement(By.tagName("body")).click(); - - waitForDebugMessage("RPC invocations to be sent to the server:", 5); - waitForDebugMessage("Handling message from server", 10); - } - -}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersWebSocketTest.java b/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersWebSocketTest.java deleted file mode 100644 index f9ae472b99..0000000000 --- a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersWebSocketTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.vaadin.tests.push; - -import org.openqa.selenium.remote.DesiredCapabilities; - -import java.util.List; - -public class SendMultibyteCharactersWebSocketTest extends - SendMultibyteCharactersTest { - - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - return getBrowsersSupportingWebSocket(); - } - - @Override - protected String getTransport() { - return "websocket"; - } -} diff --git a/uitest/src/com/vaadin/tests/push/StreamingReconnectWhilePushing.java b/uitest/src/com/vaadin/tests/push/StreamingReconnectWhilePushing.java deleted file mode 100644 index 74d089374c..0000000000 --- a/uitest/src/com/vaadin/tests/push/StreamingReconnectWhilePushing.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.ui.Transport; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Label; - -@Push(transport = Transport.STREAMING) -public class StreamingReconnectWhilePushing extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - - Button button = new Button("Click Me"); - button.addClickListener(new Button.ClickListener() { - private Label label; - - @Override - public void buttonClick(ClickEvent event) { - if (label == null) { - label = new Label(); - label.setValue(getString(1000000)); - addComponent(label); - } else { - label.setValue("." + label.getValue()); - } - - } - }); - addComponent(button); - - } - - protected String getString(int len) { - StringBuilder b = new StringBuilder(); - for (int i = 0; i < len; i++) { - if (i % 100 == 0) { - b.append("\n"); - } else { - b.append('A'); - } - - } - return b.toString(); - } - - @Override - protected String getTestDescription() { - return "Each push of the button sends about 1MB to the client. Press it a couple of times and a spinner will appear forever if reconnecting does not work."; - } - - @Override - protected Integer getTicketNumber() { - return 13435; - } - -} diff --git a/uitest/src/com/vaadin/tests/push/TablePushStreaming.java b/uitest/src/com/vaadin/tests/push/TablePushStreaming.java deleted file mode 100644 index 04aad63813..0000000000 --- a/uitest/src/com/vaadin/tests/push/TablePushStreaming.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import com.vaadin.annotations.Push; -import com.vaadin.data.Container; -import com.vaadin.data.Item; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.ui.Transport; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Table; - -/** - * - * @since - * @author Vaadin Ltd - */ -@Push(transport = Transport.STREAMING) -public class TablePushStreaming extends AbstractTestUI { - - private int iteration = 1; - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. - * VaadinRequest) - */ - @Override - protected void setup(VaadinRequest request) { - final Table t = new Table("The table"); - t.setContainerDataSource(generateContainer(10, 10, iteration++)); - t.setSizeFull(); - Runnable r = new Runnable() { - - @Override - public void run() { - for (int i = 0; i < 99; i++) { - try { - Thread.sleep(200); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - access(new Runnable() { - - @Override - public void run() { - t.setContainerDataSource(generateContainer( - t.getVisibleColumns().length, t.size(), - iteration++)); - } - - }); - } - - } - }; - Thread tr = new Thread(r); - tr.start(); - - setContent(t); - } - - /** - * @param iter - * @since - * @return - */ - private Container generateContainer(int rows, int cols, int iter) { - IndexedContainer ic = new IndexedContainer(); - for (int col = 1; col <= cols; col++) { - ic.addContainerProperty("Property" + col, String.class, ""); - } - - for (int row = 0; row < rows; row++) { - Item item = ic.addItem("row" + row); - for (int col = 1; col <= cols; col++) { - item.getItemProperty("Property" + col).setValue( - "Row " + row + " col " + col + "(" + iter + ")"); - } - - } - - return ic; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() - */ - @Override - protected String getTestDescription() { - return "Test that pushes Table data at a high pace to detect possible problems in the streaming protocol"; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() - */ - @Override - protected Integer getTicketNumber() { - return null; - } - -} diff --git a/uitest/src/com/vaadin/tests/push/TogglePush.java b/uitest/src/com/vaadin/tests/push/TogglePush.java deleted file mode 100644 index e662545134..0000000000 --- a/uitest/src/com/vaadin/tests/push/TogglePush.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import java.util.Timer; -import java.util.TimerTask; - -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.communication.PushMode; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.Label; - -public class TogglePush extends AbstractTestUI { - private final Label counterLabel = new Label(); - private int counter = 0; - - @Override - protected void setup(VaadinRequest request) { - updateCounter(); - addComponent(counterLabel); - - getPushConfiguration() - .setPushMode( - "disabled".equals(request.getParameter("push")) ? PushMode.DISABLED - : PushMode.AUTOMATIC); - - CheckBox pushSetting = new CheckBox("Push enabled"); - pushSetting.setValue(Boolean.valueOf(getPushConfiguration() - .getPushMode().isEnabled())); - pushSetting.setImmediate(true); - pushSetting.addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - if (event.getProperty().getValue() == Boolean.TRUE) { - getPushConfiguration().setPushMode(PushMode.AUTOMATIC); - } else { - getPushConfiguration().setPushMode(PushMode.DISABLED); - } - } - }); - addComponent(pushSetting); - - addComponent(new Button("Update counter now", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - updateCounter(); - } - })); - - addComponent(new Button("Update counter in 1 sec", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - new Timer().schedule(new TimerTask() { - @Override - public void run() { - access(new Runnable() { - @Override - public void run() { - updateCounter(); - } - }); - } - }, 1000); - } - })); - } - - public void updateCounter() { - counterLabel.setValue("Counter has been updated " + counter++ - + " times"); - } - - @Override - protected String getTestDescription() { - return "Basic test for enabling and disabling push on the fly."; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(11506); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/TogglePushTest.java b/uitest/src/com/vaadin/tests/push/TogglePushTest.java deleted file mode 100644 index d93802125c..0000000000 --- a/uitest/src/com/vaadin/tests/push/TogglePushTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.WebElement; - -import com.vaadin.testbench.parallel.TestCategory; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@TestCategory("push") -public class TogglePushTest extends MultiBrowserTest { - - @Test - public void togglePushInInit() throws Exception { - setPush(true); - String url = getTestUrl(); - - // Open with push disabled - driver.get(addParameter(url, "push=disabled")); - - Assert.assertFalse(getPushToggle().isSelected()); - - getDelayedCounterUpdateButton().click(); - sleep(2000); - Assert.assertEquals("Counter has been updated 0 times", - getCounterText()); - - // Open with push enabled - driver.get(addParameter(url, "push=enabled")); - Assert.assertTrue(getPushToggle().isSelected()); - - getDelayedCounterUpdateButton().click(); - sleep(2000); - Assert.assertEquals("Counter has been updated 1 times", - getCounterText()); - - } - - private String addParameter(String url, String queryParameter) { - if (url.contains("?")) { - return url + "&" + queryParameter; - } else { - return url + "?" + queryParameter; - } - } - - @Test - public void togglePush() throws InterruptedException { - setPush(true); - openTestURL(); - getDelayedCounterUpdateButton().click(); - sleep(2000); - - // Push is enabled, so text gets updated - Assert.assertEquals("Counter has been updated 1 times", - getCounterText()); - - // Disable push - getPushToggle().click(); - getDelayedCounterUpdateButton().click(); - sleep(2000); - // Push is disabled, so text is not updated - Assert.assertEquals("Counter has been updated 1 times", - getCounterText()); - - getDirectCounterUpdateButton().click(); - // Direct update is visible, and includes previous update - Assert.assertEquals("Counter has been updated 3 times", - getCounterText()); - - // Re-enable push - getPushToggle().click(); - getDelayedCounterUpdateButton().click(); - sleep(2000); - - // Push is enabled again, so text gets updated - Assert.assertEquals("Counter has been updated 4 times", - getCounterText()); - } - - private WebElement getDirectCounterUpdateButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]"); - } - - private WebElement getPushToggle() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]"); - } - - private WebElement getDelayedCounterUpdateButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]"); - } - - private String getCounterText() { - return vaadinElement( - "/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]") - .getText(); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/TrackMessageSizeUI.java b/uitest/src/com/vaadin/tests/push/TrackMessageSizeUI.java deleted file mode 100644 index 182a2e67e4..0000000000 --- a/uitest/src/com/vaadin/tests/push/TrackMessageSizeUI.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import javax.servlet.ServletContext; - -import org.apache.commons.io.IOUtils; - -import com.vaadin.annotations.JavaScript; -import com.vaadin.server.VaadinRequest; -import com.vaadin.server.VaadinService; -import com.vaadin.server.VaadinServletService; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.JavaScriptFunction; - -import elemental.json.JsonArray; - -// Load vaadinPush.js so that jQueryVaadin is defined -@JavaScript("vaadin://vaadinPush.debug.js") -public class TrackMessageSizeUI extends AbstractTestUIWithLog { - - private String testMethod = "function testSequence(expected, data) {\n" - + " var request = {trackMessageLength: true, messageDelimiter: '|'};\n" - + " _request = {trackMessageLength: true, messageDelimiter: '|'};\n" - + " _handleProtocol = function(a,message) {return message;};" - + " var response = {partialMessage: ''};\n" - + " var messages = [];\n" - + " for(var i = 0; i < data.length; i++) {\n" - + " if (!_trackMessageSize(data[i], request, response))\n" - + " messages = messages.concat(response.messages);\n" - + " }\n" - + " if (JSON.stringify(expected) != JSON.stringify(messages)) {\n" - + " if (console && typeof console.error == 'function') console.error('Expected', expected, 'but got', messages, 'for', data);\n" - + " logToServer('Test failed, see javascript console for details.');\n" - + " }" + "}\n"; - - @Override - protected void setup(VaadinRequest request) { - String methodImplementation = findMethodImplementation(); - getPage().getJavaScript().addFunction("logToServer", - new JavaScriptFunction() { - @Override - public void call(JsonArray arguments) { - String message = arguments.getString(0); - log(message); - } - }); - - getPage().getJavaScript().execute( - methodImplementation + testMethod + buildTestCase()); - } - - private String buildTestCase() { - // Could maybe express the cases in java and generate JS? - return "testSequence(['a', 'b'], ['1|a1|b', '']);\n" - + "testSequence(['a', 'b'], ['1|a1|', 'b']);\n" - + "testSequence(['a', 'b'], ['1|a1', '|b']);\n" - + "testSequence(['a', 'b'], ['1|a', '1|b']);\n" - + "testSequence(['a', 'b'], ['1|a', '', '1|b']);\n" - + "testSequence(['a|', '|b'], ['2|a|2||b']);\n" - + "testSequence(['a|', 'b'], ['2|a|', '', '1|b']);\n" - + "testSequence(['a|', 'b'], ['2|a|', '1|b']);\n" - + "testSequence(['a|', 'b'], ['2|a|1', '|b']);\n" - + "testSequence(['a|', 'b'], ['2|a|1|', 'b']);\n" - + "testSequence([' ', 'b'], ['1| 1|b']);\n" - + "testSequence([' ', 'b'], ['1| ','1|b']);\n" - + "testSequence([' ', 'b'], ['1|',' 1|b']);\n" - + "logToServer('All tests run')\n"; - } - - private String findMethodImplementation() { - String filename = "/VAADIN/vaadinPush.debug.js"; - URL resourceURL = findResourceURL(filename, - (VaadinServletService) VaadinService.getCurrent()); - if (resourceURL == null) { - log("Can't find " + filename); - return null; - } - - try { - String string = IOUtils.toString(resourceURL); - - // Find the function inside the script content - int startIndex = string.indexOf("function _trackMessageSize"); - if (startIndex == -1) { - log("function not found"); - return null; - } - - // Assumes there's a /** comment before the next function - int endIndex = string.indexOf("/**", startIndex); - if (endIndex == -1) { - log("End of function not found"); - return null; - } - - string = string.substring(startIndex, endIndex); - string = string.replaceAll("jQuery", "jQueryVaadin"); - return string; - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - private URL findResourceURL(String filename, VaadinServletService service) { - ServletContext sc = service.getServlet().getServletContext(); - URL resourceUrl; - try { - resourceUrl = sc.getResource(filename); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - if (resourceUrl == null) { - // try if requested file is found from classloader - - // strip leading "/" otherwise stream from JAR wont work - if (filename.startsWith("/")) { - filename = filename.substring(1); - } - - resourceUrl = service.getClassLoader().getResource(filename); - } - return resourceUrl; - } - - @Override - protected String getTestDescription() { - return "Unit tests for _trackMessageSize in vaadinPush.debug.js. Implemented with testbench and a full Vaadin server side since the testing requires some file mangling."; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(12468); - } - -} diff --git a/uitest/src/com/vaadin/tests/push/TrackMessageSizeUITest.java b/uitest/src/com/vaadin/tests/push/TrackMessageSizeUITest.java deleted file mode 100644 index 35d0f0ad5f..0000000000 --- a/uitest/src/com/vaadin/tests/push/TrackMessageSizeUITest.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.push; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.testbench.parallel.TestCategory; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@TestCategory("push") -public class TrackMessageSizeUITest extends MultiBrowserTest { - @Test - public void runTests() { - openTestURL(); - Assert.assertEquals("1. All tests run", vaadinElementById("Log_row_0") - .getText()); - } -} diff --git a/uitest/src/com/vaadin/tests/push/require.min.js b/uitest/src/com/vaadin/tests/push/require.min.js deleted file mode 100644 index d9eb623f4f..0000000000 --- a/uitest/src/com/vaadin/tests/push/require.min.js +++ /dev/null @@ -1 +0,0 @@ -var requirejs,require,define;(function(global){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.1.20",commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,ap=Array.prototype,isBrowser=!!(typeof window!=="undefined"&&typeof navigator!=="undefined"&&window.document),isWebWorker=!isBrowser&&typeof importScripts!=="undefined",readyRegExp=isBrowser&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera=typeof opera!=="undefined"&&opera.toString()==="[object Opera]",contexts={},cfg={},globalDefQueue=[],useInteractive=false;function isFunction(it){return ostring.call(it)==="[object Function]"}function isArray(it){return ostring.call(it)==="[object Array]"}function each(ary,func){if(ary){var i;for(i=0;i<ary.length;i+=1){if(ary[i]&&func(ary[i],i,ary)){break}}}}function eachReverse(ary,func){if(ary){var i;for(i=ary.length-1;i>-1;i-=1){if(ary[i]&&func(ary[i],i,ary)){break}}}}function hasProp(obj,prop){return hasOwn.call(obj,prop)}function getOwn(obj,prop){return hasProp(obj,prop)&&obj[prop]}function eachProp(obj,func){var prop;for(prop in obj){if(hasProp(obj,prop)){if(func(obj[prop],prop)){break}}}}function mixin(target,source,force,deepStringMixin){if(source){eachProp(source,function(value,prop){if(force||!hasProp(target,prop)){if(deepStringMixin&&typeof value==="object"&&value&&!isArray(value)&&!isFunction(value)&&!(value instanceof RegExp)){if(!target[prop]){target[prop]={}}mixin(target[prop],value,force,deepStringMixin)}else{target[prop]=value}}})}return target}function bind(obj,fn){return function(){return fn.apply(obj,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(err){throw err}function getGlobal(value){if(!value){return value}var g=global;each(value.split("."),function(part){g=g[part]});return g}function makeError(id,msg,err,requireModules){var e=new Error(msg+"\nhttp://requirejs.org/docs/errors.html#"+id);e.requireType=id;e.requireModules=requireModules;if(err){e.originalError=err}return e}if(typeof define!=="undefined"){return}if(typeof requirejs!=="undefined"){if(isFunction(requirejs)){return}cfg=requirejs;requirejs=undefined}if(typeof require!=="undefined"&&!isFunction(require)){cfg=require;require=undefined}function newContext(contextName){var inCheckLoaded,Module,context,handlers,checkLoadedTimeoutId,config={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},registry={},enabledRegistry={},undefEvents={},defQueue=[],defined={},urlFetched={},bundlesMap={},requireCounter=1,unnormalizedCounter=1;function trimDots(ary){var i,part;for(i=0;i<ary.length;i++){part=ary[i];if(part==="."){ary.splice(i,1);i-=1}else{if(part===".."){if(i===0||(i===1&&ary[2]==="..")||ary[i-1]===".."){continue}else{if(i>0){ary.splice(i-1,2);i-=2}}}}}}function normalize(name,baseName,applyMap){var pkgMain,mapValue,nameParts,i,j,nameSegment,lastIndex,foundMap,foundI,foundStarMap,starI,normalizedBaseParts,baseParts=(baseName&&baseName.split("/")),map=config.map,starMap=map&&map["*"];if(name){name=name.split("/");lastIndex=name.length-1;if(config.nodeIdCompat&&jsSuffixRegExp.test(name[lastIndex])){name[lastIndex]=name[lastIndex].replace(jsSuffixRegExp,"")}if(name[0].charAt(0)==="."&&baseParts){normalizedBaseParts=baseParts.slice(0,baseParts.length-1);name=normalizedBaseParts.concat(name)}trimDots(name);name=name.join("/")}if(applyMap&&map&&(baseParts||starMap)){nameParts=name.split("/");outerLoop:for(i=nameParts.length;i>0;i-=1){nameSegment=nameParts.slice(0,i).join("/");if(baseParts){for(j=baseParts.length;j>0;j-=1){mapValue=getOwn(map,baseParts.slice(0,j).join("/"));if(mapValue){mapValue=getOwn(mapValue,nameSegment);if(mapValue){foundMap=mapValue;foundI=i;break outerLoop}}}}if(!foundStarMap&&starMap&&getOwn(starMap,nameSegment)){foundStarMap=getOwn(starMap,nameSegment);starI=i}}if(!foundMap&&foundStarMap){foundMap=foundStarMap;foundI=starI}if(foundMap){nameParts.splice(0,foundI,foundMap);name=nameParts.join("/")}}pkgMain=getOwn(config.pkgs,name);return pkgMain?pkgMain:name}function removeScript(name){if(isBrowser){each(scripts(),function(scriptNode){if(scriptNode.getAttribute("data-requiremodule")===name&&scriptNode.getAttribute("data-requirecontext")===context.contextName){scriptNode.parentNode.removeChild(scriptNode);return true}})}}function hasPathFallback(id){var pathConfig=getOwn(config.paths,id);if(pathConfig&&isArray(pathConfig)&&pathConfig.length>1){pathConfig.shift();context.require.undef(id);context.makeRequire(null,{skipMap:true})([id]);return true}}function splitPrefix(name){var prefix,index=name?name.indexOf("!"):-1;if(index>-1){prefix=name.substring(0,index);name=name.substring(index+1,name.length)}return[prefix,name]}function makeModuleMap(name,parentModuleMap,isNormalized,applyMap){var url,pluginModule,suffix,nameParts,prefix=null,parentName=parentModuleMap?parentModuleMap.name:null,originalName=name,isDefine=true,normalizedName="";if(!name){isDefine=false;name="_@r"+(requireCounter+=1)}nameParts=splitPrefix(name);prefix=nameParts[0];name=nameParts[1];if(prefix){prefix=normalize(prefix,parentName,applyMap);pluginModule=getOwn(defined,prefix)}if(name){if(prefix){if(pluginModule&&pluginModule.normalize){normalizedName=pluginModule.normalize(name,function(name){return normalize(name,parentName,applyMap)})}else{normalizedName=name.indexOf("!")===-1?normalize(name,parentName,applyMap):name}}else{normalizedName=normalize(name,parentName,applyMap);nameParts=splitPrefix(normalizedName);prefix=nameParts[0];normalizedName=nameParts[1];isNormalized=true;url=context.nameToUrl(normalizedName)}}suffix=prefix&&!pluginModule&&!isNormalized?"_unnormalized"+(unnormalizedCounter+=1):"";return{prefix:prefix,name:normalizedName,parentMap:parentModuleMap,unnormalized:!!suffix,url:url,originalName:originalName,isDefine:isDefine,id:(prefix?prefix+"!"+normalizedName:normalizedName)+suffix}}function getModule(depMap){var id=depMap.id,mod=getOwn(registry,id);if(!mod){mod=registry[id]=new context.Module(depMap)}return mod}function on(depMap,name,fn){var id=depMap.id,mod=getOwn(registry,id);if(hasProp(defined,id)&&(!mod||mod.defineEmitComplete)){if(name==="defined"){fn(defined[id])}}else{mod=getModule(depMap);if(mod.error&&name==="error"){fn(mod.error)}else{mod.on(name,fn)}}}function onError(err,errback){var ids=err.requireModules,notified=false;if(errback){errback(err)}else{each(ids,function(id){var mod=getOwn(registry,id);if(mod){mod.error=err;if(mod.events.error){notified=true;mod.emit("error",err)}}});if(!notified){req.onError(err)}}}function takeGlobalQueue(){if(globalDefQueue.length){each(globalDefQueue,function(queueItem){var id=queueItem[0];if(typeof id==="string"){context.defQueueMap[id]=true}defQueue.push(queueItem)});globalDefQueue=[]}}handlers={require:function(mod){if(mod.require){return mod.require}else{return(mod.require=context.makeRequire(mod.map))}},exports:function(mod){mod.usingExports=true;if(mod.map.isDefine){if(mod.exports){return(defined[mod.map.id]=mod.exports)}else{return(mod.exports=defined[mod.map.id]={})}}},module:function(mod){if(mod.module){return mod.module}else{return(mod.module={id:mod.map.id,uri:mod.map.url,config:function(){return getOwn(config.config,mod.map.id)||{}},exports:mod.exports||(mod.exports={})})}}};function cleanRegistry(id){delete registry[id];delete enabledRegistry[id]}function breakCycle(mod,traced,processed){var id=mod.map.id;if(mod.error){mod.emit("error",mod.error)}else{traced[id]=true;each(mod.depMaps,function(depMap,i){var depId=depMap.id,dep=getOwn(registry,depId);if(dep&&!mod.depMatched[i]&&!processed[depId]){if(getOwn(traced,depId)){mod.defineDep(i,defined[depId]);mod.check()}else{breakCycle(dep,traced,processed)}}});processed[id]=true}}function checkLoaded(){var err,usingPathFallback,waitInterval=config.waitSeconds*1000,expired=waitInterval&&(context.startTime+waitInterval)<new Date().getTime(),noLoads=[],reqCalls=[],stillLoading=false,needCycleCheck=true;if(inCheckLoaded){return}inCheckLoaded=true;eachProp(enabledRegistry,function(mod){var map=mod.map,modId=map.id;if(!mod.enabled){return}if(!map.isDefine){reqCalls.push(mod)}if(!mod.error){if(!mod.inited&&expired){if(hasPathFallback(modId)){usingPathFallback=true;stillLoading=true}else{noLoads.push(modId);removeScript(modId)}}else{if(!mod.inited&&mod.fetched&&map.isDefine){stillLoading=true;if(!map.prefix){return(needCycleCheck=false)}}}}});if(expired&&noLoads.length){err=makeError("timeout","Load timeout for modules: "+noLoads,null,noLoads);err.contextName=context.contextName;return onError(err)}if(needCycleCheck){each(reqCalls,function(mod){breakCycle(mod,{},{})})}if((!expired||usingPathFallback)&&stillLoading){if((isBrowser||isWebWorker)&&!checkLoadedTimeoutId){checkLoadedTimeoutId=setTimeout(function(){checkLoadedTimeoutId=0;checkLoaded()},50)}}inCheckLoaded=false}Module=function(map){this.events=getOwn(undefEvents,map.id)||{};this.map=map;this.shim=getOwn(config.shim,map.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};Module.prototype={init:function(depMaps,factory,errback,options){options=options||{};if(this.inited){return}this.factory=factory;if(errback){this.on("error",errback)}else{if(this.events.error){errback=bind(this,function(err){this.emit("error",err)})}}this.depMaps=depMaps&&depMaps.slice(0);this.errback=errback;this.inited=true;this.ignore=options.ignore;if(options.enabled||this.enabled){this.enable()}else{this.check()}},defineDep:function(i,depExports){if(!this.depMatched[i]){this.depMatched[i]=true;this.depCount-=1;this.depExports[i]=depExports}},fetch:function(){if(this.fetched){return}this.fetched=true;context.startTime=(new Date()).getTime();var map=this.map;if(this.shim){context.makeRequire(this.map,{enableBuildCallback:true})(this.shim.deps||[],bind(this,function(){return map.prefix?this.callPlugin():this.load()}))}else{return map.prefix?this.callPlugin():this.load()}},load:function(){var url=this.map.url;if(!urlFetched[url]){urlFetched[url]=true;context.load(this.map.id,url)}},check:function(){if(!this.enabled||this.enabling){return}var err,cjsModule,id=this.map.id,depExports=this.depExports,exports=this.exports,factory=this.factory;if(!this.inited){if(!hasProp(context.defQueueMap,id)){this.fetch()}}else{if(this.error){this.emit("error",this.error)}else{if(!this.defining){this.defining=true;if(this.depCount<1&&!this.defined){if(isFunction(factory)){if((this.events.error&&this.map.isDefine)||req.onError!==defaultOnError){try{exports=context.execCb(id,factory,depExports,exports)}catch(e){err=e}}else{exports=context.execCb(id,factory,depExports,exports)}if(this.map.isDefine&&exports===undefined){cjsModule=this.module;if(cjsModule){exports=cjsModule.exports}else{if(this.usingExports){exports=this.exports}}}if(err){err.requireMap=this.map;err.requireModules=this.map.isDefine?[this.map.id]:null;err.requireType=this.map.isDefine?"define":"require";return onError((this.error=err))}}else{exports=factory}this.exports=exports;if(this.map.isDefine&&!this.ignore){defined[id]=exports;if(req.onResourceLoad){req.onResourceLoad(context,this.map,this.depMaps)}}cleanRegistry(id);this.defined=true}this.defining=false;if(this.defined&&!this.defineEmitted){this.defineEmitted=true;this.emit("defined",this.exports);this.defineEmitComplete=true}}}}},callPlugin:function(){var map=this.map,id=map.id,pluginMap=makeModuleMap(map.prefix);this.depMaps.push(pluginMap);on(pluginMap,"defined",bind(this,function(plugin){var load,normalizedMap,normalizedMod,bundleId=getOwn(bundlesMap,this.map.id),name=this.map.name,parentName=this.map.parentMap?this.map.parentMap.name:null,localRequire=context.makeRequire(map.parentMap,{enableBuildCallback:true});if(this.map.unnormalized){if(plugin.normalize){name=plugin.normalize(name,function(name){return normalize(name,parentName,true)})||""}normalizedMap=makeModuleMap(map.prefix+"!"+name,this.map.parentMap);on(normalizedMap,"defined",bind(this,function(value){this.init([],function(){return value},null,{enabled:true,ignore:true})}));normalizedMod=getOwn(registry,normalizedMap.id);if(normalizedMod){this.depMaps.push(normalizedMap);if(this.events.error){normalizedMod.on("error",bind(this,function(err){this.emit("error",err)}))}normalizedMod.enable()}return}if(bundleId){this.map.url=context.nameToUrl(bundleId);this.load();return}load=bind(this,function(value){this.init([],function(){return value},null,{enabled:true})});load.error=bind(this,function(err){this.inited=true;this.error=err;err.requireModules=[id];eachProp(registry,function(mod){if(mod.map.id.indexOf(id+"_unnormalized")===0){cleanRegistry(mod.map.id)}});onError(err)});load.fromText=bind(this,function(text,textAlt){var moduleName=map.name,moduleMap=makeModuleMap(moduleName),hasInteractive=useInteractive;if(textAlt){text=textAlt}if(hasInteractive){useInteractive=false}getModule(moduleMap);if(hasProp(config.config,id)){config.config[moduleName]=config.config[id]}try{req.exec(text)}catch(e){return onError(makeError("fromtexteval","fromText eval for "+id+" failed: "+e,e,[id]))}if(hasInteractive){useInteractive=true}this.depMaps.push(moduleMap);context.completeLoad(moduleName);localRequire([moduleName],load)});plugin.load(map.name,localRequire,load,config)}));context.enable(pluginMap,this);this.pluginMaps[pluginMap.id]=pluginMap},enable:function(){enabledRegistry[this.map.id]=this;this.enabled=true;this.enabling=true;each(this.depMaps,bind(this,function(depMap,i){var id,mod,handler;if(typeof depMap==="string"){depMap=makeModuleMap(depMap,(this.map.isDefine?this.map:this.map.parentMap),false,!this.skipMap);this.depMaps[i]=depMap;handler=getOwn(handlers,depMap.id);if(handler){this.depExports[i]=handler(this);return}this.depCount+=1;on(depMap,"defined",bind(this,function(depExports){if(this.undefed){return}this.defineDep(i,depExports);this.check()}));if(this.errback){on(depMap,"error",bind(this,this.errback))}else{if(this.events.error){on(depMap,"error",bind(this,function(err){this.emit("error",err)}))}}}id=depMap.id;mod=registry[id];if(!hasProp(handlers,id)&&mod&&!mod.enabled){context.enable(depMap,this)}}));eachProp(this.pluginMaps,bind(this,function(pluginMap){var mod=getOwn(registry,pluginMap.id);if(mod&&!mod.enabled){context.enable(pluginMap,this)}}));this.enabling=false;this.check()},on:function(name,cb){var cbs=this.events[name];if(!cbs){cbs=this.events[name]=[]}cbs.push(cb)},emit:function(name,evt){each(this.events[name],function(cb){cb(evt)});if(name==="error"){delete this.events[name]}}};function callGetModule(args){if(!hasProp(defined,args[0])){getModule(makeModuleMap(args[0],null,true)).init(args[1],args[2])}}function removeListener(node,func,name,ieName){if(node.detachEvent&&!isOpera){if(ieName){node.detachEvent(ieName,func)}}else{node.removeEventListener(name,func,false)}}function getScriptData(evt){var node=evt.currentTarget||evt.srcElement;removeListener(node,context.onScriptLoad,"load","onreadystatechange");removeListener(node,context.onScriptError,"error");return{node:node,id:node&&node.getAttribute("data-requiremodule")}}function intakeDefines(){var args;takeGlobalQueue();while(defQueue.length){args=defQueue.shift();if(args[0]===null){return onError(makeError("mismatch","Mismatched anonymous define() module: "+args[args.length-1]))}else{callGetModule(args)}}context.defQueueMap={}}context={config:config,contextName:contextName,registry:registry,defined:defined,urlFetched:urlFetched,defQueue:defQueue,defQueueMap:{},Module:Module,makeModuleMap:makeModuleMap,nextTick:req.nextTick,onError:onError,configure:function(cfg){if(cfg.baseUrl){if(cfg.baseUrl.charAt(cfg.baseUrl.length-1)!=="/"){cfg.baseUrl+="/"}}var shim=config.shim,objs={paths:true,bundles:true,config:true,map:true};eachProp(cfg,function(value,prop){if(objs[prop]){if(!config[prop]){config[prop]={}}mixin(config[prop],value,true,true)}else{config[prop]=value}});if(cfg.bundles){eachProp(cfg.bundles,function(value,prop){each(value,function(v){if(v!==prop){bundlesMap[v]=prop}})})}if(cfg.shim){eachProp(cfg.shim,function(value,id){if(isArray(value)){value={deps:value}}if((value.exports||value.init)&&!value.exportsFn){value.exportsFn=context.makeShimExports(value)}shim[id]=value});config.shim=shim}if(cfg.packages){each(cfg.packages,function(pkgObj){var location,name;pkgObj=typeof pkgObj==="string"?{name:pkgObj}:pkgObj;name=pkgObj.name;location=pkgObj.location;if(location){config.paths[name]=pkgObj.location}config.pkgs[name]=pkgObj.name+"/"+(pkgObj.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")})}eachProp(registry,function(mod,id){if(!mod.inited&&!mod.map.unnormalized){mod.map=makeModuleMap(id,null,true)}});if(cfg.deps||cfg.callback){context.require(cfg.deps||[],cfg.callback)}},makeShimExports:function(value){function fn(){var ret;if(value.init){ret=value.init.apply(global,arguments)}return ret||(value.exports&&getGlobal(value.exports))}return fn},makeRequire:function(relMap,options){options=options||{};function localRequire(deps,callback,errback){var id,map,requireMod;if(options.enableBuildCallback&&callback&&isFunction(callback)){callback.__requireJsBuild=true}if(typeof deps==="string"){if(isFunction(callback)){return onError(makeError("requireargs","Invalid require call"),errback)}if(relMap&&hasProp(handlers,deps)){return handlers[deps](registry[relMap.id])}if(req.get){return req.get(context,deps,relMap,localRequire)}map=makeModuleMap(deps,relMap,false,true);id=map.id;if(!hasProp(defined,id)){return onError(makeError("notloaded",'Module name "'+id+'" has not been loaded yet for context: '+contextName+(relMap?"":". Use require([])")))}return defined[id]}intakeDefines();context.nextTick(function(){intakeDefines();requireMod=getModule(makeModuleMap(null,relMap));requireMod.skipMap=options.skipMap;requireMod.init(deps,callback,errback,{enabled:true});checkLoaded()});return localRequire}mixin(localRequire,{isBrowser:isBrowser,toUrl:function(moduleNamePlusExt){var ext,index=moduleNamePlusExt.lastIndexOf("."),segment=moduleNamePlusExt.split("/")[0],isRelative=segment==="."||segment==="..";if(index!==-1&&(!isRelative||index>1)){ext=moduleNamePlusExt.substring(index,moduleNamePlusExt.length);moduleNamePlusExt=moduleNamePlusExt.substring(0,index)}return context.nameToUrl(normalize(moduleNamePlusExt,relMap&&relMap.id,true),ext,true)},defined:function(id){return hasProp(defined,makeModuleMap(id,relMap,false,true).id)},specified:function(id){id=makeModuleMap(id,relMap,false,true).id;return hasProp(defined,id)||hasProp(registry,id)}});if(!relMap){localRequire.undef=function(id){takeGlobalQueue();var map=makeModuleMap(id,relMap,true),mod=getOwn(registry,id);mod.undefed=true;removeScript(id);delete defined[id];delete urlFetched[map.url];delete undefEvents[id];eachReverse(defQueue,function(args,i){if(args[0]===id){defQueue.splice(i,1)}});delete context.defQueueMap[id];if(mod){if(mod.events.defined){undefEvents[id]=mod.events}cleanRegistry(id)}}}return localRequire},enable:function(depMap){var mod=getOwn(registry,depMap.id);if(mod){getModule(depMap).enable()}},completeLoad:function(moduleName){var found,args,mod,shim=getOwn(config.shim,moduleName)||{},shExports=shim.exports;takeGlobalQueue();while(defQueue.length){args=defQueue.shift();if(args[0]===null){args[0]=moduleName;if(found){break}found=true}else{if(args[0]===moduleName){found=true}}callGetModule(args)}context.defQueueMap={};mod=getOwn(registry,moduleName);if(!found&&!hasProp(defined,moduleName)&&mod&&!mod.inited){if(config.enforceDefine&&(!shExports||!getGlobal(shExports))){if(hasPathFallback(moduleName)){return}else{return onError(makeError("nodefine","No define call for "+moduleName,null,[moduleName]))}}else{callGetModule([moduleName,(shim.deps||[]),shim.exportsFn])}}checkLoaded()},nameToUrl:function(moduleName,ext,skipExt){var paths,syms,i,parentModule,url,parentPath,bundleId,pkgMain=getOwn(config.pkgs,moduleName);if(pkgMain){moduleName=pkgMain}bundleId=getOwn(bundlesMap,moduleName);if(bundleId){return context.nameToUrl(bundleId,ext,skipExt)}if(req.jsExtRegExp.test(moduleName)){url=moduleName+(ext||"")}else{paths=config.paths;syms=moduleName.split("/");for(i=syms.length;i>0;i-=1){parentModule=syms.slice(0,i).join("/");parentPath=getOwn(paths,parentModule);if(parentPath){if(isArray(parentPath)){parentPath=parentPath[0]}syms.splice(0,i,parentPath);break}}url=syms.join("/");url+=(ext||(/^data\:|\?/.test(url)||skipExt?"":".js"));url=(url.charAt(0)==="/"||url.match(/^[\w\+\.\-]+:/)?"":config.baseUrl)+url}return config.urlArgs?url+((url.indexOf("?")===-1?"?":"&")+config.urlArgs):url},load:function(id,url){req.load(context,id,url)},execCb:function(name,callback,args,exports){return callback.apply(exports,args)},onScriptLoad:function(evt){if(evt.type==="load"||(readyRegExp.test((evt.currentTarget||evt.srcElement).readyState))){interactiveScript=null;var data=getScriptData(evt);context.completeLoad(data.id)}},onScriptError:function(evt){var data=getScriptData(evt);if(!hasPathFallback(data.id)){return onError(makeError("scripterror","Script error for: "+data.id,evt,[data.id]))}}};context.require=context.makeRequire();return context}req=requirejs=function(deps,callback,errback,optional){var context,config,contextName=defContextName;if(!isArray(deps)&&typeof deps!=="string"){config=deps;if(isArray(callback)){deps=callback;callback=errback;errback=optional}else{deps=[]}}if(config&&config.context){contextName=config.context}context=getOwn(contexts,contextName);if(!context){context=contexts[contextName]=req.s.newContext(contextName)}if(config){context.configure(config)}return context.require(deps,callback,errback)};req.config=function(config){return req(config)};req.nextTick=typeof setTimeout!=="undefined"?function(fn){setTimeout(fn,4)}:function(fn){fn()};if(!require){require=req}req.version=version;req.jsExtRegExp=/^\/|:|\?|\.js$/;req.isBrowser=isBrowser;s=req.s={contexts:contexts,newContext:newContext};req({});each(["toUrl","undef","defined","specified"],function(prop){req[prop]=function(){var ctx=contexts[defContextName];return ctx.require[prop].apply(ctx,arguments)}});if(isBrowser){head=s.head=document.getElementsByTagName("head")[0];baseElement=document.getElementsByTagName("base")[0];if(baseElement){head=s.head=baseElement.parentNode}}req.onError=defaultOnError;req.createNode=function(config,moduleName,url){var node=config.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");node.type=config.scriptType||"text/javascript";node.charset="utf-8";node.async=true;return node};req.load=function(context,moduleName,url){var config=(context&&context.config)||{},node;if(isBrowser){node=req.createNode(config,moduleName,url);if(config.onNodeCreated){config.onNodeCreated(node,config,moduleName,url)}node.setAttribute("data-requirecontext",context.contextName);node.setAttribute("data-requiremodule",moduleName);if(node.attachEvent&&!(node.attachEvent.toString&&node.attachEvent.toString().indexOf("[native code")<0)&&!isOpera){useInteractive=true;node.attachEvent("onreadystatechange",context.onScriptLoad)}else{node.addEventListener("load",context.onScriptLoad,false);node.addEventListener("error",context.onScriptError,false)}node.src=url;currentlyAddingScript=node;if(baseElement){head.insertBefore(node,baseElement)}else{head.appendChild(node)}currentlyAddingScript=null;return node}else{if(isWebWorker){try{importScripts(url);context.completeLoad(moduleName)}catch(e){context.onError(makeError("importscripts","importScripts failed for "+moduleName+" at "+url,e,[moduleName]))}}}};function getInteractiveScript(){if(interactiveScript&&interactiveScript.readyState==="interactive"){return interactiveScript}eachReverse(scripts(),function(script){if(script.readyState==="interactive"){return(interactiveScript=script)}});return interactiveScript}if(isBrowser&&!cfg.skipDataMain){eachReverse(scripts(),function(script){if(!head){head=script.parentNode}dataMain=script.getAttribute("data-main");if(dataMain){mainScript=dataMain;if(!cfg.baseUrl){src=mainScript.split("/");mainScript=src.pop();subPath=src.length?src.join("/")+"/":"./";cfg.baseUrl=subPath}mainScript=mainScript.replace(jsSuffixRegExp,"");if(req.jsExtRegExp.test(mainScript)){mainScript=dataMain}cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript];return true}})}define=function(name,deps,callback){var node,context;if(typeof name!=="string"){callback=deps;deps=name;name=null}if(!isArray(deps)){callback=deps;deps=null}if(!deps&&isFunction(callback)){deps=[];if(callback.length){callback.toString().replace(commentRegExp,"").replace(cjsRequireRegExp,function(match,dep){deps.push(dep)});deps=(callback.length===1?["require"]:["require","exports","module"]).concat(deps)}}if(useInteractive){node=currentlyAddingScript||getInteractiveScript();if(node){if(!name){name=node.getAttribute("data-requiremodule")}context=contexts[node.getAttribute("data-requirecontext")]}}if(context){context.defQueue.push([name,deps,callback]);context.defQueueMap[name]=true}else{globalDefQueue.push([name,deps,callback])}};define.amd={jQuery:true};req.exec=function(text){return eval(text)};req(cfg)}(this));
\ No newline at end of file |