Uses java-11 in naked objects

This commit is contained in:
Anurag Agarwal 2020-08-08 00:41:58 +00:00
parent b0ac4c1ca3
commit a5038c4329
No known key found for this signature in database
GPG Key ID: CF5E14552DA23F13
17 changed files with 84 additions and 132 deletions

View File

@ -127,7 +127,7 @@
</goals> </goals>
</pluginExecutionFilter> </pluginExecutionFilter>
<action> <action>
<ignore></ignore> <ignore/>
</action> </action>
</pluginExecution> </pluginExecution>
</pluginExecutions> </pluginExecutions>

View File

@ -1,19 +1,3 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
{ {
"columns": [ "columns": [
{ {

View File

@ -50,9 +50,9 @@ import org.apache.isis.applib.util.ObjectContracts;
strategy = javax.jdo.annotations.IdGeneratorStrategy.IDENTITY, column = "id") strategy = javax.jdo.annotations.IdGeneratorStrategy.IDENTITY, column = "id")
@javax.jdo.annotations.Version(strategy = VersionStrategy.VERSION_NUMBER, column = "version") @javax.jdo.annotations.Version(strategy = VersionStrategy.VERSION_NUMBER, column = "version")
@javax.jdo.annotations.Queries({ @javax.jdo.annotations.Queries({
@javax.jdo.annotations.Query(name = "find", language = "JDOQL", value = "SELECT " @javax.jdo.annotations.Query(name = "find", value = "SELECT "
+ "FROM domainapp.dom.modules.simple.SimpleObject "), + "FROM domainapp.dom.modules.simple.SimpleObject "),
@javax.jdo.annotations.Query(name = "findByName", language = "JDOQL", value = "SELECT " @javax.jdo.annotations.Query(name = "findByName", value = "SELECT "
+ "FROM domainapp.dom.modules.simple.SimpleObject " + "WHERE name.indexOf(:name) >= 0 ")}) + "FROM domainapp.dom.modules.simple.SimpleObject " + "WHERE name.indexOf(:name) >= 0 ")})
@javax.jdo.annotations.Unique(name = "SimpleObject_name_UNQ", members = {"name"}) @javax.jdo.annotations.Unique(name = "SimpleObject_name_UNQ", members = {"name"})
@DomainObject @DomainObject

View File

@ -1,19 +1,3 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
{ {
"columns": [ "columns": [
{ {

View File

@ -37,12 +37,12 @@ public class SimpleObjectTest {
SimpleObject simpleObject; SimpleObject simpleObject;
@Before @Before
public void setUp() throws Exception { public void setUp() {
simpleObject = new SimpleObject(); simpleObject = new SimpleObject();
} }
@Test @Test
public void testName() throws Exception { public void testName() {
// given // given
String name = "Foobar"; String name = "Foobar";
assertNull(simpleObject.getName()); assertNull(simpleObject.getName());

View File

@ -52,13 +52,13 @@ public class SimpleObjectsTest {
SimpleObjects simpleObjects; SimpleObjects simpleObjects;
@Before @Before
public void setUp() throws Exception { public void setUp() {
simpleObjects = new SimpleObjects(); simpleObjects = new SimpleObjects();
simpleObjects.container = mockContainer; simpleObjects.container = mockContainer;
} }
@Test @Test
public void testCreate() throws Exception { public void testCreate() {
// given // given
final SimpleObject simpleObject = new SimpleObject(); final SimpleObject simpleObject = new SimpleObject();
@ -85,7 +85,7 @@ public class SimpleObjectsTest {
} }
@Test @Test
public void testListAll() throws Exception { public void testListAll() {
// given // given
final List<SimpleObject> all = Lists.newArrayList(); final List<SimpleObject> all = Lists.newArrayList();

View File

@ -67,8 +67,7 @@ public class SimpleObjectCreate extends FixtureScript {
@Override @Override
protected void execute(final ExecutionContext ec) { protected void execute(final ExecutionContext ec) {
var paramName = checkParam("name", ec, String.class);
String paramName = checkParam("name", ec, String.class);
this.simpleObject = wrap(simpleObjects).create(paramName); this.simpleObject = wrap(simpleObjects).create(paramName);

View File

@ -27,7 +27,6 @@ import com.google.common.collect.Lists;
import domainapp.dom.modules.simple.SimpleObject; import domainapp.dom.modules.simple.SimpleObject;
import domainapp.fixture.modules.simple.SimpleObjectCreate; import domainapp.fixture.modules.simple.SimpleObjectCreate;
import domainapp.fixture.modules.simple.SimpleObjectsTearDown; import domainapp.fixture.modules.simple.SimpleObjectsTearDown;
import java.util.Collections;
import java.util.List; import java.util.List;
import org.apache.isis.applib.fixturescripts.FixtureScript; import org.apache.isis.applib.fixturescripts.FixtureScript;
@ -37,8 +36,18 @@ import org.apache.isis.applib.fixturescripts.FixtureScript;
*/ */
public class RecreateSimpleObjects extends FixtureScript { public class RecreateSimpleObjects extends FixtureScript {
public final List<String> names = Collections.unmodifiableList(List.of("Foo", "Bar", "Baz", public final List<String> names = List.of(
"Frodo", "Froyo", "Fizz", "Bip", "Bop", "Bang", "Boo")); "Foo",
"Bar",
"Baz",
"Frodo",
"Froyo",
"Fizz",
"Bip",
"Bop",
"Bang",
"Boo"
);
// region > number (optional input) // region > number (optional input)
private Integer number; private Integer number;
@ -77,7 +86,7 @@ public class RecreateSimpleObjects extends FixtureScript {
protected void execute(final ExecutionContext ec) { protected void execute(final ExecutionContext ec) {
// defaults // defaults
final int paramNumber = defaultParam("number", ec, 3); final var paramNumber = defaultParam("number", ec, 3);
// validate // validate
if (paramNumber < 0 || paramNumber > names.size()) { if (paramNumber < 0 || paramNumber > names.size()) {
@ -90,8 +99,8 @@ public class RecreateSimpleObjects extends FixtureScript {
// //
ec.executeChild(this, new SimpleObjectsTearDown()); ec.executeChild(this, new SimpleObjectsTearDown());
for (int i = 0; i < paramNumber; i++) { for (var i = 0; i < paramNumber; i++) {
final SimpleObjectCreate fs = new SimpleObjectCreate().setName(names.get(i)); final var fs = new SimpleObjectCreate().setName(names.get(i));
ec.executeChild(this, fs.getName(), fs); ec.executeChild(this, fs.getName(), fs);
simpleObjects.add(fs.getSimpleObject()); simpleObjects.add(fs.getSimpleObject());
} }

View File

@ -25,7 +25,6 @@ package domainapp.integtests.bootstrap;
import org.apache.isis.core.commons.config.IsisConfiguration; import org.apache.isis.core.commons.config.IsisConfiguration;
import org.apache.isis.core.integtestsupport.IsisSystemForTest; import org.apache.isis.core.integtestsupport.IsisSystemForTest;
import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
import org.apache.isis.objectstore.jdo.datanucleus.IsisConfigurationForJdoIntegTests; import org.apache.isis.objectstore.jdo.datanucleus.IsisConfigurationForJdoIntegTests;
/** /**
@ -40,7 +39,7 @@ public final class SimpleAppSystemInitializer {
* Init test system * Init test system
*/ */
public static void initIsft() { public static void initIsft() {
IsisSystemForTest isft = IsisSystemForTest.getElseNull(); var isft = IsisSystemForTest.getElseNull();
if (isft == null) { if (isft == null) {
isft = new SimpleAppSystemBuilder().build().setUpSystem(); isft = new SimpleAppSystemBuilder().build().setUpSystem();
IsisSystemForTest.set(isft); IsisSystemForTest.set(isft);
@ -51,15 +50,13 @@ public final class SimpleAppSystemInitializer {
public SimpleAppSystemBuilder() { public SimpleAppSystemBuilder() {
with(testConfiguration()); with(testConfiguration());
with(new DataNucleusPersistenceMechanismInstaller());
// services annotated with @DomainService // services annotated with @DomainService
withServicesIn("domainapp"); withServicesIn("domainapp");
} }
private static IsisConfiguration testConfiguration() { private static IsisConfiguration testConfiguration() {
final IsisConfigurationForJdoIntegTests testConfiguration = final var testConfiguration = new IsisConfigurationForJdoIntegTests();
new IsisConfigurationForJdoIntegTests();
testConfiguration.addRegisterEntitiesPackagePrefix("domainapp.dom.modules"); testConfiguration.addRegisterEntitiesPackagePrefix("domainapp.dom.modules");
return testConfiguration; return testConfiguration;

View File

@ -23,10 +23,9 @@
package domainapp.integtests.specglue; package domainapp.integtests.specglue;
import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
import cucumber.api.java.Before; import cucumber.api.java.Before;
import domainapp.fixture.scenarios.RecreateSimpleObjects; import domainapp.fixture.scenarios.RecreateSimpleObjects;
import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
/** /**
* Test Execution to append a fixture of SimpleObjects * Test Execution to append a fixture of SimpleObjects
@ -34,7 +33,7 @@ import domainapp.fixture.scenarios.RecreateSimpleObjects;
public class CatalogOfFixturesGlue extends CukeGlueAbstract { public class CatalogOfFixturesGlue extends CukeGlueAbstract {
@Before(value = {"@integration", "@SimpleObjectsFixture"}, order = 20000) @Before(value = {"@integration", "@SimpleObjectsFixture"}, order = 20000)
public void integrationFixtures() throws Throwable { public void integrationFixtures() {
scenarioExecution().install(new RecreateSimpleObjects()); scenarioExecution().install(new RecreateSimpleObjects());
} }
} }

View File

@ -28,9 +28,7 @@ import static org.junit.Assert.assertThat;
import cucumber.api.java.en.Given; import cucumber.api.java.en.Given;
import cucumber.api.java.en.When; import cucumber.api.java.en.When;
import domainapp.dom.modules.simple.SimpleObject;
import domainapp.dom.modules.simple.SimpleObjects; import domainapp.dom.modules.simple.SimpleObjects;
import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.apache.isis.core.specsupport.specs.CukeGlueAbstract; import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
@ -40,9 +38,9 @@ import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
public class SimpleObjectGlue extends CukeGlueAbstract { public class SimpleObjectGlue extends CukeGlueAbstract {
@Given("^there are.* (\\d+) simple objects$") @Given("^there are.* (\\d+) simple objects$")
public void thereAreNumSimpleObjects(int n) throws Throwable { public void thereAreNumSimpleObjects(int n) {
try { try {
final List<SimpleObject> findAll = service(SimpleObjects.class).listAll(); final var findAll = service(SimpleObjects.class).listAll();
assertThat(findAll.size(), is(n)); assertThat(findAll.size(), is(n));
putVar("list", "all", findAll); putVar("list", "all", findAll);
@ -52,7 +50,7 @@ public class SimpleObjectGlue extends CukeGlueAbstract {
} }
@When("^I create a new simple object$") @When("^I create a new simple object$")
public void createNewSimpleObject() throws Throwable { public void createNewSimpleObject() {
service(SimpleObjects.class).create(UUID.randomUUID().toString()); service(SimpleObjects.class).create(UUID.randomUUID().toString());
} }

View File

@ -26,8 +26,10 @@ package domainapp.integtests.tests.modules.simple;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import domainapp.dom.modules.simple.SimpleObject;
import domainapp.fixture.scenarios.RecreateSimpleObjects;
import domainapp.integtests.tests.SimpleAppIntegTest;
import javax.inject.Inject; import javax.inject.Inject;
import org.apache.isis.applib.DomainObjectContainer; import org.apache.isis.applib.DomainObjectContainer;
import org.apache.isis.applib.fixturescripts.FixtureScripts; import org.apache.isis.applib.fixturescripts.FixtureScripts;
import org.apache.isis.applib.services.wrapper.DisabledException; import org.apache.isis.applib.services.wrapper.DisabledException;
@ -35,10 +37,6 @@ import org.apache.isis.applib.services.wrapper.InvalidException;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import domainapp.dom.modules.simple.SimpleObject;
import domainapp.fixture.scenarios.RecreateSimpleObjects;
import domainapp.integtests.tests.SimpleAppIntegTest;
/** /**
* Test Fixtures with Simple Objects * Test Fixtures with Simple Objects
*/ */
@ -56,7 +54,7 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest {
private static final String NEW_NAME = "new name"; private static final String NEW_NAME = "new name";
@Before @Before
public void setUp() throws Exception { public void setUp() {
// given // given
fs = new RecreateSimpleObjects().setNumber(1); fs = new RecreateSimpleObjects().setNumber(1);
fixtureScripts.runFixtureScript(fs, null); fixtureScripts.runFixtureScript(fs, null);
@ -68,15 +66,15 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest {
} }
@Test @Test
public void testNameAccessible() throws Exception { public void testNameAccessible() {
// when /* when */
final String name = simpleObjectWrapped.getName(); final var name = simpleObjectWrapped.getName();
// then // then
assertEquals(fs.names.get(0), name); assertEquals(fs.names.get(0), name);
} }
@Test @Test
public void testNameCannotBeUpdatedDirectly() throws Exception { public void testNameCannotBeUpdatedDirectly() {
// expect // expect
expectedExceptions.expect(DisabledException.class); expectedExceptions.expect(DisabledException.class);
@ -86,7 +84,7 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest {
} }
@Test @Test
public void testUpdateName() throws Exception { public void testUpdateName() {
// when // when
simpleObjectWrapped.updateName(NEW_NAME); simpleObjectWrapped.updateName(NEW_NAME);
@ -96,7 +94,7 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest {
} }
@Test @Test
public void testUpdateNameFailsValidation() throws Exception { public void testUpdateNameFailsValidation() {
// expect // expect
expectedExceptions.expect(InvalidException.class); expectedExceptions.expect(InvalidException.class);
@ -107,13 +105,13 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest {
} }
@Test @Test
public void testInterpolatesName() throws Exception { public void testInterpolatesName() {
// given // given
final String name = simpleObjectWrapped.getName(); final var name = simpleObjectWrapped.getName();
// when // when
final String title = container.titleOf(simpleObjectWrapped); final var title = container.titleOf(simpleObjectWrapped);
// then // then
assertEquals("Object: " + name, title); assertEquals("Object: " + name, title);

View File

@ -25,11 +25,13 @@ package domainapp.integtests.tests.modules.simple;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import com.google.common.base.Throwables;
import domainapp.dom.modules.simple.SimpleObjects;
import domainapp.fixture.modules.simple.SimpleObjectsTearDown;
import domainapp.fixture.scenarios.RecreateSimpleObjects;
import domainapp.integtests.tests.SimpleAppIntegTest;
import java.sql.SQLIntegrityConstraintViolationException; import java.sql.SQLIntegrityConstraintViolationException;
import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import org.apache.isis.applib.fixturescripts.FixtureScript; import org.apache.isis.applib.fixturescripts.FixtureScript;
import org.apache.isis.applib.fixturescripts.FixtureScripts; import org.apache.isis.applib.fixturescripts.FixtureScripts;
import org.hamcrest.Description; import org.hamcrest.Description;
@ -37,14 +39,6 @@ import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher; import org.hamcrest.TypeSafeMatcher;
import org.junit.Test; import org.junit.Test;
import com.google.common.base.Throwables;
import domainapp.dom.modules.simple.SimpleObject;
import domainapp.dom.modules.simple.SimpleObjects;
import domainapp.fixture.modules.simple.SimpleObjectsTearDown;
import domainapp.fixture.scenarios.RecreateSimpleObjects;
import domainapp.integtests.tests.SimpleAppIntegTest;
/** /**
* Fixture Pattern Integration Test * Fixture Pattern Integration Test
*/ */
@ -56,25 +50,25 @@ public class SimpleObjectsIntegTest extends SimpleAppIntegTest {
SimpleObjects simpleObjects; SimpleObjects simpleObjects;
@Test @Test
public void testListAll() throws Exception { public void testListAll() {
// given // given
RecreateSimpleObjects fs = new RecreateSimpleObjects(); var fs = new RecreateSimpleObjects();
fixtureScripts.runFixtureScript(fs, null); fixtureScripts.runFixtureScript(fs, null);
nextTransaction(); nextTransaction();
// when // when
final List<SimpleObject> all = wrap(simpleObjects).listAll(); final var all = wrap(simpleObjects).listAll();
// then // then
assertEquals(fs.getSimpleObjects().size(), all.size()); assertEquals(fs.getSimpleObjects().size(), all.size());
SimpleObject simpleObject = wrap(all.get(0)); var simpleObject = wrap(all.get(0));
assertEquals(fs.getSimpleObjects().get(0).getName(), simpleObject.getName()); assertEquals(fs.getSimpleObjects().get(0).getName(), simpleObject.getName());
} }
@Test @Test
public void testListAllWhenNone() throws Exception { public void testListAllWhenNone() {
// given // given
FixtureScript fs = new SimpleObjectsTearDown(); FixtureScript fs = new SimpleObjectsTearDown();
@ -82,14 +76,14 @@ public class SimpleObjectsIntegTest extends SimpleAppIntegTest {
nextTransaction(); nextTransaction();
// when // when
final List<SimpleObject> all = wrap(simpleObjects).listAll(); final var all = wrap(simpleObjects).listAll();
// then // then
assertEquals(0, all.size()); assertEquals(0, all.size());
} }
@Test @Test
public void testCreate() throws Exception { public void testCreate() {
// given // given
FixtureScript fs = new SimpleObjectsTearDown(); FixtureScript fs = new SimpleObjectsTearDown();
@ -100,12 +94,12 @@ public class SimpleObjectsIntegTest extends SimpleAppIntegTest {
wrap(simpleObjects).create("Faz"); wrap(simpleObjects).create("Faz");
// then // then
final List<SimpleObject> all = wrap(simpleObjects).listAll(); final var all = wrap(simpleObjects).listAll();
assertEquals(1, all.size()); assertEquals(1, all.size());
} }
@Test @Test
public void testCreateWhenAlreadyExists() throws Exception { public void testCreateWhenAlreadyExists() {
// given // given
FixtureScript fs = new SimpleObjectsTearDown(); FixtureScript fs = new SimpleObjectsTearDown();
@ -115,24 +109,24 @@ public class SimpleObjectsIntegTest extends SimpleAppIntegTest {
nextTransaction(); nextTransaction();
// then // then
expectedExceptions.expectCause(causalChainContains(SQLIntegrityConstraintViolationException.class)); expectedExceptions
.expectCause(causalChainContains(SQLIntegrityConstraintViolationException.class));
// when // when
wrap(simpleObjects).create("Faz"); wrap(simpleObjects).create("Faz");
nextTransaction(); nextTransaction();
} }
@SuppressWarnings("SameParameterValue")
private static Matcher<? extends Throwable> causalChainContains(final Class<?> cls) { private static Matcher<? extends Throwable> causalChainContains(final Class<?> cls) {
return new TypeSafeMatcher<Throwable>() { return new TypeSafeMatcher<>() {
@Override @Override
@SuppressWarnings("UnstableApiUsage")
protected boolean matchesSafely(Throwable item) { protected boolean matchesSafely(Throwable item) {
final List<Throwable> causalChain = Throwables.getCausalChain(item); final var causalChain = Throwables.getCausalChain(item);
for (Throwable throwable : causalChain) { return causalChain.stream()
if (cls.isAssignableFrom(throwable.getClass())) { .map(Throwable::getClass)
return true; .allMatch(cls::isAssignableFrom);
}
}
return false;
} }
@Override @Override

View File

@ -2,7 +2,3 @@
/SimpleApp-PROTOTYPE-no-fixtures.launch /SimpleApp-PROTOTYPE-no-fixtures.launch
/SimpleApp-PROTOTYPE-with-fixtures.launch /SimpleApp-PROTOTYPE-with-fixtures.launch
/SimpleApp-SERVER-no-fixtures.launch /SimpleApp-SERVER-no-fixtures.launch
/SimpleApp-PROTOTYPE-jrebel.launch
/SimpleApp-PROTOTYPE-no-fixtures.launch
/SimpleApp-PROTOTYPE-with-fixtures.launch
/SimpleApp-SERVER-no-fixtures.launch

View File

@ -129,7 +129,7 @@
</goals> </goals>
</pluginExecutionFilter> </pluginExecutionFilter>
<action> <action>
<ignore></ignore> <ignore/>
</action> </action>
</pluginExecution> </pluginExecution>
</pluginExecutions> </pluginExecutions>

View File

@ -31,18 +31,15 @@ import com.google.inject.name.Names;
import com.google.inject.util.Modules; import com.google.inject.util.Modules;
import com.google.inject.util.Providers; import com.google.inject.util.Providers;
import de.agilecoders.wicket.core.Bootstrap; import de.agilecoders.wicket.core.Bootstrap;
import de.agilecoders.wicket.core.settings.IBootstrapSettings;
import de.agilecoders.wicket.themes.markup.html.bootswatch.BootswatchTheme; import de.agilecoders.wicket.themes.markup.html.bootswatch.BootswatchTheme;
import de.agilecoders.wicket.themes.markup.html.bootswatch.BootswatchThemeProvider; import de.agilecoders.wicket.themes.markup.html.bootswatch.BootswatchThemeProvider;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.isis.viewer.wicket.viewer.IsisWicketApplication; import org.apache.isis.viewer.wicket.viewer.IsisWicketApplication;
import org.apache.isis.viewer.wicket.viewer.integration.wicket.AuthenticatedWebSessionForIsis; import org.apache.isis.viewer.wicket.viewer.integration.wicket.AuthenticatedWebSessionForIsis;
import org.apache.wicket.Session; import org.apache.wicket.Session;
import org.apache.wicket.request.IRequestParameters;
import org.apache.wicket.request.Request; import org.apache.wicket.request.Request;
import org.apache.wicket.request.Response; import org.apache.wicket.request.Response;
import org.apache.wicket.request.http.WebRequest; import org.apache.wicket.request.http.WebRequest;
@ -85,7 +82,7 @@ public class SimpleApplication extends IsisWicketApplication {
protected void init() { protected void init() {
super.init(); super.init();
IBootstrapSettings settings = Bootstrap.getSettings(); var settings = Bootstrap.getSettings();
settings.setThemeProvider(new BootswatchThemeProvider(BootswatchTheme.Flatly)); settings.setThemeProvider(new BootswatchThemeProvider(BootswatchTheme.Flatly));
} }
@ -96,13 +93,10 @@ public class SimpleApplication extends IsisWicketApplication {
} }
// else demo mode // else demo mode
final AuthenticatedWebSessionForIsis s = final var s = (AuthenticatedWebSessionForIsis) super.newSession(request, response);
(AuthenticatedWebSessionForIsis) super.newSession(request, response); var requestParameters = request.getRequestParameters();
IRequestParameters requestParameters = request.getRequestParameters(); final var user = requestParameters.getParameterValue("user");
final org.apache.wicket.util.string.StringValue user = final var password = requestParameters.getParameterValue("pass");
requestParameters.getParameterValue("user");
final org.apache.wicket.util.string.StringValue password =
requestParameters.getParameterValue("pass");
s.signIn(user.toString(), password.toString()); s.signIn(user.toString(), password.toString());
return s; return s;
} }
@ -115,7 +109,7 @@ public class SimpleApplication extends IsisWicketApplication {
// else demo mode // else demo mode
try { try {
String uname = servletRequest.getParameter("user"); var uname = servletRequest.getParameter("user");
if (uname != null) { if (uname != null) {
servletRequest.getSession().invalidate(); servletRequest.getSession().invalidate();
} }
@ -127,7 +121,7 @@ public class SimpleApplication extends IsisWicketApplication {
@Override @Override
protected Module newIsisWicketModule() { protected Module newIsisWicketModule() {
final Module isisDefaults = super.newIsisWicketModule(); final var isisDefaults = super.newIsisWicketModule();
final Module overrides = new AbstractModule() { final Module overrides = new AbstractModule() {
@Override @Override
@ -148,11 +142,11 @@ public class SimpleApplication extends IsisWicketApplication {
return Modules.override(isisDefaults).with(overrides); return Modules.override(isisDefaults).with(overrides);
} }
@SuppressWarnings({"UnstableApiUsage", "SameParameterValue"})
private static String readLines(final Class<?> contextClass, final String resourceName) { private static String readLines(final Class<?> contextClass, final String resourceName) {
try { try {
List<String> readLines = var resource = Resources.getResource(contextClass, resourceName);
Resources.readLines(Resources.getResource(contextClass, resourceName), var readLines = Resources.readLines(resource, Charset.defaultCharset());
Charset.defaultCharset());
return Joiner.on("\n").join(readLines); return Joiner.on("\n").join(readLines);
} catch (IOException e) { } catch (IOException e) {
return "This is a simple app"; return "This is a simple app";

View File

@ -110,8 +110,8 @@ th, td {
</p> </p>
<p> <p>
provides access to a RESTful API conformant with the provides access to a RESTful API conformant with the
<a href="http://restfulobjects.org">Restful Objects</a> spec</td>. This is part of Apache Isis Core. The <a href="http://restfulobjects.org">Restful Objects</a> spec. This is part of Apache Isis Core.
implementation technology is JBoss RestEasy. The implementation technology is JBoss RestEasy.
</p> </p>
</li> </li>
</ul> </ul>