Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mark tests that should not be executed in OSGi #9456

Merged
merged 5 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2000-2020 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.flow.testcategory;

/**
* Tests that should not be run inside OSGi container should be annotated with @
* {@code Category(IgnoreOSGi.class)} so they can be optionally excluded from
* the build.
*
* @author Vaadin Ltd
* @since 1.0
*
*/
public interface IgnoreOSGi extends TestCategory {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright 2000-2020 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.flow.osgi;

/**
* This interface is a marker of OSGi.
*
*/
public interface OSGiMarker {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2000-2020 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.flow.osgi;

import org.osgi.service.component.annotations.Component;

import com.vaadin.flow.di.Lookup;

/**
*
* Implementation of {@link OSGiMarker} : presence of {@link OSGiMarker} service
* in {@link Lookup} means the app is executed in OSGi env because standard
* Lookup doesn't know anything about {@link OSGiMarker}.
*/
@Component(immediate = true)
public class OSGiMarkerImpl implements OSGiMarker {

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@
*/
package com.vaadin.flow.uitest.ui.routing;

import com.vaadin.flow.component.PushConfiguration;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.page.Push;
import com.vaadin.flow.di.Lookup;
import com.vaadin.flow.osgi.OSGiMarker;
import com.vaadin.flow.router.BeforeEnterEvent;
import com.vaadin.flow.router.BeforeEnterObserver;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.router.RouterLayout;
import com.vaadin.flow.server.VaadinService;
import com.vaadin.flow.shared.communication.PushMode;
import com.vaadin.flow.shared.ui.Transport;

@Push
@Route("com.vaadin.flow.uitest.ui.PushLayout")
public class PushLayout extends Div
implements RouterLayout, BeforeEnterObserver {
Expand All @@ -31,6 +36,14 @@ public class PushLayout extends Div

public PushLayout() {
setId("push-layout");
Lookup lookup = VaadinService.getCurrent().getContext()
.getAttribute(Lookup.class);
if (lookup.lookup(OSGiMarker.class) == null) {
PushConfiguration pushConfiguration = UI.getCurrent()
.getPushConfiguration();
pushConfiguration.setPushMode(PushMode.AUTOMATIC);
pushConfiguration.setTransport(Transport.WEBSOCKET_XHR);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.vaadin.flow.component.html.testbench.DivElement;
import com.vaadin.flow.component.html.testbench.LabelElement;
import com.vaadin.flow.testcategory.IgnoreOSGi;
import com.vaadin.flow.testutil.ChromeBrowserTest;

@Category(IgnoreOSGi.class)
public class AttachExistingElementIT extends ChromeBrowserTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.By;

import com.vaadin.flow.testcategory.IgnoreOSGi;
import com.vaadin.flow.testutil.ChromeBrowserTest;

@Category(IgnoreOSGi.class)
public class BaseHrefIT extends ChromeBrowserTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.vaadin.flow.testcategory.IgnoreOSGi;
import com.vaadin.flow.testutil.ChromeBrowserTest;

@Category(IgnoreOSGi.class)
public class DynamicallyRegisteredRouteIT extends ChromeBrowserTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.vaadin.flow.testcategory.IgnoreOSGi;
import com.vaadin.flow.testutil.ChromeBrowserTest;

@Category(IgnoreOSGi.class)
public class LongPollingPushIT extends ChromeBrowserTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.By;

import com.vaadin.flow.testcategory.IgnoreOSGi;
import com.vaadin.flow.testutil.ChromeBrowserTest;

@Category(IgnoreOSGi.class)
public class PlainScriptViaJavaScriptIT extends ChromeBrowserTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.By;

import com.vaadin.flow.testcategory.IgnoreOSGi;
import com.vaadin.flow.testutil.ChromeBrowserTest;

@Category(IgnoreOSGi.class)
public class PushSettingsIT extends ChromeBrowserTest {
@Test
public void pushSetting() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@
*/
package com.vaadin.flow.uitest.ui;

import org.junit.experimental.categories.Category;

import com.vaadin.flow.testcategory.IgnoreOSGi;

/**
* The tests are in the superclass.
*/
@Category(IgnoreOSGi.class)
public class PushWSUpdateDivIT extends AbstractUpdateDivIT {

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.vaadin.flow.testcategory.IgnoreOSGi;
import com.vaadin.flow.testutil.ChromeBrowserTest;
import com.vaadin.testbench.TestBenchElement;

@Category(IgnoreOSGi.class)
public class PushWithPreserveOnRefreshIT extends ChromeBrowserTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.vaadin.flow.component.html.testbench.NativeButtonElement;
import com.vaadin.flow.testcategory.IgnoreOSGi;
import com.vaadin.flow.testutil.ChromeBrowserTest;
import com.vaadin.testbench.TestBenchElement;

@Category(IgnoreOSGi.class)
public class RedirectToPushIT extends ChromeBrowserTest {

@Test
Expand All @@ -31,7 +34,8 @@ public void pushIsSetAfterNavigation() {
$(NativeButtonElement.class).first().click();

// when running V15-Bootstrapping push must be configured in AppShell
// otherwise @Push annotation in routes are logged in startup but ignored.
// otherwise @Push annotation in routes are logged in startup but
// ignored.
String pushMode = Boolean.getBoolean(
"vaadin.useDeprecatedV14Bootstrapping") ? "AUTOMATIC"
: "DISABLED";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.vaadin.flow.testcategory.IgnoreOSGi;
import com.vaadin.flow.testutil.ChromeBrowserTest;

@Category(IgnoreOSGi.class)
public class RefreshCloseConnectionIT extends ChromeBrowserTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
package com.vaadin.flow.uitest.ui;

import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.vaadin.flow.testcategory.IgnoreOSGi;

@Category(IgnoreOSGi.class)
public class RouteNotFoundDevModeIT extends RouteNotFoundIT {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.vaadin.flow.testcategory.IgnoreOSGi;
import com.vaadin.flow.testutil.ChromeBrowserTest;

/**
* @author Vaadin Ltd
* @since 1.0
*
*/
@Category(IgnoreOSGi.class)
public class ServiceInitListenersIT extends ChromeBrowserTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.vaadin.flow.component.html.testbench.SelectElement;
import com.vaadin.flow.testcategory.IgnoreOSGi;
import com.vaadin.flow.testutil.ChromeBrowserTest;

@Category(IgnoreOSGi.class)
public class ViewTitleIT extends ChromeBrowserTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.By;

import com.vaadin.flow.testcategory.IgnoreOSGi;
import com.vaadin.flow.testutil.ChromeBrowserTest;
import com.vaadin.testbench.TestBenchElement;

@Category(IgnoreOSGi.class)
public class PushRouteNotFoundIT extends ChromeBrowserTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.vaadin.flow.testcategory.IgnoreOSGi;
import com.vaadin.flow.testutil.ChromeBrowserTest;

@Category(IgnoreOSGi.class)
public class PushRouteWildcardParameterIT extends ChromeBrowserTest {

// #8968: Push connection with parameter containing slashes
Expand Down