Skip to content

Commit a5038c4

Browse files
Uses java-11 in naked objects
1 parent b0ac4c1 commit a5038c4

File tree

17 files changed

+84
-132
lines changed

17 files changed

+84
-132
lines changed

naked-objects/dom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
</goals>
128128
</pluginExecutionFilter>
129129
<action>
130-
<ignore></ignore>
130+
<ignore/>
131131
</action>
132132
</pluginExecution>
133133
</pluginExecutions>

naked-objects/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.layout.json

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
/**
2-
* Licensed to the Apache Software Foundation (ASF) under one or more
3-
* contributor license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright ownership.
5-
* The ASF licenses this file to You under the Apache License, Version 2.0
6-
* (the "License"); you may not use this file except in compliance with
7-
* the License. You may obtain a copy of the License at
8-
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
16-
*/
171
{
182
"columns": [
193
{

naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
strategy = javax.jdo.annotations.IdGeneratorStrategy.IDENTITY, column = "id")
5151
@javax.jdo.annotations.Version(strategy = VersionStrategy.VERSION_NUMBER, column = "version")
5252
@javax.jdo.annotations.Queries({
53-
@javax.jdo.annotations.Query(name = "find", language = "JDOQL", value = "SELECT "
53+
@javax.jdo.annotations.Query(name = "find", value = "SELECT "
5454
+ "FROM domainapp.dom.modules.simple.SimpleObject "),
55-
@javax.jdo.annotations.Query(name = "findByName", language = "JDOQL", value = "SELECT "
55+
@javax.jdo.annotations.Query(name = "findByName", value = "SELECT "
5656
+ "FROM domainapp.dom.modules.simple.SimpleObject " + "WHERE name.indexOf(:name) >= 0 ")})
5757
@javax.jdo.annotations.Unique(name = "SimpleObject_name_UNQ", members = {"name"})
5858
@DomainObject

naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.layout.json

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
/**
2-
* Licensed to the Apache Software Foundation (ASF) under one or more
3-
* contributor license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright ownership.
5-
* The ASF licenses this file to You under the Apache License, Version 2.0
6-
* (the "License"); you may not use this file except in compliance with
7-
* the License. You may obtain a copy of the License at
8-
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
16-
*/
171
{
182
"columns": [
193
{

naked-objects/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public class SimpleObjectTest {
3737
SimpleObject simpleObject;
3838

3939
@Before
40-
public void setUp() throws Exception {
40+
public void setUp() {
4141
simpleObject = new SimpleObject();
4242
}
4343

4444
@Test
45-
public void testName() throws Exception {
45+
public void testName() {
4646
// given
4747
String name = "Foobar";
4848
assertNull(simpleObject.getName());

naked-objects/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectsTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ public class SimpleObjectsTest {
5252
SimpleObjects simpleObjects;
5353

5454
@Before
55-
public void setUp() throws Exception {
55+
public void setUp() {
5656
simpleObjects = new SimpleObjects();
5757
simpleObjects.container = mockContainer;
5858
}
5959

6060
@Test
61-
public void testCreate() throws Exception {
61+
public void testCreate() {
6262

6363
// given
6464
final SimpleObject simpleObject = new SimpleObject();
@@ -85,7 +85,7 @@ public void testCreate() throws Exception {
8585
}
8686

8787
@Test
88-
public void testListAll() throws Exception {
88+
public void testListAll() {
8989

9090
// given
9191
final List<SimpleObject> all = Lists.newArrayList();

naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ public SimpleObject getSimpleObject() {
6767

6868
@Override
6969
protected void execute(final ExecutionContext ec) {
70-
71-
String paramName = checkParam("name", ec, String.class);
70+
var paramName = checkParam("name", ec, String.class);
7271

7372
this.simpleObject = wrap(simpleObjects).create(paramName);
7473

naked-objects/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import domainapp.dom.modules.simple.SimpleObject;
2828
import domainapp.fixture.modules.simple.SimpleObjectCreate;
2929
import domainapp.fixture.modules.simple.SimpleObjectsTearDown;
30-
import java.util.Collections;
3130
import java.util.List;
3231
import org.apache.isis.applib.fixturescripts.FixtureScript;
3332

@@ -37,8 +36,18 @@
3736
*/
3837
public class RecreateSimpleObjects extends FixtureScript {
3938

40-
public final List<String> names = Collections.unmodifiableList(List.of("Foo", "Bar", "Baz",
41-
"Frodo", "Froyo", "Fizz", "Bip", "Bop", "Bang", "Boo"));
39+
public final List<String> names = List.of(
40+
"Foo",
41+
"Bar",
42+
"Baz",
43+
"Frodo",
44+
"Froyo",
45+
"Fizz",
46+
"Bip",
47+
"Bop",
48+
"Bang",
49+
"Boo"
50+
);
4251

4352
// region > number (optional input)
4453
private Integer number;
@@ -77,7 +86,7 @@ public List<SimpleObject> getSimpleObjects() {
7786
protected void execute(final ExecutionContext ec) {
7887

7988
// defaults
80-
final int paramNumber = defaultParam("number", ec, 3);
89+
final var paramNumber = defaultParam("number", ec, 3);
8190

8291
// validate
8392
if (paramNumber < 0 || paramNumber > names.size()) {
@@ -90,8 +99,8 @@ protected void execute(final ExecutionContext ec) {
9099
//
91100
ec.executeChild(this, new SimpleObjectsTearDown());
92101

93-
for (int i = 0; i < paramNumber; i++) {
94-
final SimpleObjectCreate fs = new SimpleObjectCreate().setName(names.get(i));
102+
for (var i = 0; i < paramNumber; i++) {
103+
final var fs = new SimpleObjectCreate().setName(names.get(i));
95104
ec.executeChild(this, fs.getName(), fs);
96105
simpleObjects.add(fs.getSimpleObject());
97106
}

naked-objects/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import org.apache.isis.core.commons.config.IsisConfiguration;
2727
import org.apache.isis.core.integtestsupport.IsisSystemForTest;
28-
import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
2928
import org.apache.isis.objectstore.jdo.datanucleus.IsisConfigurationForJdoIntegTests;
3029

3130
/**
@@ -40,7 +39,7 @@ private SimpleAppSystemInitializer() {
4039
* Init test system
4140
*/
4241
public static void initIsft() {
43-
IsisSystemForTest isft = IsisSystemForTest.getElseNull();
42+
var isft = IsisSystemForTest.getElseNull();
4443
if (isft == null) {
4544
isft = new SimpleAppSystemBuilder().build().setUpSystem();
4645
IsisSystemForTest.set(isft);
@@ -51,15 +50,13 @@ private static class SimpleAppSystemBuilder extends IsisSystemForTest.Builder {
5150

5251
public SimpleAppSystemBuilder() {
5352
with(testConfiguration());
54-
with(new DataNucleusPersistenceMechanismInstaller());
5553

5654
// services annotated with @DomainService
5755
withServicesIn("domainapp");
5856
}
5957

6058
private static IsisConfiguration testConfiguration() {
61-
final IsisConfigurationForJdoIntegTests testConfiguration =
62-
new IsisConfigurationForJdoIntegTests();
59+
final var testConfiguration = new IsisConfigurationForJdoIntegTests();
6360

6461
testConfiguration.addRegisterEntitiesPackagePrefix("domainapp.dom.modules");
6562
return testConfiguration;

naked-objects/integtests/src/test/java/domainapp/integtests/specglue/CatalogOfFixturesGlue.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,17 @@
2323

2424
package domainapp.integtests.specglue;
2525

26-
import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
27-
2826
import cucumber.api.java.Before;
2927
import domainapp.fixture.scenarios.RecreateSimpleObjects;
28+
import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
3029

3130
/**
3231
* Test Execution to append a fixture of SimpleObjects
3332
*/
3433
public class CatalogOfFixturesGlue extends CukeGlueAbstract {
3534

3635
@Before(value = {"@integration", "@SimpleObjectsFixture"}, order = 20000)
37-
public void integrationFixtures() throws Throwable {
36+
public void integrationFixtures() {
3837
scenarioExecution().install(new RecreateSimpleObjects());
3938
}
4039
}

naked-objects/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828

2929
import cucumber.api.java.en.Given;
3030
import cucumber.api.java.en.When;
31-
import domainapp.dom.modules.simple.SimpleObject;
3231
import domainapp.dom.modules.simple.SimpleObjects;
33-
import java.util.List;
3432
import java.util.UUID;
3533
import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
3634

@@ -40,9 +38,9 @@
4038
public class SimpleObjectGlue extends CukeGlueAbstract {
4139

4240
@Given("^there are.* (\\d+) simple objects$")
43-
public void thereAreNumSimpleObjects(int n) throws Throwable {
41+
public void thereAreNumSimpleObjects(int n) {
4442
try {
45-
final List<SimpleObject> findAll = service(SimpleObjects.class).listAll();
43+
final var findAll = service(SimpleObjects.class).listAll();
4644
assertThat(findAll.size(), is(n));
4745
putVar("list", "all", findAll);
4846

@@ -52,7 +50,7 @@ public void thereAreNumSimpleObjects(int n) throws Throwable {
5250
}
5351

5452
@When("^I create a new simple object$")
55-
public void createNewSimpleObject() throws Throwable {
53+
public void createNewSimpleObject() {
5654
service(SimpleObjects.class).create(UUID.randomUUID().toString());
5755
}
5856

naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,17 @@
2626
import static org.junit.Assert.assertEquals;
2727
import static org.junit.Assert.assertNotNull;
2828

29+
import domainapp.dom.modules.simple.SimpleObject;
30+
import domainapp.fixture.scenarios.RecreateSimpleObjects;
31+
import domainapp.integtests.tests.SimpleAppIntegTest;
2932
import javax.inject.Inject;
30-
3133
import org.apache.isis.applib.DomainObjectContainer;
3234
import org.apache.isis.applib.fixturescripts.FixtureScripts;
3335
import org.apache.isis.applib.services.wrapper.DisabledException;
3436
import org.apache.isis.applib.services.wrapper.InvalidException;
3537
import org.junit.Before;
3638
import org.junit.Test;
3739

38-
import domainapp.dom.modules.simple.SimpleObject;
39-
import domainapp.fixture.scenarios.RecreateSimpleObjects;
40-
import domainapp.integtests.tests.SimpleAppIntegTest;
41-
4240
/**
4341
* Test Fixtures with Simple Objects
4442
*/
@@ -56,7 +54,7 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest {
5654
private static final String NEW_NAME = "new name";
5755

5856
@Before
59-
public void setUp() throws Exception {
57+
public void setUp() {
6058
// given
6159
fs = new RecreateSimpleObjects().setNumber(1);
6260
fixtureScripts.runFixtureScript(fs, null);
@@ -68,15 +66,15 @@ public void setUp() throws Exception {
6866
}
6967

7068
@Test
71-
public void testNameAccessible() throws Exception {
72-
// when
73-
final String name = simpleObjectWrapped.getName();
69+
public void testNameAccessible() {
70+
/* when */
71+
final var name = simpleObjectWrapped.getName();
7472
// then
7573
assertEquals(fs.names.get(0), name);
7674
}
7775

7876
@Test
79-
public void testNameCannotBeUpdatedDirectly() throws Exception {
77+
public void testNameCannotBeUpdatedDirectly() {
8078

8179
// expect
8280
expectedExceptions.expect(DisabledException.class);
@@ -86,7 +84,7 @@ public void testNameCannotBeUpdatedDirectly() throws Exception {
8684
}
8785

8886
@Test
89-
public void testUpdateName() throws Exception {
87+
public void testUpdateName() {
9088

9189
// when
9290
simpleObjectWrapped.updateName(NEW_NAME);
@@ -96,7 +94,7 @@ public void testUpdateName() throws Exception {
9694
}
9795

9896
@Test
99-
public void testUpdateNameFailsValidation() throws Exception {
97+
public void testUpdateNameFailsValidation() {
10098

10199
// expect
102100
expectedExceptions.expect(InvalidException.class);
@@ -107,13 +105,13 @@ public void testUpdateNameFailsValidation() throws Exception {
107105
}
108106

109107
@Test
110-
public void testInterpolatesName() throws Exception {
108+
public void testInterpolatesName() {
111109

112110
// given
113-
final String name = simpleObjectWrapped.getName();
111+
final var name = simpleObjectWrapped.getName();
114112

115113
// when
116-
final String title = container.titleOf(simpleObjectWrapped);
114+
final var title = container.titleOf(simpleObjectWrapped);
117115

118116
// then
119117
assertEquals("Object: " + name, title);

0 commit comments

Comments
 (0)