You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/07/25 11:30:00 UTC
[42/48] isis git commit: ISIS-1178: mothballing the tck tests.
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/ObjectImmutableTest.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/ObjectImmutableTest.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/ObjectImmutableTest.java
new file mode 100644
index 0000000..36662fa
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/ObjectImmutableTest.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.core.integtestsupport.legacy;
+
+import static org.apache.isis.core.commons.matchers.IsisMatchers.classEqualTo;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
+import org.apache.isis.applib.services.wrapper.DisabledException;
+import org.apache.isis.core.metamodel.facets.collections.disabled.fromimmutable.DisabledFacetOnCollectionDerivedFromImmutable;
+import org.apache.isis.core.metamodel.facets.properties.disabled.fromimmutable.DisabledFacetOnPropertyDerivedFromImmutable;
+
+public class ObjectImmutableTest extends AbstractTest {
+
+ @Test
+ public void settingValueOnImmutableObjectThrowsException() {
+ try {
+ product355WO.setDescription("Changed");
+ fail("Should have thrown exception");
+ } catch (final DisabledException ex) {
+ assertThat(ex.getAdvisorClass(), classEqualTo(DisabledFacetOnPropertyDerivedFromImmutable.class));
+ assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Description"));
+ }
+ }
+
+ @Test
+ public void settingAssociationOnImmutableObjectThrowsException() {
+ try {
+ product355WO.setPlaceOfManufacture(countryUsaDO);
+ fail("Should have thrown exception");
+ } catch (final DisabledException ex) {
+ assertThat(ex.getAdvisorClass(), classEqualTo(DisabledFacetOnPropertyDerivedFromImmutable.class));
+ assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Place Of Manufacture"));
+ }
+ }
+
+ @Test
+ public void addingToCollectionOnImmutableObjectThrowsException() {
+ try {
+ product355WO.addToSimilarProducts(product850DO);
+ fail("Should have thrown exception");
+ } catch (final DisabledException ex) {
+ assertThat(ex.getAdvisorClass(), classEqualTo(DisabledFacetOnCollectionDerivedFromImmutable.class));
+ assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Similar Products"));
+ }
+ }
+
+ @Test
+ public void removingFromCollectionOnImmutableObjectThrowsException() {
+ product355DO.addToSimilarProducts(product850DO); // TODO: can't setup,
+ // throws
+ // ObjectPersistenceException
+ try {
+ product355WO.removeFromSimilarProducts(product850DO);
+ fail("Should have thrown exception");
+ } catch (final DisabledException ex) {
+ assertThat(ex.getAdvisorClass(), classEqualTo(DisabledFacetOnCollectionDerivedFromImmutable.class));
+ assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Similar Products"));
+ }
+ }
+
+ @Test
+ public void canInvokingOnImmutableObject() {
+ product355WO.foobar();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/SaveObjectsTest.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/SaveObjectsTest.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/SaveObjectsTest.java
new file mode 100644
index 0000000..bd1d7db
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/SaveObjectsTest.java
@@ -0,0 +1,113 @@
+/*
+ * 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.core.integtestsupport.legacy;
+
+import static org.apache.isis.core.commons.matchers.IsisMatchers.classEqualTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import org.hamcrest.Matchers;
+import org.junit.Test;
+
+import org.apache.isis.applib.services.wrapper.InvalidException;
+import org.apache.isis.applib.services.wrapper.WrapperObject;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Customer;
+import org.apache.isis.core.metamodel.facets.object.validating.validateobject.method.ValidateObjectFacetMethod;
+
+public class SaveObjectsTest extends AbstractTest {
+
+ private WrapperObject asWrapperObject(final Customer proxiedNewCustomer) {
+ return (WrapperObject) proxiedNewCustomer;
+ }
+
+ @Test
+ public void invokingSaveThroughProxyMakesTransientObjectPersistent() {
+ final Customer newCustomer = getDomainObjectContainer().newTransientInstance(Customer.class);
+ assertThat(getDomainObjectContainer().isPersistent(newCustomer), is(false));
+ final Customer newCustomerVO = getWrapperFactory().wrap(newCustomer);
+ newCustomerVO.setCustomerNumber(123);
+ newCustomerVO.setFirstNameMandatory("Joe");
+ newCustomerVO.setLastName("Smith");
+ newCustomerVO.setMandatoryAssociation(countryGbrDO);
+ newCustomerVO.setCountryOfBirthMandatory(countryGbrDO);
+ newCustomerVO.setMandatoryValue("foo");
+ newCustomerVO.setMaxLengthField("abc");
+ newCustomerVO.setRegExCaseInsensitiveField("ABCd");
+ newCustomerVO.setRegExCaseSensitiveField("abcd");
+ final WrapperObject proxyNewCustomer = asWrapperObject(newCustomerVO);
+ proxyNewCustomer.save();
+ assertThat(getDomainObjectContainer().isPersistent(newCustomer), is(true));
+ }
+
+ @Test
+ public void invokingSaveOnThroughProxyOnAlreadyPersistedObjectJustUpdatesIt() {
+ // just to get into valid state
+ custJsDO.setCustomerNumber(123);
+ custJsDO.setFirstNameMandatory("Joe");
+ custJsDO.setLastName("Smith");
+ custJsDO.setMandatoryAssociation(countryGbrDO);
+ custJsDO.setCountryOfBirthMandatory(countryGbrDO);
+ custJsDO.setMandatoryValue("foo");
+ custJsDO.setMaxLengthField("abc");
+ custJsDO.setRegExCaseInsensitiveField("ABCd");
+ custJsDO.setRegExCaseSensitiveField("abcd");
+
+ assertThat(getDomainObjectContainer().isPersistent(custJsDO), is(true));
+
+ final WrapperObject newCustomerWO = asWrapperObject(custJsWO);
+ newCustomerWO.save();
+
+ assertThat(getDomainObjectContainer().isPersistent(custJsDO), is(true));
+ }
+
+ @Test
+ public void whenValidateMethodThenCanVetoSave() {
+ final Customer newCustomer = getDomainObjectContainer().newTransientInstance(Customer.class);
+
+ // just to get into valid state
+ newCustomer.setCustomerNumber(123);
+ newCustomer.setFirstNameMandatory("Joe");
+ newCustomer.setLastName("Smith");
+ newCustomer.setCountryOfBirthMandatory(countryGbrDO);
+ newCustomer.setMandatoryAssociation(countryGbrDO);
+ newCustomer.setMandatoryValue("foo");
+ newCustomer.setMaxLengthField("abc");
+ newCustomer.setRegExCaseInsensitiveField("ABCd");
+ newCustomer.setRegExCaseSensitiveField("abcd");
+
+ final Customer newCustomerWO = getWrapperFactory().wrap(newCustomer);
+ newCustomer.validate = "No shakes";
+
+ final WrapperObject newCustomerWrapper = asWrapperObject(newCustomerWO);
+ try {
+ assertThat(getDomainObjectContainer().isPersistent(newCustomer), is(false));
+ newCustomerWrapper.save();
+ fail("An InvalidImperativelyException should have been thrown");
+ } catch (final InvalidException ex) {
+
+ assertThat(ex.getAdvisorClass(), classEqualTo(ValidateObjectFacetMethod.class));
+ assertThat(getDomainObjectContainer().isPersistent(newCustomer), is(false)); // not
+ // saved
+ assertThat(ex.getMessage(), Matchers.containsString("No shakes"));
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/TitleTest.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/TitleTest.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/TitleTest.java
new file mode 100644
index 0000000..4586751
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/TitleTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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.core.integtestsupport.legacy;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class TitleTest extends AbstractTest {
+
+ @Test
+ public void shouldAppendToDocumentor() {
+ assertThat(custJsWO.title(), equalTo("Richard Pawson"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/ViewObjectTest.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/ViewObjectTest.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/ViewObjectTest.java
new file mode 100644
index 0000000..492522f
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/ViewObjectTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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.core.integtestsupport.legacy;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import org.apache.isis.applib.services.wrapper.WrapperObject;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Country;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Customer;
+
+public class ViewObjectTest extends AbstractTest {
+
+ private WrapperObject asWrapperObject() {
+ return (WrapperObject) custJsWO;
+ }
+
+ @Test
+ public void canCastViewsToViewObject() {
+ @SuppressWarnings("unused")
+ final WrapperObject custRpVOAsViewObject = asWrapperObject();
+ }
+
+ @Test
+ public void shouldBeAbleToCreateAView() {
+ final Customer custRpVO = getWrapperFactory().wrap(custJsDO);
+ assertThat(custRpVO, instanceOf(Customer.class));
+ custRpVO.setFirstName("Dick");
+
+ assertThat("Dick", equalTo(custRpVO.getFirstName()));
+ }
+
+ @Test
+ public void viewShouldPassesThroughSetterToUnderlyingDomainObject() {
+ final Customer custRpVO = getWrapperFactory().wrap(custJsDO);
+ custRpVO.setFirstName("Dick");
+
+ assertThat("Dick", equalTo(custRpVO.getFirstName()));
+ }
+
+ @Test
+ public void objectIsViewShouldReturnTrueWhenDealingWithView() {
+ final Customer custRpVO = getWrapperFactory().wrap(custJsDO);
+ assertThat(getWrapperFactory().isWrapper(custRpVO), is(true));
+ }
+
+ @Test
+ public void objectIsViewShouldReturnFalseWhenDealingWithUnderlying() {
+ assertThat(getWrapperFactory().isWrapper(custJsDO), is(false));
+ }
+
+ @Test
+ public void collectionInstanceOfViewObjectShouldReturnTrueWhenDealingWithView() {
+ custJsDO.addToVisitedCountries(countryGbrDO);
+ custJsDO.addToVisitedCountries(countryUsaDO);
+ final List<Country> visitedCountries = custJsWO.getVisitedCountries();
+ assertThat(visitedCountries instanceof WrapperObject, is(true));
+ }
+
+ @Test
+ public void containsOnViewedCollectionShouldIntercept() {
+ custJsDO.addToVisitedCountries(countryGbrDO);
+ custJsDO.addToVisitedCountries(countryUsaDO);
+ final List<Country> visitedCountries = custJsWO.getVisitedCountries();
+ assertThat(visitedCountries.contains(countryGbrDO), is(true));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Country.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Country.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Country.java
new file mode 100644
index 0000000..629f986
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Country.java
@@ -0,0 +1,155 @@
+/*
+ * 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.core.integtestsupport.legacy.sample.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.AbstractDomainObject;
+import org.apache.isis.applib.annotation.Bounded;
+import org.apache.isis.applib.annotation.MaxLength;
+import org.apache.isis.applib.annotation.Optional;
+import org.apache.isis.applib.annotation.TypicalLength;
+import org.apache.isis.applib.util.TitleBuffer;
+
+@Bounded
+public class Country extends AbstractDomainObject {
+
+ // {{ Logger
+ @SuppressWarnings("unused")
+ private final static Logger LOGGER = LoggerFactory.getLogger(Country.class);
+
+ // }}
+
+ // {{ Identification Methods
+ /**
+ * Defines the title that will be displayed on the user interface in order
+ * to identity this object.
+ */
+ public String title() {
+ final TitleBuffer t = new TitleBuffer();
+ t.append(getName());
+ return t.toString();
+ }
+
+ // }}
+
+ // {{ Code
+ private String code;
+
+ @TypicalLength(3)
+ @MaxLength(3)
+ public String getCode() {
+ return this.code;
+ }
+
+ public void setCode(final String code) {
+ this.code = code;
+ }
+
+ // }}
+
+ // {{ Name
+ private String name;
+
+ @TypicalLength(50)
+ @MaxLength(255)
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ // }}
+
+ // {{ FavouriteHolidayDestination
+ private Country favouriteHolidayDestination;
+
+ @Optional
+ public Country getFavouriteHolidayDestination() {
+ return favouriteHolidayDestination;
+ }
+
+ public void setFavouriteHolidayDestination(final Country favouriteHolidayDestination) {
+ this.favouriteHolidayDestination = favouriteHolidayDestination;
+ }
+
+ // }}
+
+ // {{ Colonies
+ private List<Country> colonies = new ArrayList<Country>();
+
+ public List<Country> getColonies() {
+ return this.colonies;
+ }
+
+ @SuppressWarnings("unused")
+ private void setColonies(final List<Country> colonies) {
+ this.colonies = colonies;
+ }
+
+ public void addToColonies(final Country country) {
+ getColonies().add(country);
+ }
+
+ public void removeFromColonies(final Country country) {
+ getColonies().remove(country);
+ }
+
+ public String validateAddToColonies;
+
+ public String validateAddToColonies(final Country country) {
+ return validateAddToColonies;
+ }
+
+ public String validateRemoveFromColonies;
+
+ public String validateRemoveFromColonies(final Country country) {
+ return validateRemoveFromColonies;
+ }
+
+ public String disableColonies;
+
+ public String disableColonies() {
+ return this.disableColonies;
+ }
+
+ public boolean hideColonies;
+
+ public boolean hideColonies() {
+ return this.hideColonies;
+ }
+
+ // }}
+
+ // {{
+ /**
+ * An action to invoke
+ */
+ public void foobar() {
+ }
+ // }}
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Customer.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Customer.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Customer.java
new file mode 100644
index 0000000..fbdf27a
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Customer.java
@@ -0,0 +1,889 @@
+/*
+ * 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.core.integtestsupport.legacy.sample.domain;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.isis.applib.AbstractDomainObject;
+import org.apache.isis.applib.annotation.DescribedAs;
+import org.apache.isis.applib.annotation.Disabled;
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.isis.applib.annotation.MaxLength;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.Optional;
+import org.apache.isis.applib.annotation.RegEx;
+import org.apache.isis.applib.annotation.TypicalLength;
+import org.apache.isis.applib.annotation.When;
+import org.apache.isis.applib.clock.Clock;
+import org.apache.isis.applib.security.UserMemento;
+import org.apache.isis.applib.util.TitleBuffer;
+
+public class Customer extends AbstractDomainObject {
+
+ // {{ Identification Methods
+ /**
+ * Defines the title that will be displayed on the user interface in order
+ * to identity this object.
+ */
+ public String title() {
+ final TitleBuffer t = new TitleBuffer();
+ t.append(getFirstName()).append(getLastName());
+ return t.toString();
+ }
+ // }}
+
+
+ // {{ FirstName
+ private String firstName;
+
+ @DescribedAs("Given or christian name")
+ @TypicalLength(20)
+ @MaxLength(100)
+ @Optional
+ public String getFirstName() {
+ return this.firstName;
+ }
+
+ public void setFirstName(final String firstName) {
+ this.firstName = firstName;
+ }
+
+ public boolean modifyFirstNameCalled = false;
+
+ public void modifyFirstName(final String firstName) {
+ setFirstName(firstName);
+ this.modifyFirstNameCalled = true;
+ }
+
+ public boolean clearFirstNameCalled = false;
+
+ public void clearFirstName() {
+ setFirstName(null);
+ this.clearFirstNameCalled = true;
+ }
+
+ public String validateFirstName;
+ public String validateFirstNameExpectedArg;
+
+ public String validateFirstName(final String firstName) {
+ if (validateFirstNameExpectedArg != null && !validateFirstNameExpectedArg.equals(firstName)) {
+ return "argument provided by XAT framework was incorrect";
+ }
+ return validateFirstName;
+ }
+
+ public String disableFirstName;
+
+ public String disableFirstName() {
+ return this.disableFirstName;
+ }
+
+ public boolean hideFirstName;
+
+ public boolean hideFirstName() {
+ return this.hideFirstName;
+ }
+
+ // }}
+
+
+
+ // {{ FirstNameMandatory
+ private String firstNameMandatory;
+
+ @DescribedAs("Given or christian name")
+ @TypicalLength(20)
+ @MaxLength(100)
+ public String getFirstNameMandatory() {
+ return this.firstNameMandatory;
+ }
+
+ public void setFirstNameMandatory(final String firstNameMandatory) {
+ this.firstNameMandatory = firstNameMandatory;
+ }
+
+ public boolean modifyFirstNameMandatoryCalled = false;
+
+ public void modifyFirstNameMandatory(final String firstNameMandatory) {
+ setFirstNameMandatory(firstNameMandatory);
+ this.modifyFirstNameMandatoryCalled = true;
+ }
+
+ public boolean clearFirstNameMandatoryCalled = false;
+
+ public void clearFirstNameMandatory() {
+ setFirstNameMandatory(null);
+ this.clearFirstNameMandatoryCalled = true;
+ }
+
+ public String validateFirstNameMandatory;
+ public String validateFirstNameMandatoryExpectedArg;
+
+ public String validateFirstNameMandatory(final String firstNameMandatory) {
+ if (validateFirstNameMandatoryExpectedArg != null && !validateFirstNameMandatoryExpectedArg.equals(firstNameMandatory)) {
+ return "argument provided by XAT framework was incorrect";
+ }
+ return validateFirstNameMandatory;
+ }
+
+ public String disableFirstNameMandatory;
+
+ public String disableFirstNameMandatory() {
+ return this.disableFirstNameMandatory;
+ }
+
+ public boolean hideFirstNameMandatory;
+
+ public boolean hideFirstNameMandatory() {
+ return this.hideFirstNameMandatory;
+ }
+
+ // }}
+
+
+
+
+
+
+ // {{ CountryOfBirth
+ private Country countryOfBirth;
+
+ @Optional
+ public Country getCountryOfBirth() {
+ return countryOfBirth;
+ }
+
+ public void setCountryOfBirth(final Country countryOfBirth) {
+ this.countryOfBirth = countryOfBirth;
+ }
+
+ public boolean modifyCountryOfBirthCalled = false;
+
+ public void modifyCountryOfBirth(final Country countryOfBirth) {
+ setCountryOfBirth(countryOfBirth);
+ this.modifyCountryOfBirthCalled = true;
+ }
+
+ public boolean clearCountryOfBirthCalled = false;
+
+ public void clearCountryOfBirth() {
+ setCountryOfBirth(null);
+ this.clearCountryOfBirthCalled = true;
+ }
+
+ public String validateCountryOfBirth;
+
+ public String validateCountryOfBirth(final Country countryOfBirth) {
+ return validateCountryOfBirth;
+ }
+
+ public String disableCountryOfBirth;
+
+ public String disableCountryOfBirth() {
+ return this.disableCountryOfBirth;
+ }
+
+ public boolean hideCountryOfBirth;
+
+ public boolean hideCountryOfBirth() {
+ return this.hideCountryOfBirth;
+ }
+
+ // }}
+
+
+
+
+ // {{ CountryOfBirthMandatory
+ private Country countryOfBirthMandatory;
+
+ public Country getCountryOfBirthMandatory() {
+ return countryOfBirthMandatory;
+ }
+
+ public void setCountryOfBirthMandatory(final Country countryOfBirthMandatory) {
+ this.countryOfBirthMandatory = countryOfBirthMandatory;
+ }
+
+ public boolean modifyCountryOfBirthMandatoryCalled = false;
+
+ public void modifyCountryOfBirthMandatory(final Country countryOfBirthMandatory) {
+ setCountryOfBirthMandatory(countryOfBirthMandatory);
+ this.modifyCountryOfBirthMandatoryCalled = true;
+ }
+
+ public boolean clearCountryOfBirthMandatoryCalled = false;
+
+ public void clearCountryOfBirthMandatory() {
+ setCountryOfBirthMandatory(null);
+ this.clearCountryOfBirthMandatoryCalled = true;
+ }
+
+ public String validateCountryOfBirthMandatory;
+
+ public String validateCountryOfBirthMandatory(final Country countryOfBirthMandatory) {
+ return validateCountryOfBirthMandatory;
+ }
+
+ public String disableCountryOfBirthMandatory;
+
+ public String disableCountryOfBirthMandatory() {
+ return this.disableCountryOfBirthMandatory;
+ }
+
+ public boolean hideCountryOfBirthMandatory;
+
+ public boolean hideCountryOfBirthMandatory() {
+ return this.hideCountryOfBirthMandatory;
+ }
+
+ // }}
+
+
+
+
+
+
+ // {{ VisitedCountries
+ private List<Country> visitedCountries = new ArrayList<Country>();
+
+ public List<Country> getVisitedCountries() {
+ return this.visitedCountries;
+ }
+
+ @SuppressWarnings("unused")
+ private void setVisitedCountries(final List<Country> visitedCountries) {
+ this.visitedCountries = visitedCountries;
+ }
+
+ public void addToVisitedCountries(final Country country) {
+ getVisitedCountries().add(country);
+ }
+
+ public void removeFromVisitedCountries(final Country country) {
+ getVisitedCountries().remove(country);
+ }
+
+ public String validateAddToVisitedCountries;
+
+ public String validateAddToVisitedCountries(final Country country) {
+ return validateAddToVisitedCountries;
+ }
+
+ public String validateRemoveFromVisitedCountries;
+
+ public String validateRemoveFromVisitedCountries(final Country country) {
+ return validateRemoveFromVisitedCountries;
+ }
+
+ public String disableVisitedCountries;
+
+ public String disableVisitedCountries() {
+ return this.disableVisitedCountries;
+ }
+
+ public boolean hideVisitedCountries;
+
+ public boolean hideVisitedCountries() {
+ return this.hideVisitedCountries;
+ }
+
+ // }}
+
+ // {{ AlwaysDisabledValue
+ private String alwaysDisabledValue;
+
+ @Disabled(when = When.ALWAYS)
+ public String getAlwaysDisabledValue() {
+ return this.alwaysDisabledValue;
+ }
+
+ public void setAlwaysDisabledValue(final String alwaysDisabled) {
+ this.alwaysDisabledValue = alwaysDisabled;
+ }
+
+ // }}
+
+ // {{ AlwaysDisabledAssociation
+ private Country alwaysDisabledAssociation;
+
+ @Disabled(when = When.ALWAYS)
+ public Country getAlwaysDisabledAssociation() {
+ return this.alwaysDisabledAssociation;
+ }
+
+ public void setAlwaysDisabledAssociation(final Country alwaysDisabled) {
+ this.alwaysDisabledAssociation = alwaysDisabled;
+ }
+
+ // }}
+
+ // {{ AlwaysDisabledCollection
+ private List<Country> alwaysDisabledCollection = new ArrayList<Country>();
+
+ @Disabled(when = When.ALWAYS)
+ public List<Country> getAlwaysDisabledCollection() {
+ return this.alwaysDisabledCollection;
+ }
+
+ @SuppressWarnings("unused")
+ private void setAlwaysDisabledCollection(final List<Country> alwaysDisabledCollection) {
+ this.alwaysDisabledCollection = alwaysDisabledCollection;
+ }
+
+ public void addToAlwaysDisabledCollection(final Country country) {
+ getAlwaysDisabledCollection().add(country);
+ }
+
+ public void removeFromAlwaysDisabledCollection(final Country country) {
+ getAlwaysDisabledCollection().remove(country);
+ }
+
+ // }}
+
+ // {{ AlwaysDisabledAction
+ @Disabled(when = When.ALWAYS)
+ public void alwaysDisabledAction() {
+ }
+
+ // }}
+
+ // {{ SessionDisabledValue
+ private String sessionDisabledValue;
+
+ public String getSessionDisabledValue() {
+ return this.sessionDisabledValue;
+ }
+
+ public void setSessionDisabledValue(final String sessionDisabled) {
+ this.sessionDisabledValue = sessionDisabled;
+ }
+
+ public static String disableSessionDisabledValue(final UserMemento user) {
+ return "disabled for this user";
+ }
+
+ // }}
+
+ // {{ SessionDisabledAssociation
+ private Country sessionDisabledAssociation;
+
+ public Country getSessionDisabledAssociation() {
+ return this.sessionDisabledAssociation;
+ }
+
+ public void setSessionDisabledAssociation(final Country sessionDisabled) {
+ this.sessionDisabledAssociation = sessionDisabled;
+ }
+
+ public static String disableSessionDisabledAssociation(final UserMemento user) {
+ return "disabled for this user";
+ }
+
+ // }}
+
+ // {{ SessionDisabledCollection
+ private List<Country> sessionDisabledCollection = new ArrayList<Country>();
+
+ public List<Country> getSessionDisabledCollection() {
+ return this.sessionDisabledCollection;
+ }
+
+ @SuppressWarnings("unused")
+ private void setSessionDisabledCollection(final List<Country> sessionDisabledCollection) {
+ this.sessionDisabledCollection = sessionDisabledCollection;
+ }
+
+ public void addToSessionDisabledCollection(final Country country) {
+ getSessionDisabledCollection().add(country);
+ }
+
+ public void removeFromSessionDisabledCollection(final Country country) {
+ getSessionDisabledCollection().remove(country);
+ }
+
+ public static String disableSessionDisabledCollection(final UserMemento user) {
+ return "disabled for this user";
+ }
+
+ // }}
+
+ // {{ SessionDisabledAction
+ public void sessionDisabledAction() {
+ }
+
+ public static String disableSessionDisabledAction(final UserMemento user) {
+ return "disabled for this user";
+ }
+
+ // }}
+
+ // {{ AlwaysHiddenValue
+ private String alwaysHiddenValue;
+
+ @Hidden(when=When.ALWAYS)
+ public String getAlwaysHiddenValue() {
+ return this.alwaysHiddenValue;
+ }
+
+ public void setAlwaysHiddenValue(final String alwaysHidden) {
+ this.alwaysHiddenValue = alwaysHidden;
+ }
+
+ // }}
+
+ // {{ AlwaysHiddenAssociation
+ private Country alwaysHiddenAssociation;
+
+ @Hidden(when=When.ALWAYS)
+ public Country getAlwaysHiddenAssociation() {
+ return this.alwaysHiddenAssociation;
+ }
+
+ public void setAlwaysHiddenAssociation(final Country alwaysHidden) {
+ this.alwaysHiddenAssociation = alwaysHidden;
+ }
+
+ // }}
+
+ // {{ AlwaysHiddenCollection
+ private List<Country> alwaysHiddenCollection = new ArrayList<Country>();
+
+ @Hidden(when=When.ALWAYS)
+ public List<Country> getAlwaysHiddenCollection() {
+ return this.alwaysHiddenCollection;
+ }
+
+ @SuppressWarnings("unused")
+ private void setAlwaysHiddenCollection(final List<Country> alwaysHiddenCollection) {
+ this.alwaysHiddenCollection = alwaysHiddenCollection;
+ }
+
+ public void addToAlwaysHiddenCollection(final Country country) {
+ getAlwaysHiddenCollection().add(country);
+ }
+
+ public void removeFromAlwaysHiddenCollection(final Country country) {
+ getAlwaysHiddenCollection().remove(country);
+ }
+
+ // }}
+
+ // {{ SessionDisabledAction
+ @Hidden(when=When.ALWAYS)
+ public void alwaysHiddenAction() {
+ }
+
+ // }}
+
+ // {{ SessionHiddenValue
+ private String sessionHiddenValue;
+
+ public String getSessionHiddenValue() {
+ return this.sessionHiddenValue;
+ }
+
+ public void setSessionHiddenValue(final String sessionHidden) {
+ this.sessionHiddenValue = sessionHidden;
+ }
+
+ public static boolean hideSessionHiddenValue(final UserMemento user) {
+ return true;
+ }
+
+ // }}
+
+ // {{ SessionHiddenAssociation
+ private Country sessionHiddenAssociation;
+
+ public Country getSessionHiddenAssociation() {
+ return this.sessionHiddenAssociation;
+ }
+
+ public void setSessionHiddenAssociation(final Country sessionHidden) {
+ this.sessionHiddenAssociation = sessionHidden;
+ }
+
+ public static boolean hideSessionHiddenAssociation(final UserMemento user) {
+ return true;
+ }
+
+ // }}
+
+ // {{ SessionHiddenCollection
+ private List<Country> sessionHiddenCollection = new ArrayList<Country>();
+
+ public List<Country> getSessionHiddenCollection() {
+ return this.sessionHiddenCollection;
+ }
+
+ @SuppressWarnings("unused")
+ private void setSessionHiddenCollection(final List<Country> sessionHiddenCollection) {
+ this.sessionHiddenCollection = sessionHiddenCollection;
+ }
+
+ public void addToSessionHiddenCollection(final Country country) {
+ getSessionHiddenCollection().add(country);
+ }
+
+ public void removeFromSessionHiddenCollection(final Country country) {
+ getSessionHiddenCollection().remove(country);
+ }
+
+ public static boolean hideSessionHiddenCollection(final UserMemento user) {
+ return true;
+ }
+
+ // }}
+
+ // {{ SessionHiddenAction
+ public void sessionHiddenAction() {
+ }
+
+ public static boolean hideSessionHiddenAction(final UserMemento user) {
+ return true;
+ }
+
+ // }}
+
+ // {{ Mandatory
+ private String mandatoryValue;
+
+ public String getMandatoryValue() {
+ return this.mandatoryValue;
+ }
+
+ public void setMandatoryValue(final String mandatory) {
+ this.mandatoryValue = mandatory;
+ }
+
+ // }}
+
+ // {{ Mandatory
+ private Country mandatoryAssociation;
+
+ public Country getMandatoryAssociation() {
+ return this.mandatoryAssociation;
+ }
+
+ public void setMandatoryAssociation(final Country mandatory) {
+ this.mandatoryAssociation = mandatory;
+ }
+
+ // }}
+
+ // {{ Optional
+ private String optionalValue;
+
+ @Optional
+ public String getOptionalValue() {
+ return this.optionalValue;
+ }
+
+ public void setOptionalValue(final String optional) {
+ this.optionalValue = optional;
+ }
+
+ // }}
+
+ // {{ OptionalAssociation
+ private Country optionalAssociation;
+
+ @Optional
+ public Country getOptionalAssociation() {
+ return this.optionalAssociation;
+ }
+
+ public void setOptionalAssociation(final Country optional) {
+ this.optionalAssociation = optional;
+ }
+
+ // }}
+
+ // {{ OptionalCollection
+ private List<Country> optionalCollection = new ArrayList<Country>();
+
+ @Optional
+ public List<Country> getOptionalCollection() {
+ return this.optionalCollection;
+ }
+
+ @SuppressWarnings("unused")
+ private void setOptionalCollection(final List<Country> optionalCollection) {
+ this.optionalCollection = optionalCollection;
+ }
+
+ public void addToOptionalCollection(final Country country) {
+ getOptionalCollection().add(country);
+ }
+
+ public void removeFromOptionalCollection(final Country country) {
+ getOptionalCollection().remove(country);
+ }
+
+ // }}
+
+ // {{ MaxLength
+ private String maxLengthField;
+
+ @MaxLength(10)
+ public String getMaxLengthField() {
+ return this.maxLengthField;
+ }
+
+ public void setMaxLengthField(final String maxLength) {
+ this.maxLengthField = maxLength;
+ }
+
+ // }}
+
+ // {{ RegExCaseSensitive
+ private String regExCaseSensitiveField;
+
+ @RegEx(validation = "abc.+", caseSensitive = true)
+ public String getRegExCaseSensitiveField() {
+ return this.regExCaseSensitiveField;
+ }
+
+ public void setRegExCaseSensitiveField(final String regEx) {
+ this.regExCaseSensitiveField = regEx;
+ }
+
+ // }}
+
+ // {{ RegExCaseInsensitive
+ private String regExCaseInsensitiveField;
+
+ @RegEx(validation = "abc.+", caseSensitive = false)
+ public String getRegExCaseInsensitiveField() {
+ return this.regExCaseInsensitiveField;
+ }
+
+ public void setRegExCaseInsensitiveField(final String regExCaseInsensitive) {
+ this.regExCaseInsensitiveField = regExCaseInsensitive;
+ }
+
+ // }}
+
+ // {{ LastName
+ private String lastName;
+
+ @DescribedAs("Family name or surname")
+ @MaxLength(100)
+ @TypicalLength(30)
+ @Named("Surname")
+ public String getLastName() {
+ return this.lastName;
+ }
+
+ public void setLastName(final String lastName) {
+ this.lastName = lastName;
+ }
+
+ public void modifyLastName(final String lastName) {
+ this.lastName = lastName;
+ }
+
+ // }}
+
+ // {{ CustomerNumber
+ private Integer customerNumber;
+
+ @Disabled(when = When.ONCE_PERSISTED)
+ public Integer getCustomerNumber() {
+ return this.customerNumber;
+ }
+
+ public void setCustomerNumber(final Integer customerNumber) {
+ this.customerNumber = customerNumber;
+ }
+
+ public String validateCustomerNumber(final Integer customerNumber) {
+ return null;
+ }
+
+ // }}
+
+ // {{ Orders
+ private List<Order> orders = new ArrayList<Order>();
+
+ public List<Order> getOrders() {
+ return this.orders;
+ }
+
+ @SuppressWarnings("unused")
+ private void setOrders(final List<Order> orders) {
+ this.orders = orders;
+ }
+
+ public void addToOrders(final Order order) {
+ getOrders().add(order);
+ }
+
+ public void removeFromOrders(final Order order) {
+ getOrders().remove(order);
+ }
+
+ // }}
+
+ // {{ LastOrder
+ private Order lastOrder;
+
+ @Disabled
+ public Order getLastOrder() {
+ return this.lastOrder;
+ }
+
+ public void setLastOrder(final Order lastOrder) {
+ this.lastOrder = lastOrder;
+ }
+
+ public void modifyLastOrder(final Order lastOrder) {
+ setLastOrder(lastOrder);
+ }
+
+ public void clearLastOrder() {
+ setLastOrder(null);
+ }
+
+ // }}
+
+ // {{ PlaceOrder
+ public void placeOrder(final Product p, @Named("Quantity") final Integer quantity) {
+ final Order order = getContainer().newTransientInstance(Order.class);
+ order.modifyCustomer(this);
+ order.modifyProduct(p);
+ order.setOrderDate(new Date(Clock.getTime()));
+ order.setQuantity(quantity);
+ addToOrders(order);
+ modifyLastOrder(order);
+ order.makePersistent();
+ }
+
+ public String validatePlaceOrder;
+
+ public String validatePlaceOrder(final Product p, final Integer quantity) {
+ return validatePlaceOrder;
+ }
+
+ public String disablePlaceOrder;
+
+ public String disablePlaceOrder(final Product p, final Integer quantity) {
+ return disablePlaceOrder;
+ }
+
+ public boolean hidePlaceOrder;
+
+ public boolean hidePlaceOrder() {
+ return hidePlaceOrder;
+ }
+
+ public Object[] defaultPlaceOrder() {
+ Product lastProductOrdered = null;
+ if (getLastOrder() != null) {
+ lastProductOrdered = getLastOrder().getProduct();
+ }
+ return new Object[] { lastProductOrdered, new Integer(1) };
+ }
+
+ // }}
+
+ // {{ MoreOrders
+ private List<Order> moreOrders = new ArrayList<Order>();
+
+ @Disabled
+ public List<Order> getMoreOrders() {
+ return this.moreOrders;
+ }
+
+ @SuppressWarnings("unused")
+ private void setMoreOrders(final List<Order> moreOrders) {
+ this.moreOrders = moreOrders;
+ }
+
+ public void addToMoreOrders(final Order order) {
+ getMoreOrders().add(order);
+ }
+
+ public void removeFromMoreOrders(final Order order) {
+ getMoreOrders().remove(order);
+ }
+
+ // }}
+
+ public String validate;
+ public boolean validateCalled = false;
+
+ public String validate() {
+ validateCalled = true;
+ return validate;
+ }
+
+ public Long actionWithOptionalValueParameterArgument = Long.MAX_VALUE;
+
+ public void actionWithOptionalValueParameter(@Optional @Named("Amount") final Long val) {
+ actionWithOptionalValueParameterArgument = val;
+ }
+
+ public Long actionWithMandatoryValueParameterArgument = Long.MAX_VALUE;
+
+ public void actionWithMandatoryValueParameter(@Named("Amount") final Long val) {
+ actionWithMandatoryValueParameterArgument = val;
+ }
+
+ public Product actionWithMandatoryReferenceParameterArgument = new Product();
+
+ public void actionWithMandatoryReferenceParameter(final Product product) {
+ actionWithMandatoryReferenceParameterArgument = product;
+ }
+
+ public Product actionWithOptionalReferenceParameterArgument = new Product();
+
+ public void actionWithOptionalReferenceParameter(@Optional final Product product) {
+ actionWithOptionalReferenceParameterArgument = product;
+ }
+
+ public String actionWithOptionalStringParameterArgument = "original value";
+
+ public void actionWithOptionalStringParameter(@Optional @Named("Amount") final String val) {
+ actionWithOptionalStringParameterArgument = val;
+ }
+
+ public String actionWithMandatoryStringParameterArgument = "original value";
+
+ public void actionWithMandatoryStringParameter(@Named("Amount") final String val) {
+ actionWithMandatoryStringParameterArgument = val;
+ }
+
+ public String actionWithMaxLengthStringParameterArgument = "1234";
+
+ public void actionWithMaxLengthStringParameter(@Named("Amount") @MaxLength(4) final String val) {
+ actionWithMaxLengthStringParameterArgument = val;
+ }
+
+ public String actionWithRegExStringParameterArgument = "1234";
+
+ public void actionWithRegExStringParameter(@Named("Amount") @RegEx(validation = "[0-9]{4}") final String val) {
+ actionWithRegExStringParameterArgument = val;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Order.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Order.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Order.java
new file mode 100644
index 0000000..2408a43
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Order.java
@@ -0,0 +1,185 @@
+/*
+ * 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.core.integtestsupport.legacy.sample.domain;
+
+import java.util.Date;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.AbstractDomainObject;
+import org.apache.isis.applib.annotation.Disabled;
+import org.apache.isis.applib.util.TitleBuffer;
+
+public class Order extends AbstractDomainObject {
+
+ // use ctrl+space to bring up the NO templates.
+ // if you do not wish to subclass AbstractDomainObject,
+ // then use the "injc - Inject Container" template.
+
+ // also, use CoffeeBytes code folding with
+ // user-defined regions of {{ and }}
+
+ // {{ Logger
+ @SuppressWarnings("unused")
+ private final static Logger LOGGER = LoggerFactory.getLogger(Order.class);
+
+ // }}
+
+ // {{ Identification Methods
+ /**
+ * Defines the title that will be displayed on the user interface in order
+ * to identity this object.
+ */
+ public String title() {
+ final TitleBuffer t = new TitleBuffer();
+ // null guard because NOF may call title while still setting
+ // up the object
+ final Product product = getProduct();
+ if (product != null) {
+ t.append(product.getCode());
+ } else {
+ t.append("???");
+ }
+ t.append("x", getQuantity());
+ return t.toString();
+ }
+
+ // }}
+
+ // {{ OrderDate
+ private Date orderDate;
+
+ @Disabled
+ public Date getOrderDate() {
+ return this.orderDate;
+ }
+
+ public void setOrderDate(final Date orderDate) {
+ this.orderDate = orderDate;
+ }
+
+ // }}
+
+ // {{ Quantity
+ private Integer quantity;
+
+ public Integer getQuantity() {
+ return this.quantity;
+ }
+
+ public void setQuantity(final Integer quantity) {
+ this.quantity = quantity;
+ }
+
+ public String validateQuantity(final Integer quantity) {
+ return quantity.intValue() <= 0 ? "Quantity must be a positive value" : null;
+ }
+
+ public String disableQuantity() {
+ return isPersistent() ? "Already saved" : null;
+ }
+
+ public Integer defaultQuantity() {
+ return new Integer(1);
+ }
+
+ // }}
+
+ // {{ Customer
+ private Customer customer;
+
+ @Disabled
+ public Customer getCustomer() {
+ return this.customer;
+ }
+
+ public void setCustomer(final Customer customer) {
+ this.customer = customer;
+ }
+
+ public void modifyCustomer(final Customer customer) {
+ setCustomer(customer);
+ }
+
+ public void clearCustomer() {
+ setCustomer(null);
+ }
+
+ // }}
+
+ // {{ Product
+ private Product product;
+
+ @Disabled
+ public Product getProduct() {
+ return this.product;
+ }
+
+ public void setProduct(final Product product) {
+ this.product = product;
+ }
+
+ /**
+ * Capture price from product at time the order is taken.
+ *
+ * @param product
+ */
+ public void modifyProduct(final Product product) {
+ setProduct(product);
+ setPrice(product.getPrice());
+ }
+
+ /**
+ * Never called.
+ *
+ * @param product
+ */
+ public void clearProduct() {
+ setProduct(null);
+ }
+
+ // }}
+
+ // {{ Price
+ private Double price;
+
+ @Disabled
+ public Double getPrice() {
+ return this.price;
+ }
+
+ public void setPrice(final Double price) {
+ this.price = price;
+ }
+
+ // }}
+
+ // {{ makePersistent
+ /**
+ * Raise visibility so can be invoked by other classes.
+ */
+ @Override
+ public void makePersistent() {
+ persist(this);
+ }
+ // }}
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Product.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Product.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Product.java
new file mode 100644
index 0000000..39a0fe7
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/domain/Product.java
@@ -0,0 +1,186 @@
+/*
+ * 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.core.integtestsupport.legacy.sample.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.AbstractDomainObject;
+import org.apache.isis.applib.annotation.Disabled;
+import org.apache.isis.applib.annotation.Immutable;
+import org.apache.isis.applib.annotation.MaxLength;
+import org.apache.isis.applib.annotation.Optional;
+import org.apache.isis.applib.annotation.TypicalLength;
+import org.apache.isis.applib.annotation.When;
+import org.apache.isis.applib.util.TitleBuffer;
+
+@Immutable
+public class Product extends AbstractDomainObject {
+
+ // use ctrl+space to bring up the NO templates.
+ // if you do not wish to subclass AbstractDomainObject,
+ // then use the "injc - Inject Container" template.
+
+ // also, use CoffeeBytes code folding with
+ // user-defined regions of {{ and }}
+
+ // {{ Logger
+ @SuppressWarnings("unused")
+ private final static Logger LOGGER = LoggerFactory.getLogger(Product.class);
+
+ // }}
+
+ // {{ Identification Methods
+ /**
+ * Defines the title that will be displayed on the user interface in order
+ * to identity this object.
+ */
+ public String title() {
+ final TitleBuffer t = new TitleBuffer();
+ t.append(getCode());
+ t.append(":", getDescription());
+ return t.toString();
+ }
+
+ // }}
+
+ // {{ Code
+ private String code;
+
+ @TypicalLength(9)
+ @MaxLength(9)
+ @Disabled(when = When.ONCE_PERSISTED)
+ public String getCode() {
+ return this.code;
+ }
+
+ public void setCode(final String code) {
+ this.code = code;
+ }
+
+ // }}
+
+ // {{ Description
+ private String description;
+
+ @TypicalLength(50)
+ @MaxLength(255)
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(final String description) {
+ this.description = description;
+ }
+
+ // }}
+
+ // {{ PlaceOfManufacture
+ private Country placeOfManufacture;
+
+ @Optional
+ public Country getPlaceOfManufacture() {
+ return placeOfManufacture;
+ }
+
+ public void setPlaceOfManufacture(final Country placeOfManufacture) {
+ this.placeOfManufacture = placeOfManufacture;
+ }
+
+ // }}
+
+ // {{ Price
+ private Double price;
+
+ public Double getPrice() {
+ return this.price;
+ }
+
+ public void setPrice(final Double price) {
+ this.price = price;
+ }
+
+ public String validatePrice(final Double price) {
+ if (price.doubleValue() <= 0) {
+ return "Price must be positive";
+ }
+ return null;
+ }
+
+ // }}
+
+ // {{ SimilarProducts
+ private List<Product> similarProducts = new ArrayList<Product>();
+
+ public List<Product> getSimilarProducts() {
+ return this.similarProducts;
+ }
+
+ @SuppressWarnings("unused")
+ private void setSimilarProducts(final List<Product> similarProducts) {
+ this.similarProducts = similarProducts;
+ }
+
+ public void addToSimilarProducts(final Product country) {
+ getSimilarProducts().add(country);
+ }
+
+ public void removeFromSimilarProducts(final Product country) {
+ getSimilarProducts().remove(country);
+ }
+
+ public String validateAddToSimilarProducts;
+
+ public String validateAddToSimilarProducts(final Product country) {
+ return validateAddToSimilarProducts;
+ }
+
+ public String validateRemoveFromSimilarProducts;
+
+ public String validateRemoveFromSimilarProducts(final Product country) {
+ return validateRemoveFromSimilarProducts;
+ }
+
+ public String disableSimilarProducts;
+
+ public String disableSimilarProducts() {
+ return this.disableSimilarProducts;
+ }
+
+ public boolean hideSimilarProducts;
+
+ public boolean hideSimilarProducts() {
+ return this.hideSimilarProducts;
+ }
+
+ // }}
+
+ // {{
+ /**
+ * An action to invoke
+ */
+ public void foobar() {
+ }
+ // }}
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/CountriesFixture.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/CountriesFixture.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/CountriesFixture.java
new file mode 100644
index 0000000..b681bdc
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/CountriesFixture.java
@@ -0,0 +1,65 @@
+/*
+ * 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.core.integtestsupport.legacy.sample.fixtures;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.fixtures.AbstractFixture;
+import org.apache.isis.core.integtestsupport.legacy.sample.service.CountryRepository;
+
+public class CountriesFixture extends AbstractFixture {
+
+ // {{ Logger
+ private final static Logger LOGGER = LoggerFactory.getLogger(CountriesFixture.class);
+
+ public Logger getLOGGER() {
+ return LOGGER;
+ }
+
+ // }}
+
+ @Override
+ public void install() {
+ getLOGGER().debug("installing");
+ getCountryRepository().newCountry("AUS", "Australia");
+ getCountryRepository().newCountry("GBR", "United Kingdom of Great Britain & N. Ireland");
+ getCountryRepository().newCountry("USA", "United States of America");
+ }
+
+ // {{ Injected: CountryRepository
+ private CountryRepository countryRepository;
+
+ /**
+ * This field is not persisted, nor displayed to the user.
+ */
+ protected CountryRepository getCountryRepository() {
+ return this.countryRepository;
+ }
+
+ /**
+ * Injected by the application container.
+ */
+ public void setCountryRepository(final CountryRepository countryRepository) {
+ this.countryRepository = countryRepository;
+ }
+ // }}
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/CustomerOrdersFixture.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/CustomerOrdersFixture.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/CustomerOrdersFixture.java
new file mode 100644
index 0000000..caf2f1e
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/CustomerOrdersFixture.java
@@ -0,0 +1,107 @@
+/*
+ * 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.core.integtestsupport.legacy.sample.fixtures;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.fixtures.AbstractFixture;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Customer;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Product;
+import org.apache.isis.core.integtestsupport.legacy.sample.service.CustomerRepository;
+import org.apache.isis.core.integtestsupport.legacy.sample.service.ProductRepository;
+
+public class CustomerOrdersFixture extends AbstractFixture {
+
+ // use ctrl+space to bring up the NO templates.
+
+ // also, use CoffeeBytes code folding with
+ // user-defined regions of {{ and }}
+
+ // {{ Logger
+ private final static Logger LOGGER = LoggerFactory.getLogger(CustomerOrdersFixture.class);
+
+ public Logger getLOGGER() {
+ return LOGGER;
+ }
+
+ // }}
+
+ @Override
+ public void install() {
+ getLOGGER().debug("installing");
+ final Customer richard = getCustomerRepository().findByName("Pawson");
+ final Product foldingTable = getProductRepository().findByCode("820-72721");
+ final Product foldingChair = getProductRepository().findByCode("820-72725");
+ final Product waspCatcher = getProductRepository().findByCode("850-18003");
+ final Product coolbox = getProductRepository().findByCode("845-01020");
+
+ setDate(2007, 4, 11);
+ setTime(10, 15);
+ richard.placeOrder(foldingTable, 1);
+ setDate(2007, 4, 12);
+ setTime(9, 35);
+ richard.placeOrder(foldingChair, 6);
+ setDate(2007, 4, 13);
+ setTime(14, 20);
+ richard.placeOrder(waspCatcher, 1);
+ setDate(2007, 4, 14);
+ setTime(11, 10);
+ richard.placeOrder(coolbox, 1);
+ }
+
+ // {{ Injected: CustomerRepository
+ private CustomerRepository customerRepository;
+
+ /**
+ * This field is not persisted, nor displayed to the user.
+ */
+ protected CustomerRepository getCustomerRepository() {
+ return this.customerRepository;
+ }
+
+ /**
+ * Injected by the application container.
+ */
+ public void setCustomerRepository(final CustomerRepository customerRepository) {
+ this.customerRepository = customerRepository;
+ }
+
+ // }}
+
+ // {{ Injected: ProductRepository
+ private ProductRepository productRepository;
+
+ /**
+ * This field is not persisted, nor displayed to the user.
+ */
+ protected ProductRepository getProductRepository() {
+ return this.productRepository;
+ }
+
+ /**
+ * Injected by the application container.
+ */
+ public void setProductRepository(final ProductRepository productRepository) {
+ this.productRepository = productRepository;
+ }
+ // }}
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/CustomersFixture.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/CustomersFixture.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/CustomersFixture.java
new file mode 100644
index 0000000..b3af720
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/CustomersFixture.java
@@ -0,0 +1,89 @@
+/*
+ * 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.core.integtestsupport.legacy.sample.fixtures;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.fixtures.AbstractFixture;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Country;
+import org.apache.isis.core.integtestsupport.legacy.sample.service.CountryRepository;
+import org.apache.isis.core.integtestsupport.legacy.sample.service.CustomerRepository;
+
+public class CustomersFixture extends AbstractFixture {
+
+ // {{ Logger
+ private final static Logger LOGGER = LoggerFactory.getLogger(CustomersFixture.class);
+
+ public Logger getLOGGER() {
+ return LOGGER;
+ }
+
+ // }}
+
+ @Override
+ public void install() {
+ getLOGGER().debug("installing");
+ final Country countryGBR = getCountryRepository().findByCode("GBR");
+ getCustomerRepository().newCustomer("Richard", "Pawson", 1, countryGBR);
+ getCustomerRepository().newCustomer("Robert", "Matthews", 2, countryGBR);
+ getCustomerRepository().newCustomer("Dan", "Haywood", 3, countryGBR);
+ getCustomerRepository().newCustomer("Stef", "Cascarini", 4, countryGBR);
+ getCustomerRepository().newCustomer("Dave", "Slaughter", 5, countryGBR);
+ }
+
+ // {{ Injected: CustomerRepository
+ private CustomerRepository customerRepository;
+
+ /**
+ * This field is not persisted, nor displayed to the user.
+ */
+ protected CustomerRepository getCustomerRepository() {
+ return this.customerRepository;
+ }
+
+ /**
+ * Injected by the application container.
+ */
+ public void setCustomerRepository(final CustomerRepository customerRepository) {
+ this.customerRepository = customerRepository;
+ }
+
+ // }}
+
+ // {{ Injected: CountryRepository
+ private CountryRepository countryRepository;
+
+ /**
+ * This field is not persisted, nor displayed to the user.
+ */
+ protected CountryRepository getCountryRepository() {
+ return this.countryRepository;
+ }
+
+ /**
+ * Injected by the application container.
+ */
+ public void setCountryRepository(final CountryRepository countryRepository) {
+ this.countryRepository = countryRepository;
+ }
+ // }}
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/JoeBloggsFixture.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/JoeBloggsFixture.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/JoeBloggsFixture.java
new file mode 100644
index 0000000..76bf757
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/JoeBloggsFixture.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 org.apache.isis.core.integtestsupport.legacy.sample.fixtures;
+
+import org.apache.isis.applib.fixtures.LogonFixture;
+
+public class JoeBloggsFixture extends LogonFixture {
+
+ public JoeBloggsFixture() {
+ super("jbloggs");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/ProductsFixture.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/ProductsFixture.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/ProductsFixture.java
new file mode 100644
index 0000000..06b846d
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/fixtures/ProductsFixture.java
@@ -0,0 +1,73 @@
+/*
+ * 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.core.integtestsupport.legacy.sample.fixtures;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.fixtures.AbstractFixture;
+import org.apache.isis.core.integtestsupport.legacy.sample.service.ProductRepository;
+
+public class ProductsFixture extends AbstractFixture {
+
+ // use ctrl+space to bring up the NO templates.
+
+ // also, use CoffeeBytes code folding with
+ // user-defined regions of {{ and }}
+
+ // {{ Logger
+ private final static Logger LOGGER = LoggerFactory.getLogger(ProductsFixture.class);
+
+ public Logger getLOGGER() {
+ return LOGGER;
+ }
+
+ // }}
+
+ @Override
+ public void install() {
+ getLOGGER().debug("installing");
+ getProductRepository().newProduct("355-40311", "Weekend camping pack", 5000);
+ getProductRepository().newProduct("850-18003", "Stripy Wasp Catcher", 695);
+ getProductRepository().newProduct("845-06203", "Combi Backpack Hamper", 5900);
+ getProductRepository().newProduct("820-72721", "Folding Table", 4000);
+ getProductRepository().newProduct("820-72725", "Folding Chair", 2500);
+ getProductRepository().newProduct("845-01020", "Isotherm Cool Box", 2500);
+ }
+
+ // {{ Injected: ProductRepository
+ private ProductRepository productRepository;
+
+ /**
+ * This field is not persisted, nor displayed to the user.
+ */
+ protected ProductRepository getProductRepository() {
+ return this.productRepository;
+ }
+
+ /**
+ * Injected by the application container.
+ */
+ public void setProductRepository(final ProductRepository productRepository) {
+ this.productRepository = productRepository;
+ }
+ // }}
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/CountryRepository.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/CountryRepository.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/CountryRepository.java
new file mode 100644
index 0000000..e0e88e5
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/CountryRepository.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 org.apache.isis.core.integtestsupport.legacy.sample.service;
+
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.filter.Filter;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Country;
+
+@Named("Countries")
+public class CountryRepository extends AbstractFactoryAndRepository {
+
+ // {{ Logger
+ @SuppressWarnings("unused")
+ private final static Logger LOGGER = LoggerFactory.getLogger(CountryRepository.class);
+
+ // }}
+
+ /**
+ * Lists all countries in the repository.
+ */
+ public List<Country> showAll() {
+ return allInstances(Country.class);
+ }
+
+ // {{ findByCode
+ /**
+ * Returns the Country with given code
+ */
+ public Country findByCode(@Named("Code") final String code) {
+ return firstMatch(Country.class, new Filter<Country>() {
+ @Override
+ public boolean accept(final Country country) {
+ return code.equals(country.getCode());
+ }
+ });
+ }
+
+ // }}
+
+ /**
+ * Creates a new countryGBR.
+ *
+ * <p>
+ * For use by fixtures only.
+ *
+ * @return
+ */
+ @Hidden
+ public Country newCountry(final String code, final String name) {
+ final Country country = newTransientInstance(Country.class);
+ country.setCode(code);
+ country.setName(name);
+ persist(country);
+ return country;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/CustomerRepository.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/CustomerRepository.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/CustomerRepository.java
new file mode 100644
index 0000000..7bb2795
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/CustomerRepository.java
@@ -0,0 +1,117 @@
+/*
+ * 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.core.integtestsupport.legacy.sample.service;
+
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.filter.Filter;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Country;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Customer;
+
+@Named("Customers")
+public class CustomerRepository extends AbstractFactoryAndRepository {
+
+ // use ctrl+space to bring up the NO templates.
+
+ // also, use CoffeeBytes code folding with
+ // user-defined regions of {{ and }}
+
+ // {{ Logger
+ @SuppressWarnings("unused")
+ private final static Logger LOGGER = LoggerFactory.getLogger(CustomerRepository.class);
+
+ // }}
+
+ /**
+ * Lists all customers in the repository.
+ */
+ public List<Customer> showAll() {
+ return allInstances(Customer.class);
+ }
+
+ // {{ findAllByName, findByName
+ /**
+ * Returns a list of Customers with given last name.
+ */
+ public List<Customer> findAllByName(@Named("Last name") final String lastName) {
+ return allMatches(Customer.class, new FilterLastName(lastName));
+ }
+
+ /**
+ * Returns the first Customer with given last name.
+ */
+ public Customer findByName(@Named("Last name") final String lastName) {
+ final Customer firstMatch = firstMatch(Customer.class, new FilterLastName(lastName));
+ return firstMatch;
+ }
+
+ private final class FilterLastName implements Filter<Customer> {
+ private final String name;
+
+ private FilterLastName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public boolean accept(final Customer customer) {
+ return customer.getLastName().toLowerCase().contains(name.toLowerCase());
+ }
+ }
+
+ // }}
+
+ /**
+ * Creates a new (still-transient) customer.
+ *
+ * @return
+ */
+ public Customer newCustomer() {
+ final Customer customer = newTransientInstance(Customer.class);
+ return customer;
+ }
+
+ /**
+ * Creates a new (already persisted) customer.
+ *
+ * <p>
+ * For use by fixtures only.
+ *
+ * @return
+ */
+ @Hidden
+ public Customer newCustomer(final String firstName, final String lastName, final int customerNumber, final Country countryOfBirth) {
+
+ final Customer customer = newCustomer();
+ customer.setFirstName(firstName);
+ customer.setLastName(lastName);
+ customer.setCustomerNumber(customerNumber);
+ customer.modifyCountryOfBirth(countryOfBirth);
+
+ persist(customer);
+ return customer;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/OrderRepository.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/OrderRepository.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/OrderRepository.java
new file mode 100644
index 0000000..e70c442
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/OrderRepository.java
@@ -0,0 +1,68 @@
+/*
+ * 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.core.integtestsupport.legacy.sample.service;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Customer;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Order;
+
+@Named("Orders")
+public class OrderRepository extends AbstractFactoryAndRepository {
+
+ // use ctrl+space to bring up the NO templates.
+
+ // also, use CoffeeBytes code folding with
+ // user-defined regions of {{ and }}
+
+ @SuppressWarnings("unused")
+ private final static Logger LOGGER = LoggerFactory.getLogger(OrderRepository.class);
+
+ // {{ findRecentOrders
+ public List<Order> findRecentOrders(final Customer customer, @Named("Number of Orders") final Integer numberOfOrders) {
+ final List<Order> orders = customer.getOrders();
+ Collections.sort(orders, new Comparator<Order>() {
+ @Override
+ public int compare(final Order o1, final Order o2) {
+ final long time1 = o1.getOrderDate().getTime();
+ final long time2 = o2.getOrderDate().getTime();
+ return (int) (time2 - time1);
+ }
+ });
+ if (orders.size() < numberOfOrders) {
+ return orders;
+ } else {
+ return orders.subList(0, numberOfOrders);
+ }
+ }
+
+ public Integer default1FindRecentOrders() {
+ return 3;
+ }
+ // }}
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/ProductRepository.java
----------------------------------------------------------------------
diff --git a/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/ProductRepository.java b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/ProductRepository.java
new file mode 100644
index 0000000..4049b99
--- /dev/null
+++ b/mothballed/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/legacy/sample/service/ProductRepository.java
@@ -0,0 +1,104 @@
+/*
+ * 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.core.integtestsupport.legacy.sample.service;
+
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.filter.Filter;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Customer;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Product;
+
+@Named("Products")
+public class ProductRepository extends AbstractFactoryAndRepository {
+
+ // use ctrl+space to bring up the NO templates.
+
+ // also, use CoffeeBytes code folding with
+ // user-defined regions of {{ and }}
+
+ // {{ Logger
+ @SuppressWarnings("unused")
+ private final static Logger LOGGER = LoggerFactory.getLogger(ProductRepository.class);
+
+ // }}
+
+ /**
+ * Lists all products in the repository.
+ */
+ public List<Product> showAll() {
+ return allInstances(Product.class);
+ }
+
+ // {{ findByCode
+ /**
+ * Returns the Product with given code
+ */
+ public Product findByCode(@Named("Code") final String code) {
+ return firstMatch(Product.class, new Filter<Product>() {
+ @Override
+ public boolean accept(final Product product) {
+ return code.equals(product.getCode());
+ }
+ });
+ }
+
+ // }}
+
+ /**
+ * Creates a new product.
+ *
+ * <p>
+ * For use by fixtures only.
+ *
+ * @return
+ */
+ @Hidden
+ public Product newProduct(final String code, final String description, final int priceInPence) {
+ final Product product = newTransientInstance(Product.class);
+ product.setCode(code);
+ product.setDescription(description);
+ product.setPrice(new Double(priceInPence / 100));
+ persist(product);
+ return product;
+ }
+
+ /**
+ * Creates a new still transient product.
+ *
+ * <p>
+ * For use by tests only. Using this rather than {@link Customer} since
+ * {@link Product} has a {@link Product#validate()} method.
+ *
+ * @return
+ */
+ @Hidden
+ public Product newProduct() {
+ return newTransientInstance(Product.class);
+ }
+
+
+
+}