Skip to content

Commit

Permalink
fix: enable PushRouteWildcardParameterIT in OSGi (#9518)
Browse files Browse the repository at this point in the history
fixes #9459
  • Loading branch information
Denis authored Nov 30, 2020
1 parent 18ef55f commit f446526
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import com.vaadin.flow.component.PushConfiguration;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.page.Push;
import com.vaadin.flow.di.Lookup;
import com.vaadin.flow.osgi.OSGiMarker;
import com.vaadin.flow.router.BeforeEvent;
import com.vaadin.flow.router.HasUrlParameter;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.router.WildcardParameter;
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.routing.PushRouteWildcardParameterView")
public class PushRouteWildcardParameterView extends Div
implements HasUrlParameter<String> {
Expand All @@ -24,6 +28,19 @@ public class PushRouteWildcardParameterView extends Div
public static final String LABEL_ID = "label";
private final Span label = new Span();

public PushRouteWildcardParameterView() {
Lookup lookup = VaadinService.getCurrent().getContext()
.getAttribute(Lookup.class);
PushConfiguration pushConfiguration = UI.getCurrent()
.getPushConfiguration();
pushConfiguration.setPushMode(PushMode.AUTOMATIC);
if (lookup.lookup(OSGiMarker.class) == null) {
pushConfiguration.setTransport(Transport.WEBSOCKET_XHR);
} else {
pushConfiguration.setTransport(Transport.LONG_POLLING);
}
}

@Override
public void setParameter(BeforeEvent event,
@WildcardParameter String parameter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

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

0 comments on commit f446526

Please sign in to comment.