http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/pom.xml ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/pom.xml b/mothballed/example/application/todoapp/fixture/pom.xml new file mode 100644 index 0000000..8881b6e --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/pom.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.isis.example.application</groupId> + <artifactId>todoapp</artifactId> + <version>1.8.0-SNAPSHOT</version> + </parent> + + <artifactId>todoapp-fixture</artifactId> + <name>ToDo App Fixtures</name> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>todoapp-dom</artifactId> + </dependency> + </dependencies> + +</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java new file mode 100644 index 0000000..15bc3a9 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java @@ -0,0 +1,97 @@ +/* + * 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 fixture.todo; + +import fixture.todo.scenarios.ToDoItemsRecreateAndCompleteSeveral; + +import java.util.List; +import org.apache.isis.applib.annotation.Action; +import org.apache.isis.applib.annotation.ActionLayout; +import org.apache.isis.applib.annotation.DomainService; +import org.apache.isis.applib.annotation.DomainServiceLayout; +import org.apache.isis.applib.annotation.RestrictTo; +import org.apache.isis.applib.annotation.MemberOrder; +import org.apache.isis.applib.annotation.Optionality; +import org.apache.isis.applib.annotation.Parameter; +import org.apache.isis.applib.annotation.ParameterLayout; +import org.apache.isis.applib.fixturescripts.FixtureResult; +import org.apache.isis.applib.fixturescripts.FixtureScript; +import org.apache.isis.applib.fixturescripts.FixtureScripts; + +/** + * Enables fixtures to be installed from the application. + */ +@DomainService +@DomainServiceLayout( + named = "Prototyping", + menuBar = DomainServiceLayout.MenuBar.SECONDARY, + menuOrder = "10") +public class ToDoItemsFixturesService extends FixtureScripts { + + public ToDoItemsFixturesService() { + super("fixture.todo"); + } + + @ActionLayout( + cssClassFa="fa fa-bolt" + ) + @Action( + restrictTo = RestrictTo.PROTOTYPING + ) + @Override + public List<FixtureResult> runFixtureScript( + final FixtureScript fixtureScript, + @ParameterLayout( + named="Parameters", + describedAs = "Script-specific parameters (key=value) ", + multiLine = 10) + @Parameter(optionality = Optionality.OPTIONAL) + final String parameters) { + return super.runFixtureScript(fixtureScript, parameters); + } + + @Override + public FixtureScript default0RunFixtureScript() { + return findFixtureScriptFor(ToDoItemsRecreateAndCompleteSeveral.class); + } + + /** + * Raising visibility to <tt>public</tt> so that choices are available for first param + * of {@link #runFixtureScript(FixtureScript, String)}. + */ + @Override + public List<FixtureScript> choices0RunFixtureScript() { + return super.choices0RunFixtureScript(); + } + + // ////////////////////////////////////// + + + @ActionLayout( + cssClassFa="fa fa-list" + ) + @Action( + restrictTo = RestrictTo.PROTOTYPING + ) + @MemberOrder(sequence="20") + public Object recreateToDoItemsReturnFirst() { + final List<FixtureResult> run = findFixtureScriptFor(ToDoItemsRecreateAndCompleteSeveral.class).run(null); + return run.get(0).getObject(); + } +} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java new file mode 100644 index 0000000..2634839 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java @@ -0,0 +1,40 @@ +/* + * 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 fixture.todo.integtests; + +import fixture.todo.scenarios.ToDoItemsRecreateAndCompleteSeveral; + +import org.apache.isis.applib.fixturescripts.FixtureScript; + +/** + * Refactored to reuse the newer {@link FixtureScript} API. + */ +public class ToDoItemsIntegTestFixture extends FixtureScript { + + public ToDoItemsIntegTestFixture() { + super(null, "integ-test"); + } + + @Override + protected void execute(ExecutionContext executionContext) { + executionContext.executeChild(this, new ToDoItemsRecreateAndCompleteSeveral()); + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteAbstract.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteAbstract.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteAbstract.java new file mode 100644 index 0000000..3e009fe --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteAbstract.java @@ -0,0 +1,52 @@ +/* + * 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 fixture.todo.items.actions.complete; + +import dom.todo.ToDoItem; + +import java.util.Collection; +import com.google.common.base.Objects; +import com.google.common.base.Predicate; +import com.google.common.collect.Collections2; +import org.apache.isis.applib.fixturescripts.FixtureScript; + +public abstract class ToDoItemCompleteAbstract extends FixtureScript { + + /** + * Looks up item from repository, and completes. + */ + protected void complete(final String description, final ExecutionContext executionContext) { + String ownedBy = executionContext.getParameter("ownedBy"); + final ToDoItem toDoItem = findToDoItem(description, ownedBy); + toDoItem.setComplete(true); + executionContext.addResult(this, toDoItem); + } + + private ToDoItem findToDoItem(final String description, final String ownedBy) { + final Collection<ToDoItem> filtered = Collections2.filter(getContainer().allInstances(ToDoItem.class), new Predicate<ToDoItem>() { + @Override + public boolean apply(ToDoItem input) { + return Objects.equal(description, input.getDescription()) && + Objects.equal(ownedBy, input.getOwnedBy()); + } + }); + return filtered.isEmpty()? null: filtered.iterator().next(); + } + //endregion +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForBuyStamps.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForBuyStamps.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForBuyStamps.java new file mode 100644 index 0000000..b05bf36 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForBuyStamps.java @@ -0,0 +1,30 @@ +/* + * 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 fixture.todo.items.actions.complete; + +import fixture.todo.items.create.ToDoItemForBuyStamps; + +public class ToDoItemCompleteForBuyStamps extends ToDoItemCompleteAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + complete(ToDoItemForBuyStamps.DESCRIPTION, executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForWriteBlogPost.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForWriteBlogPost.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForWriteBlogPost.java new file mode 100644 index 0000000..4b620f4 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForWriteBlogPost.java @@ -0,0 +1,31 @@ +/* + * 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 fixture.todo.items.actions.complete; + +import fixture.todo.items.create.ToDoItemForWriteBlogPost; + +public class ToDoItemCompleteForWriteBlogPost extends ToDoItemCompleteAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + complete(ToDoItemForWriteBlogPost.DESCRIPTION, executionContext); + } + + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemAbstract.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemAbstract.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemAbstract.java new file mode 100644 index 0000000..3586c86 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemAbstract.java @@ -0,0 +1,69 @@ +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem; +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; +import dom.todo.ToDoItems; + +import java.math.BigDecimal; +import org.joda.time.LocalDate; +import org.apache.isis.applib.fixturescripts.FixtureScript; +import org.apache.isis.applib.services.clock.ClockService; + +public abstract class ToDoItemAbstract extends FixtureScript { + + protected ToDoItem createToDoItem( + final String description, + final Category category, final Subcategory subcategory, + final LocalDate dueBy, + final BigDecimal cost, + final ExecutionContext executionContext) { + + // validate parameters + final String ownedBy = executionContext.getParameter("ownedBy"); + if(ownedBy == null) { + throw new IllegalArgumentException("'ownedBy' must be specified"); + } + + // execute + ToDoItem newToDo = toDoItems.newToDo( + description, category, subcategory, ownedBy, dueBy, cost); + return executionContext.addResult(this, newToDo); + } + + protected LocalDate nowPlusDays(int days) { + return clockService.now().plusDays(days); + } + + protected BigDecimal BD(String str) { + return new BigDecimal(str); + } + + //region > injected services + @javax.inject.Inject + private ToDoItems toDoItems; + + @javax.inject.Inject + protected ClockService clockService; + //endregion + + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyBread.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyBread.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyBread.java new file mode 100644 index 0000000..0bcde45 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyBread.java @@ -0,0 +1,37 @@ +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForBuyBread extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Buy bread", + Category.Domestic, Subcategory.Shopping, + nowPlusDays(0), + BD("1.75"), + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyMilk.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyMilk.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyMilk.java new file mode 100644 index 0000000..da6d25e --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyMilk.java @@ -0,0 +1,37 @@ +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForBuyMilk extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Buy milk", + Category.Domestic, Subcategory.Shopping, + nowPlusDays(0), + BD("0.75"), + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyStamps.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyStamps.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyStamps.java new file mode 100644 index 0000000..4c6fb70 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyStamps.java @@ -0,0 +1,39 @@ +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForBuyStamps extends ToDoItemAbstract { + + public static final String DESCRIPTION = "Buy stamps"; + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + DESCRIPTION, + Category.Domestic, Subcategory.Shopping, + nowPlusDays(0), + BD("10.00"), + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForMowLawn.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForMowLawn.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForMowLawn.java new file mode 100644 index 0000000..daf4e2e --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForMowLawn.java @@ -0,0 +1,37 @@ +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForMowLawn extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Mow lawn", + Category.Domestic, Subcategory.Garden, + nowPlusDays(6), + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForOrganizeBrownBag.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForOrganizeBrownBag.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForOrganizeBrownBag.java new file mode 100644 index 0000000..d4c01a7 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForOrganizeBrownBag.java @@ -0,0 +1,37 @@ +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForOrganizeBrownBag extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Organize brown bag", + Category.Professional, Subcategory.Consulting, + nowPlusDays(14), + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForPickUpLaundry.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForPickUpLaundry.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForPickUpLaundry.java new file mode 100644 index 0000000..5d9a309 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForPickUpLaundry.java @@ -0,0 +1,37 @@ +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForPickUpLaundry extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Pick up laundry", + Category.Domestic, Subcategory.Chores, + nowPlusDays(6), + BD("7.50"), + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSharpenKnives.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSharpenKnives.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSharpenKnives.java new file mode 100644 index 0000000..c850993 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSharpenKnives.java @@ -0,0 +1,37 @@ +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForSharpenKnives extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Sharpen knives", + Category.Domestic, Subcategory.Chores, + nowPlusDays(14), + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForStageIsisRelease.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForStageIsisRelease.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForStageIsisRelease.java new file mode 100644 index 0000000..d9544ab --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForStageIsisRelease.java @@ -0,0 +1,37 @@ +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForStageIsisRelease extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Stage Isis release", + Category.Professional, Subcategory.OpenSource, + null, + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSubmitConferenceSession.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSubmitConferenceSession.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSubmitConferenceSession.java new file mode 100644 index 0000000..86e7177 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSubmitConferenceSession.java @@ -0,0 +1,37 @@ +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForSubmitConferenceSession extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Submit conference session", + Category.Professional, Subcategory.Education, + nowPlusDays(21), + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForVacuumHouse.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForVacuumHouse.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForVacuumHouse.java new file mode 100644 index 0000000..64f4ab4 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForVacuumHouse.java @@ -0,0 +1,37 @@ +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForVacuumHouse extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Vacuum house", + Category.Domestic, Subcategory.Housework, + nowPlusDays(3), + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteBlogPost.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteBlogPost.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteBlogPost.java new file mode 100644 index 0000000..8d912ad --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteBlogPost.java @@ -0,0 +1,39 @@ +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForWriteBlogPost extends ToDoItemAbstract { + + public static final String DESCRIPTION = "Write blog post"; + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + DESCRIPTION, + Category.Professional, Subcategory.Marketing, + nowPlusDays(7), + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteToPenPal.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteToPenPal.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteToPenPal.java new file mode 100644 index 0000000..eb495a2 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteToPenPal.java @@ -0,0 +1,37 @@ +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForWriteToPenPal extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Write to penpal", + Category.Other, Subcategory.Other, + null, + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/delete/ToDoItemsDelete.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/delete/ToDoItemsDelete.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/delete/ToDoItemsDelete.java new file mode 100644 index 0000000..3ac08bc --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/items/delete/ToDoItemsDelete.java @@ -0,0 +1,38 @@ +/* + * 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 fixture.todo.items.delete; + +import org.apache.isis.applib.fixturescripts.FixtureScript; +import org.apache.isis.applib.services.jdosupport.IsisJdoSupport; + +public class ToDoItemsDelete extends FixtureScript { + + //region > execute + protected void execute(ExecutionContext executionContext) { + final String ownedBy = executionContext.getParameter("ownedBy"); + isisJdoSupport.executeUpdate("delete from \"ToDoItem\" where \"ownedBy\" = '" + ownedBy + "'"); + } + //endregion + + //region > injected services + @javax.inject.Inject + private IsisJdoSupport isisJdoSupport; + //endregion + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreate.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreate.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreate.java new file mode 100644 index 0000000..5e61cc2 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreate.java @@ -0,0 +1,81 @@ +/* + * 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 fixture.todo.scenarios; + +import fixture.todo.items.delete.ToDoItemsDelete; +import fixture.todo.items.create.ToDoItemForBuyBread; +import fixture.todo.items.create.ToDoItemForBuyMilk; +import fixture.todo.items.create.ToDoItemForBuyStamps; +import fixture.todo.items.create.ToDoItemForMowLawn; +import fixture.todo.items.create.ToDoItemForOrganizeBrownBag; +import fixture.todo.items.create.ToDoItemForPickUpLaundry; +import fixture.todo.items.create.ToDoItemForSharpenKnives; +import fixture.todo.items.create.ToDoItemForStageIsisRelease; +import fixture.todo.items.create.ToDoItemForSubmitConferenceSession; +import fixture.todo.items.create.ToDoItemForVacuumHouse; +import fixture.todo.items.create.ToDoItemForWriteBlogPost; +import fixture.todo.items.create.ToDoItemForWriteToPenPal; +import fixture.todo.util.Util; + +import org.apache.isis.applib.fixturescripts.FixtureScript; + +public class ToDoItemsRecreate extends FixtureScript { + + public ToDoItemsRecreate() { + withDiscoverability(Discoverability.DISCOVERABLE); + } + + //region > ownedBy (optional) + private String ownedBy; + + public String getOwnedBy() { + return ownedBy; + } + + public void setOwnedBy(String ownedBy) { + this.ownedBy = ownedBy; + } + //endregion + + @Override + protected void execute(ExecutionContext executionContext) { + + // defaults + executionContext.setParameterIfNotPresent( + "ownedBy", + Util.coalesce(getOwnedBy(), getContainer().getUser().getName())); + + // prereqs + executionContext.executeChild(this, new ToDoItemsDelete()); + + // create items + executionContext.executeChild(this, new ToDoItemForBuyMilk()); + executionContext.executeChild(this, new ToDoItemForBuyBread()); + executionContext.executeChild(this, new ToDoItemForBuyStamps()); + executionContext.executeChild(this, new ToDoItemForPickUpLaundry()); + executionContext.executeChild(this, new ToDoItemForMowLawn()); + executionContext.executeChild(this, new ToDoItemForVacuumHouse()); + executionContext.executeChild(this, new ToDoItemForSharpenKnives()); + executionContext.executeChild(this, new ToDoItemForWriteToPenPal()); + executionContext.executeChild(this, new ToDoItemForWriteBlogPost()); + executionContext.executeChild(this, new ToDoItemForOrganizeBrownBag()); + executionContext.executeChild(this, new ToDoItemForSubmitConferenceSession()); + executionContext.executeChild(this, new ToDoItemForStageIsisRelease()); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveral.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveral.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveral.java new file mode 100644 index 0000000..d0645a2 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveral.java @@ -0,0 +1,86 @@ +/* + * 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 fixture.todo.scenarios; + +import fixture.todo.items.actions.complete.ToDoItemCompleteForBuyStamps; +import fixture.todo.items.actions.complete.ToDoItemCompleteForWriteBlogPost; +import fixture.todo.items.create.ToDoItemForBuyBread; +import fixture.todo.items.create.ToDoItemForBuyMilk; +import fixture.todo.items.create.ToDoItemForBuyStamps; +import fixture.todo.items.create.ToDoItemForMowLawn; +import fixture.todo.items.create.ToDoItemForOrganizeBrownBag; +import fixture.todo.items.create.ToDoItemForPickUpLaundry; +import fixture.todo.items.create.ToDoItemForSharpenKnives; +import fixture.todo.items.create.ToDoItemForStageIsisRelease; +import fixture.todo.items.create.ToDoItemForSubmitConferenceSession; +import fixture.todo.items.create.ToDoItemForVacuumHouse; +import fixture.todo.items.create.ToDoItemForWriteBlogPost; +import fixture.todo.items.create.ToDoItemForWriteToPenPal; +import fixture.todo.items.delete.ToDoItemsDelete; +import fixture.todo.util.Util; + +import org.apache.isis.applib.fixturescripts.FixtureScript; + +public class ToDoItemsRecreateAndCompleteSeveral extends FixtureScript { + + public ToDoItemsRecreateAndCompleteSeveral() { + withDiscoverability(Discoverability.DISCOVERABLE); + } + + //region > ownedBy (optional) + private String ownedBy; + + public String getOwnedBy() { + return ownedBy; + } + + public void setOwnedBy(String ownedBy) { + this.ownedBy = ownedBy; + } + //endregion + + @Override + protected void execute(ExecutionContext executionContext) { + + // defaults + executionContext.setParameterIfNotPresent( + "ownedBy", + Util.coalesce(getOwnedBy(), getContainer().getUser().getName())); + + executionContext.executeChild(this, new ToDoItemsDelete()); + + // create items + executionContext.executeChild(this, new ToDoItemForBuyMilk()); + executionContext.executeChild(this, new ToDoItemForBuyBread()); + executionContext.executeChild(this, new ToDoItemForBuyStamps()); + executionContext.executeChild(this, new ToDoItemForPickUpLaundry()); + executionContext.executeChild(this, new ToDoItemForMowLawn()); + executionContext.executeChild(this, new ToDoItemForVacuumHouse()); + executionContext.executeChild(this, new ToDoItemForSharpenKnives()); + executionContext.executeChild(this, new ToDoItemForWriteToPenPal()); + executionContext.executeChild(this, new ToDoItemForWriteBlogPost()); + executionContext.executeChild(this, new ToDoItemForOrganizeBrownBag()); + executionContext.executeChild(this, new ToDoItemForSubmitConferenceSession()); + executionContext.executeChild(this, new ToDoItemForStageIsisRelease()); + + // this fixture + executionContext.executeChild(this, new ToDoItemCompleteForBuyStamps()); + executionContext.executeChild(this, new ToDoItemCompleteForWriteBlogPost()); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForDick.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForDick.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForDick.java new file mode 100644 index 0000000..60d5a10 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForDick.java @@ -0,0 +1,28 @@ +/* + * 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 fixture.todo.scenarios; + +public final class ToDoItemsRecreateAndCompleteSeveralForDick extends ToDoItemsRecreateAndCompleteSeveral { + + public ToDoItemsRecreateAndCompleteSeveralForDick() { + withDiscoverability(Discoverability.DISCOVERABLE); + + setOwnedBy("dick"); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForJoe.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForJoe.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForJoe.java new file mode 100644 index 0000000..b324f34 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForJoe.java @@ -0,0 +1,28 @@ +/* + * 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 fixture.todo.scenarios; + +public final class ToDoItemsRecreateAndCompleteSeveralForJoe extends ToDoItemsRecreateAndCompleteSeveral { + + public ToDoItemsRecreateAndCompleteSeveralForJoe() { + withDiscoverability(Discoverability.DISCOVERABLE); + + setOwnedBy("joe"); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateForSven.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateForSven.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateForSven.java new file mode 100644 index 0000000..16db8a7 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateForSven.java @@ -0,0 +1,29 @@ +/* + * 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 fixture.todo.scenarios; + +public final class ToDoItemsRecreateForSven extends ToDoItemsRecreate { + + public ToDoItemsRecreateForSven() { + withDiscoverability(Discoverability.DISCOVERABLE); + + setOwnedBy("sven"); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/util/Util.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/util/Util.java b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/util/Util.java new file mode 100644 index 0000000..a385588 --- /dev/null +++ b/mothballed/example/application/todoapp/fixture/src/main/java/fixture/todo/util/Util.java @@ -0,0 +1,32 @@ +/* + * 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 fixture.todo.util; + +public final class Util { + + private Util(){} + + public static String coalesce(final String... strings) { + for (String str : strings) { + if(str != null) { return str; } + } + return null; + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/integtests/logging.properties ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/integtests/logging.properties b/mothballed/example/application/todoapp/integtests/logging.properties new file mode 100644 index 0000000..1e4d987 --- /dev/null +++ b/mothballed/example/application/todoapp/integtests/logging.properties @@ -0,0 +1,101 @@ +# 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. + + +# +# Isis uses log4j is used to provide system logging +# +log4j.rootCategory=INFO, Console + +# The console appender +log4j.appender.Console=org.apache.log4j.ConsoleAppender +log4j.appender.Console.target=System.out +log4j.appender.Console.layout=org.apache.log4j.PatternLayout +log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} [%-20c{1} %-10t %-5p] %m%n + +log4j.appender.File=org.apache.log4j.RollingFileAppender +log4j.appender.File.file=isis.log +log4j.appender.File.append=false +log4j.appender.File.layout=org.apache.log4j.PatternLayout +log4j.appender.File.layout.ConversionPattern=%d [%-20c{1} %-10t %-5p] %m%n + +! turn on the internal log4j debugging flag so we can see what it is doing +#log4j.debug=true + +# DataNucleus +# the first two log the DML and DDL (if set to DEBUG) +log4j.logger.DataNucleus.Datastore.Native=WARN, Console +log4j.logger.DataNucleus.Datastore.Schema=DEBUG, Console +# the remainder can probably be left to WARN +log4j.logger.DataNucleus.Persistence=WARN, Console +log4j.logger.DataNucleus.Transaction=WARN, Console +log4j.logger.DataNucleus.Connection=WARN, Console +log4j.logger.DataNucleus.Query=WARN, Console +log4j.logger.DataNucleus.Cache=WARN, Console +log4j.logger.DataNucleus.MetaData=WARN, Console +log4j.logger.DataNucleus.Datastore=WARN, Console +log4j.logger.DataNucleus.Datastore.Persist=WARN, Console +log4j.logger.DataNucleus.Datastore.Retrieve=WARN, Console +log4j.logger.DataNucleus.General=WARN, Console +log4j.logger.DataNucleus.Lifecycle=WARN, Console +log4j.logger.DataNucleus.ValueGeneration=WARN, Console +log4j.logger.DataNucleus.Enhancer=WARN, Console +log4j.logger.DataNucleus.SchemaTool=ERROR, Console +log4j.logger.DataNucleus.JDO=WARN, Console +log4j.logger.DataNucleus.JPA=ERROR, Console +log4j.logger.DataNucleus.JCA=WARN, Console +log4j.logger.DataNucleus.IDE=ERROR, Console + +log4j.additivity.DataNucleus.Datastore.Native=false +log4j.additivity.DataNucleus.Datastore.Schema=false +log4j.additivity.DataNucleus.Datastore.Persistence=false +log4j.additivity.DataNucleus.Datastore.Transaction=false +log4j.additivity.DataNucleus.Datastore.Connection=false +log4j.additivity.DataNucleus.Datastore.Query=false +log4j.additivity.DataNucleus.Datastore.Cache=false +log4j.additivity.DataNucleus.Datastore.MetaData=false +log4j.additivity.DataNucleus.Datastore.Datastore=false +log4j.additivity.DataNucleus.Datastore.Datastore.Persist=false +log4j.additivity.DataNucleus.Datastore.Datastore.Retrieve=false +log4j.additivity.DataNucleus.Datastore.General=false +log4j.additivity.DataNucleus.Datastore.Lifecycle=false +log4j.additivity.DataNucleus.Datastore.ValueGeneration=false +log4j.additivity.DataNucleus.Datastore.Enhancer=false +log4j.additivity.DataNucleus.Datastore.SchemaTool=false +log4j.additivity.DataNucleus.Datastore.JDO=false +log4j.additivity.DataNucleus.Datastore.JPA=false +log4j.additivity.DataNucleus.Datastore.JCA=false +log4j.additivity.DataNucleus.Datastore.IDE=false + + + + +# if using log4jdbc-remix as JDBC driver +#log4j.logger.jdbc.sqlonly=DEBUG, sql, Console +#log4j.additivity.jdbc.sqlonly=false +#log4j.logger.jdbc.resultsettable=DEBUG, jdbc, Console +#log4j.additivity.jdbc.resultsettable=false + +#log4j.logger.jdbc.audit=WARN,jdbc, Console +#log4j.additivity.jdbc.audit=false +#log4j.logger.jdbc.resultset=WARN,jdbc +#log4j.additivity.jdbc.resultset=false +#log4j.logger.jdbc.sqltiming=WARN,sqltiming +#log4j.additivity.jdbc.sqltiming=false +#log4j.logger.jdbc.connection=FATAL,connection +#log4j.additivity.jdbc.connection=false + http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/integtests/pom.xml ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/integtests/pom.xml b/mothballed/example/application/todoapp/integtests/pom.xml new file mode 100644 index 0000000..3186102 --- /dev/null +++ b/mothballed/example/application/todoapp/integtests/pom.xml @@ -0,0 +1,159 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.isis.example.application</groupId> + <artifactId>todoapp</artifactId> + <version>1.8.0-SNAPSHOT</version> + </parent> + + <artifactId>todoapp-integtests</artifactId> + <name>ToDo App Integration Tests</name> + + <build> + <testResources> + <testResource> + <filtering>false</filtering> + <directory>src/test/resources</directory> + </testResource> + <testResource> + <filtering>false</filtering> + <directory>src/test/java</directory> + <includes> + <include>**</include> + </includes> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </testResource> + </testResources> + <plugins> + <!-- + uncomment for enhanced cucumber-jvm reporting + http://www.masterthought.net/section/cucumber-reporting + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <testfailureignore>true</testfailureignore> + </configuration> + </plugin> + <plugin> + <groupId>net.masterthought</groupId> + <artifactId>maven-cucumber-reporting</artifactId> + <version>0.0.3</version> + <executions> + <execution> + <id>execution</id> + <phase>verify</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <projectname>cucumber-jvm-example</projectname> + <outputdirectory>${project.build.directory}/cucumber-reports</outputdirectory> + <cucumberoutput>${project.build.directory}/cucumber.json</cucumberoutput> + <enableflashcharts>false</enableflashcharts> + </configuration> + </execution> + </executions> + </plugin> + --> + </plugins> + </build> + <dependencies> + + <!-- other modules in this project --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>todoapp-fixture</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-unittestsupport</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-integtestsupport</artifactId> + </dependency> + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-specsupport</artifactId> + </dependency> + + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-library</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-wrapper</artifactId> + </dependency> + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-runtime</artifactId> + </dependency> + + <dependency> + <groupId>org.hsqldb</groupId> + <artifactId>hsqldb</artifactId> + </dependency> + + <!-- + uncomment to enable enhanced cucumber-jvm reporting + http://www.masterthought.net/section/cucumber-reporting + <dependency> + <groupId>com.googlecode.totallylazy</groupId> + <artifactId>totallylazy</artifactId> + <version>991</version> + </dependency> + + <dependency> + <groupId>net.masterthought</groupId> + <artifactId>cucumber-reporting</artifactId> + <version>0.0.21</version> + </dependency> + <dependency> + <groupId>net.masterthought</groupId> + <artifactId>maven-cucumber-reporting</artifactId> + <version>0.0.4</version> + </dependency> + --> + </dependencies> + + <!-- + uncomment for enhanced cucumber-jvm reporting + http://www.masterthought.net/section/cucumber-reporting + <repositories> + <repository> + <id>repo.bodar.com</id> + <url>http://repo.bodar.com</url> + </repository> + </repositories> + --> + + +</project> http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/integtests/src/test/java/integration/ToDoAppSystemInitializer.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/integtests/src/test/java/integration/ToDoAppSystemInitializer.java b/mothballed/example/application/todoapp/integtests/src/test/java/integration/ToDoAppSystemInitializer.java new file mode 100644 index 0000000..3e21d50 --- /dev/null +++ b/mothballed/example/application/todoapp/integtests/src/test/java/integration/ToDoAppSystemInitializer.java @@ -0,0 +1,77 @@ +/** + * 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 integration; + +import org.apache.isis.core.commons.config.IsisConfiguration; +import org.apache.isis.core.integtestsupport.IsisSystemForTest; +import org.apache.isis.core.runtime.persistence.PersistenceConstants; +import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller; +import org.apache.isis.objectstore.jdo.datanucleus.IsisConfigurationForJdoIntegTests; + +/** + * Holds an instance of an {@link IsisSystemForTest} as a {@link ThreadLocal} on the current thread, + * initialized with ToDo app's domain services. + */ +public class ToDoAppSystemInitializer { + + private ToDoAppSystemInitializer(){} + + public static IsisSystemForTest initIsft() { + IsisSystemForTest isft = IsisSystemForTest.getElseNull(); + if(isft == null) { + isft = new ToDoSystemBuilder().build().setUpSystem(); + IsisSystemForTest.set(isft); + } + return isft; + } + + private static class ToDoSystemBuilder extends IsisSystemForTest.Builder { + + public ToDoSystemBuilder() { + withLoggingAt(org.apache.log4j.Level.INFO); + with(testConfiguration()); + with(new DataNucleusPersistenceMechanismInstaller()); + + // services annotated with @DomainService + withServicesIn("app" + ,"dom.todo" + ,"fixture.todo" + ,"webapp.admin" + ,"webapp.prototyping" + ,"org.apache.isis.core.wrapper" + ,"org.apache.isis.applib" + ,"org.apache.isis.core.metamodel.services" + ,"org.apache.isis.core.runtime.services" + ,"org.apache.isis.objectstore.jdo.datanucleus.service.support" // IsisJdoSupportImpl + ,"org.apache.isis.objectstore.jdo.datanucleus.service.eventbus" // EventBusServiceJdo + ); + } + + private static IsisConfiguration testConfiguration() { + final IsisConfigurationForJdoIntegTests testConfiguration = new IsisConfigurationForJdoIntegTests(); + testConfiguration.addRegisterEntitiesPackagePrefix("dom"); + + // enable stricter checking + // + // the consequence of this is having to call 'nextTransaction()' between most of the given/when/then's + // because the command2 only ever refers to the event of the originating action. + testConfiguration.put(PersistenceConstants.ENFORCE_SAFE_SEMANTICS, "true"); + + return testConfiguration; + } + } +} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/integtests/src/test/java/integration/glue/BootstrappingGlue.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/integtests/src/test/java/integration/glue/BootstrappingGlue.java b/mothballed/example/application/todoapp/integtests/src/test/java/integration/glue/BootstrappingGlue.java new file mode 100644 index 0000000..9aae79c --- /dev/null +++ b/mothballed/example/application/todoapp/integtests/src/test/java/integration/glue/BootstrappingGlue.java @@ -0,0 +1,53 @@ +/** + * 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 integration.glue; + +import cucumber.api.java.After; +import cucumber.api.java.Before; +import integration.ToDoAppSystemInitializer; + +import org.apache.isis.core.specsupport.scenarios.ScenarioExecutionScope; +import org.apache.isis.core.specsupport.specs.CukeGlueAbstract; + +public class BootstrappingGlue extends CukeGlueAbstract { + + // ////////////////////////////////////// + + @Before(value={"@unit"}, order=100) + public void beforeScenarioUnitScope() { + before(ScenarioExecutionScope.UNIT); + } + + @Before(value={"@integration"}, order=100) + public void beforeScenarioIntegrationScope() { + org.apache.log4j.PropertyConfigurator.configure("logging.properties"); + ToDoAppSystemInitializer.initIsft(); + + before(ScenarioExecutionScope.INTEGRATION); + } + + @After + public void afterScenario(cucumber.api.Scenario sc) { + assertMocksSatisfied(); + after(sc); + } + + // ////////////////////////////////////// + + + +} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java b/mothballed/example/application/todoapp/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java new file mode 100644 index 0000000..01e5776 --- /dev/null +++ b/mothballed/example/application/todoapp/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java @@ -0,0 +1,47 @@ +/** + * 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 integration.glue; + +import cucumber.api.java.Before; +import dom.todo.ToDoItem; +import fixture.todo.integtests.ToDoItemsIntegTestFixture; + +import org.apache.isis.core.specsupport.scenarios.InMemoryDB; +import org.apache.isis.core.specsupport.specs.CukeGlueAbstract; + +public class CatalogOfFixturesGlue extends CukeGlueAbstract { + + + @Before(value={"@unit", "@ToDoItemsFixture"}, order=20000) + public void unitFixtures() throws Throwable { + final InMemoryDB inMemoryDB = new InMemoryDBForToDoApp(this.scenarioExecution()); + inMemoryDB.getElseCreate(ToDoItem.class, "Write blog post"); + inMemoryDB.getElseCreate(ToDoItem.class, "Pick up bread"); + final ToDoItem t3 = inMemoryDB.getElseCreate(ToDoItem.class, "Pick up butter"); + t3.setComplete(true); + putVar("isis", "in-memory-db", inMemoryDB); + } + + // ////////////////////////////////////// + + @Before(value={"@integration", "@ToDoItemsFixture"}, order=20000) + public void integrationFixtures() throws Throwable { + scenarioExecution().install(new ToDoItemsIntegTestFixture()); + } + + +} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/integtests/src/test/java/integration/glue/InMemoryDBForToDoApp.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/integtests/src/test/java/integration/glue/InMemoryDBForToDoApp.java b/mothballed/example/application/todoapp/integtests/src/test/java/integration/glue/InMemoryDBForToDoApp.java new file mode 100644 index 0000000..04dcfb6 --- /dev/null +++ b/mothballed/example/application/todoapp/integtests/src/test/java/integration/glue/InMemoryDBForToDoApp.java @@ -0,0 +1,40 @@ +/** + * 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 integration.glue; + +import dom.todo.ToDoItem; + +import org.apache.isis.core.specsupport.scenarios.InMemoryDB; +import org.apache.isis.core.specsupport.scenarios.ScenarioExecution; + +public class InMemoryDBForToDoApp extends InMemoryDB { + + public InMemoryDBForToDoApp(ScenarioExecution scenarioExecution) { + super(scenarioExecution); + } + + /** + * Hook to initialize if possible. + */ + @Override + protected void init(Object obj, String str) { + if(obj instanceof ToDoItem) { + ToDoItem toDoItem = (ToDoItem) obj; + toDoItem.setDescription(str); + } + } +} \ No newline at end of file
