Skip to content

Commit 2539dc8

Browse files
author
Rob Tjalma
authored
Merge pull request #123 from com-pas/fix-native-reflection
Fix missing constructure/methodes in native image.
2 parents 234734f + 8a97d94 commit 2539dc8

File tree

5 files changed

+43
-12
lines changed

5 files changed

+43
-12
lines changed

app/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ SPDX-License-Identifier: Apache-2.0
161161
<quarkus.package.type>native</quarkus.package.type>
162162
<!-- Allows for creating a Linux executable without GraalVM being installed -->
163163
<quarkus.native.container-build>true</quarkus.native.container-build>
164-
<quarkus.native.additional-build-args>-H:ReflectionConfigurationFiles=reflection-config.json</quarkus.native.additional-build-args>
165164
</properties>
166165

167166
<build>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// SPDX-FileCopyrightText: 2021 Alliander N.V.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
package org.lfenergy.compas.scl.data.rest;
5+
6+
import io.quarkus.runtime.annotations.RegisterForReflection;
7+
8+
/**
9+
* Configure class for Quarkus Native Build to be included.
10+
*/
11+
@RegisterForReflection(
12+
targets = {
13+
org.lfenergy.compas.core.jaxrs.model.ErrorMessage.class,
14+
org.lfenergy.compas.core.jaxrs.model.ErrorResponse.class,
15+
org.lfenergy.compas.scl.data.model.SclMetaInfo.class,
16+
org.lfenergy.compas.scl.data.model.ObjectFactory.class
17+
})
18+
public class CompasReflectionConfiguration {
19+
}

app/src/main/resources/reflection-config.json

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-FileCopyrightText: 2021 Alliander N.V.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
package org.lfenergy.compas.scl.data.rest;
5+
6+
import org.junit.jupiter.api.Test;
7+
8+
import static org.junit.jupiter.api.Assertions.assertNotNull;
9+
10+
class CompasReflectionConfigurationTest {
11+
@Test
12+
void constructor_WhenCalled_ThenNoExceptions() {
13+
var config = new CompasReflectionConfiguration();
14+
assertNotNull(config);
15+
}
16+
}

app/src/test/java/org/lfenergy/compas/scl/data/rest/CompasSclDataServiceConfigurationTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,24 @@
88
import static org.junit.jupiter.api.Assertions.assertNotNull;
99

1010
class CompasSclDataServiceConfigurationTest {
11-
private CompasSclDataServiceConfiguration configuration = new CompasSclDataServiceConfiguration();
11+
@Test
12+
void constructor_WhenCalled_ThenNoExceptions() {
13+
var config = new CompasSclDataServiceConfiguration();
14+
assertNotNull(config);
15+
}
1216

1317
@Test
1418
void createElementConverter_WhenCalled_ThenObjectReturned() {
15-
assertNotNull(configuration.createElementConverter());
19+
assertNotNull(new CompasSclDataServiceConfiguration().createElementConverter());
1620
}
1721

1822
@Test
1923
void creatSclElementProcessor_WhenCalled_ThenObjectReturned() {
20-
assertNotNull(configuration.creatSclElementProcessor());
24+
assertNotNull(new CompasSclDataServiceConfiguration().creatSclElementProcessor());
2125
}
2226

2327
@Test
2428
void createSclDataModelMarshaller_WhenCalled_ThenObjectReturned() {
25-
assertNotNull(configuration.createSclDataModelMarshaller());
29+
assertNotNull(new CompasSclDataServiceConfiguration().createSclDataModelMarshaller());
2630
}
2731
}

0 commit comments

Comments
 (0)