-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Denis
authored
Apr 8, 2020
1 parent
35e65c5
commit d81296e
Showing
5 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
vaadin-spring-tests/test-spring-boot-only-prepare/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
server.port=8888 | ||
vaadin.blacklisted-packages=vaadin-spring/target/test-classes | ||
vaadin.pnpm.enable=true |
53 changes: 53 additions & 0 deletions
53
...g-tests/test-spring-common/src/main/java/com/vaadin/flow/spring/test/PnpmEnabledView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* 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.spring.test; | ||
|
||
import java.io.File; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.core.env.Environment; | ||
|
||
import com.vaadin.flow.component.AttachEvent; | ||
import com.vaadin.flow.component.html.Div; | ||
import com.vaadin.flow.function.DeploymentConfiguration; | ||
import com.vaadin.flow.router.Route; | ||
import com.vaadin.flow.server.Constants; | ||
|
||
@Route("pnpm-enabled") | ||
public class PnpmEnabledView extends Div { | ||
|
||
@Autowired | ||
private Environment env; | ||
|
||
@Override | ||
protected void onAttach(AttachEvent attachEvent) { | ||
boolean isPnpm = new File("node_modules/.modules.yaml").exists(); | ||
String enableProperty = env.getProperty( | ||
"vaadin." + Constants.SERVLET_PARAMETER_ENABLE_PNPM); | ||
DeploymentConfiguration configuration = getUI().get().getSession() | ||
.getService().getDeploymentConfiguration(); | ||
Div checkPnpm = new Div(); | ||
checkPnpm.setId("check-pnpm"); | ||
checkPnpm.setText( | ||
String.valueOf(Boolean.TRUE.toString().equals(enableProperty) | ||
&& !configuration.isProductionMode())); | ||
Div pnpm = new Div(); | ||
pnpm.setId("pnpm"); | ||
pnpm.setText(String.valueOf(isPnpm)); | ||
|
||
add(checkPnpm, pnpm); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...ing-tests/test-spring-common/src/test/java/com/vaadin/flow/spring/test/PnpmEnabledIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* 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.spring.test; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Assume; | ||
import org.junit.Test; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebElement; | ||
|
||
public class PnpmEnabledIT extends AbstractSpringTest { | ||
|
||
@Override | ||
protected String getTestPath() { | ||
return "/pnpm-enabled"; | ||
} | ||
|
||
@Test | ||
public void checkPnpm() throws Exception { | ||
open(); | ||
|
||
WebElement checkPnpm = findElement(By.id("check-pnpm")); | ||
Assume.assumeTrue(Boolean.TRUE.toString().equals(checkPnpm.getText())); | ||
|
||
WebElement isPnpm = findElement(By.id("pnpm")); | ||
Assert.assertEquals(Boolean.TRUE.toString(), isPnpm.getText()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters