You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/01/09 16:15:50 UTC
[isis] 01/02: ISIS-2158: smoketesting wrapper when wrapping list of
entities
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
commit 1d887c1937577df39096740efa97e6fff6b602b9
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu Jan 9 17:08:27 2020 +0100
ISIS-2158: smoketesting wrapper when wrapping list of entities
---
.../{WrapperTest.java => WrapperAsyncTest.java} | 4 +-
.../commandexecution/WrapperSyncTest.java | 87 ++++++++++++++++++++++
2 files changed, 89 insertions(+), 2 deletions(-)
diff --git a/examples/smoketests/src/test/java/org/apache/isis/testdomain/commandexecution/WrapperTest.java b/examples/smoketests/src/test/java/org/apache/isis/testdomain/commandexecution/WrapperAsyncTest.java
similarity index 98%
rename from examples/smoketests/src/test/java/org/apache/isis/testdomain/commandexecution/WrapperTest.java
rename to examples/smoketests/src/test/java/org/apache/isis/testdomain/commandexecution/WrapperAsyncTest.java
index 6b13d20..f31e7ce 100644
--- a/examples/smoketests/src/test/java/org/apache/isis/testdomain/commandexecution/WrapperTest.java
+++ b/examples/smoketests/src/test/java/org/apache/isis/testdomain/commandexecution/WrapperAsyncTest.java
@@ -58,12 +58,12 @@ import lombok.extern.log4j.Log4j2;
@SpringBootTest(
classes = {
Configuration_usingJdo.class,
- WrapperTest.ActionDomainEventListener.class
+ WrapperAsyncTest.ActionDomainEventListener.class
}
)
@TestPropertySource(IsisPresets.UseLog4j2Test)
@Incubating("inconsitent state when run in a test batch")
-class WrapperTest {
+class WrapperAsyncTest {
@Inject private FixtureScripts fixtureScripts;
@Inject private RepositoryService repository;
diff --git a/examples/smoketests/src/test/java/org/apache/isis/testdomain/commandexecution/WrapperSyncTest.java b/examples/smoketests/src/test/java/org/apache/isis/testdomain/commandexecution/WrapperSyncTest.java
new file mode 100644
index 0000000..a967628
--- /dev/null
+++ b/examples/smoketests/src/test/java/org/apache/isis/testdomain/commandexecution/WrapperSyncTest.java
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+package org.apache.isis.testdomain.commandexecution;
+
+import java.util.concurrent.ExecutionException;
+
+import javax.inject.Inject;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.TestPropertySource;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.apache.isis.applib.services.factory.FactoryService;
+import org.apache.isis.applib.services.repository.RepositoryService;
+import org.apache.isis.applib.services.wrapper.WrapperFactory;
+import org.apache.isis.config.presets.IsisPresets;
+import org.apache.isis.extensions.fixtures.fixturescripts.FixtureScripts;
+import org.apache.isis.testdomain.Incubating;
+import org.apache.isis.testdomain.Smoketest;
+import org.apache.isis.testdomain.conf.Configuration_usingJdo;
+import org.apache.isis.testdomain.jdo.Book;
+import org.apache.isis.testdomain.jdo.InventoryManager;
+import org.apache.isis.testdomain.jdo.JdoTestDomainPersona;
+import org.apache.isis.testdomain.jdo.Product;
+
+import lombok.val;
+
+@Smoketest
+@SpringBootTest(
+ classes = {
+ Configuration_usingJdo.class,
+ }
+)
+@TestPropertySource(IsisPresets.UseLog4j2Test)
+@Incubating("inconsitent state when run in a test batch")
+class WrapperSyncTest {
+
+ @Inject private FixtureScripts fixtureScripts;
+ @Inject private RepositoryService repository;
+ @Inject private FactoryService facoryService;
+ @Inject private WrapperFactory wrapper;
+
+ @BeforeEach
+ void setUp() {
+ // cleanup
+ fixtureScripts.runPersona(JdoTestDomainPersona.PurgeAll);
+
+ // given
+ fixtureScripts.runPersona(JdoTestDomainPersona.InventoryWith1Book);
+ }
+
+ @Test
+ void testWrapper_waitingOnDomainEvent() throws InterruptedException, ExecutionException {
+
+ val inventoryManager = facoryService.viewModel(InventoryManager.class);
+ val product = repository.allInstances(Product.class).get(0);
+
+ assertEquals(99d, product.getPrice(), 1E-6);
+
+ val products = wrapper.wrap(inventoryManager).listAllProducts();
+
+ assertEquals(1, products.size());
+ assertEquals(Book.class, products.get(0).getClass());
+ }
+
+
+
+}