Skip to content

Commit 9ecf131

Browse files
authored
Merge pull request #13741 from gsmet/1.10.3-backports-2
1.10.3 backports 2
2 parents 7037d20 + 9fae0ce commit 9ecf131

File tree

5 files changed

+90
-2
lines changed

5 files changed

+90
-2
lines changed

core/deployment/src/main/java/io/quarkus/deployment/dev/HotDeploymentConfigFileBuildStep.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ ServiceStartBuildItem setupConfigFileHotDeployment(List<HotDeploymentWatchedFile
1717
if (processor != null) {
1818
Map<String, Boolean> watchedFilePaths = files.stream()
1919
.collect(Collectors.toMap(HotDeploymentWatchedFileBuildItem::getLocation,
20-
HotDeploymentWatchedFileBuildItem::isRestartNeeded));
20+
HotDeploymentWatchedFileBuildItem::isRestartNeeded,
21+
(isRestartNeeded1, isRestartNeeded2) -> isRestartNeeded1 || isRestartNeeded2));
2122
processor.setWatchedFilePaths(watchedFilePaths);
2223
}
2324
return null;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package io.quarkus.hibernate.orm.multiplepersistenceunits;
2+
3+
import static org.hamcrest.Matchers.is;
4+
5+
import java.util.function.Function;
6+
7+
import org.jboss.shrinkwrap.api.ShrinkWrap;
8+
import org.jboss.shrinkwrap.api.spec.JavaArchive;
9+
import org.junit.jupiter.api.Test;
10+
import org.junit.jupiter.api.extension.RegisterExtension;
11+
12+
import io.quarkus.hibernate.orm.multiplepersistenceunits.model.annotation.inventory.Plane;
13+
import io.quarkus.hibernate.orm.multiplepersistenceunits.model.annotation.shared.SharedEntity;
14+
import io.quarkus.hibernate.orm.multiplepersistenceunits.model.annotation.user.User;
15+
import io.quarkus.hibernate.orm.multiplepersistenceunits.model.annotation.user.subpackage.OtherUserInSubPackage;
16+
import io.quarkus.test.QuarkusDevModeTest;
17+
import io.restassured.RestAssured;
18+
19+
/**
20+
* See https://github.com/quarkusio/quarkus/issues/13722
21+
*/
22+
public class MultiplePersistenceUnitsImportSqlHotReloadScriptTest {
23+
@RegisterExtension
24+
final static QuarkusDevModeTest TEST = new QuarkusDevModeTest()
25+
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
26+
.addPackage(Plane.class.getPackage().getName())
27+
.addPackage(SharedEntity.class.getPackage().getName())
28+
.addPackage(User.class.getPackage().getName())
29+
.addPackage(OtherUserInSubPackage.class.getPackage().getName())
30+
.addClass(MultiplePersistenceUnitsSqlLoadScriptTestResource.class)
31+
.addAsResource("application-multiple-persistence-units-annotations.properties", "application.properties")
32+
.addAsResource("import-sharedentity.sql", "import.sql"));
33+
34+
@Test
35+
public void testImportSqlScriptHotReload() {
36+
String expectedName = "import.sql load script entity";
37+
assertBodyIs(expectedName);
38+
39+
String hotReloadExpectedName = "modified import.sql load script entity";
40+
TEST.modifyResourceFile("import.sql", new Function<String, String>() {
41+
@Override
42+
public String apply(String s) {
43+
return s.replace(expectedName, hotReloadExpectedName);
44+
}
45+
});
46+
assertBodyIs(hotReloadExpectedName);
47+
}
48+
49+
private void assertBodyIs(String expectedBody) {
50+
RestAssured.when().get("/multiple-persistence-units/orm-sql-load-script/2").then().body(is(expectedBody));
51+
}
52+
53+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package io.quarkus.hibernate.orm.multiplepersistenceunits;
2+
3+
import javax.inject.Inject;
4+
import javax.persistence.EntityManager;
5+
import javax.ws.rs.GET;
6+
import javax.ws.rs.Path;
7+
import javax.ws.rs.PathParam;
8+
import javax.ws.rs.Produces;
9+
import javax.ws.rs.core.MediaType;
10+
11+
import io.quarkus.hibernate.orm.multiplepersistenceunits.model.annotation.shared.SharedEntity;
12+
13+
@Path("/multiple-persistence-units/orm-sql-load-script")
14+
public class MultiplePersistenceUnitsSqlLoadScriptTestResource {
15+
16+
public static final String NO_ENTITY_MESSAGE = "no entity";
17+
18+
@Inject
19+
EntityManager em;
20+
21+
@GET
22+
@Path("/{id}")
23+
@Produces(MediaType.TEXT_PLAIN)
24+
public String getName(@PathParam("id") long id) {
25+
SharedEntity entity = em.find(SharedEntity.class, id);
26+
if (entity != null) {
27+
return entity.getName();
28+
}
29+
30+
return NO_ENTITY_MESSAGE;
31+
}
32+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
INSERT INTO SharedEntity(id, name) VALUES(1, 'default sql load script entity');
2+
INSERT INTO SharedEntity(id, name) VALUES(2, 'import.sql load script entity');

test-framework/junit5/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<groupId>com.thoughtworks.xstream</groupId>
5050
<artifactId>xstream</artifactId>
5151
<!-- Avoid adding this to the BOM -->
52-
<version>1.4.13</version>
52+
<version>1.4.14</version>
5353
</dependency>
5454
</dependencies>
5555

0 commit comments

Comments
 (0)