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 2012/12/13 01:01:06 UTC
[13/52] [partial] ISIS-188: renaming packages in line with
groupId:artifactId
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetImpl.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetImpl.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetImpl.java
deleted file mode 100644
index 60e16f6..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetImpl.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.runtimes.dflt.objectstores.jdo.metamodel.facets.prop.primarykey;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-
-
-public class JdoPrimaryKeyFacetImpl extends JdoPrimaryKeyFacetAbstract {
-
- public JdoPrimaryKeyFacetImpl(final FacetHolder holder) {
- super(holder);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/OptionalFacetDerivedFromJdoPrimaryKeyAnnotation.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/OptionalFacetDerivedFromJdoPrimaryKeyAnnotation.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/OptionalFacetDerivedFromJdoPrimaryKeyAnnotation.java
deleted file mode 100644
index df17b91..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/OptionalFacetDerivedFromJdoPrimaryKeyAnnotation.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.runtimes.dflt.objectstores.jdo.metamodel.facets.prop.primarykey;
-
-import javax.jdo.annotations.PrimaryKey;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetDefault;
-import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
-
-
-/**
- * Derived by presence of {@link PrimaryKey}.
- *
- * <p>
- * By default mandatory properties are initialized using the
- * {@link PropertyDefaultFacet} facet. We don't want this, so this facet marks
- * the property as optional, meaning that the {@link PrimaryKey} property is left
- * untouched by Isis.
- */
-public class OptionalFacetDerivedFromJdoPrimaryKeyAnnotation extends
- MandatoryFacetDefault {
-
- public OptionalFacetDerivedFromJdoPrimaryKeyAnnotation(final FacetHolder holder) {
- super(holder);
- }
-
- @Override
- public boolean isInvertedSemantics() {
- return true;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/package-info.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/package-info.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/package-info.java
deleted file mode 100644
index 746c0a3..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * 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.
- */
-/**
- *
- *
- * @version $Rev$ $Date$
- */
-package org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.prop.primarykey;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/validator/JdoMetaModelValidator.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/validator/JdoMetaModelValidator.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/validator/JdoMetaModelValidator.java
deleted file mode 100644
index 0468402..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/validator/JdoMetaModelValidator.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.runtimes.dflt.objectstores.jdo.metamodel.specloader.validator;
-
-import javax.jdo.annotations.IdentityType;
-
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
-import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorVisiting;
-import org.apache.isis.core.metamodel.specloader.validator.ValidationFailures;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacet;
-
-public class JdoMetaModelValidator extends MetaModelValidatorComposite {
-
- public JdoMetaModelValidator() {
- addValidatorToEnsurePersistenceCapables();
-
- addValidatorToEnsureIdentityType();
- }
-
- private void addValidatorToEnsurePersistenceCapables() {
- final MetaModelValidatorVisiting.SummarizingVisitor ensurePersistenceCapables = new MetaModelValidatorVisiting.SummarizingVisitor(){
-
- private boolean found = false;
- @Override
- public boolean visit(ObjectSpecification objectSpec, ValidationFailures validationFailures) {
- boolean containsFacet = objectSpec.containsFacet(JdoPersistenceCapableFacet.class);
- if(containsFacet) {
- found = true;
- return false; // no need to keep searching
- }
- return true; // keep searching
- }
-
- @Override
- public void summarize(ValidationFailures validationFailures) {
- if(!found) {
- validationFailures.add("DataNucleus object store: no @PersistenceCapable found. " +
- "(Are the entities referenced by the registered services? " +
- "are all services registered? " +
- "are you using the JDO programming model facets?)");
- }
- }
- };
- add(new MetaModelValidatorVisiting(ensurePersistenceCapables));
- }
-
- private void addValidatorToEnsureIdentityType() {
- MetaModelValidatorVisiting.Visitor ensureIdentityType = new MetaModelValidatorVisiting.Visitor(){
- @Override
- public boolean visit(ObjectSpecification objSpec, ValidationFailures validationFailures) {
- final JdoPersistenceCapableFacet jpcf = objSpec.getFacet(JdoPersistenceCapableFacet.class);
- if(jpcf == null) {
- return true;
- }
- final IdentityType identityType = jpcf.getIdentityType();
- if(identityType != IdentityType.DATASTORE && identityType != IdentityType.UNSPECIFIED) {
- validationFailures.add("DataNucleus object store: %s must be annotated with @PersistenceCapable, with an identityType of either DATASTORE or UNSPECIFIED (has an identityType of %s)", objSpec.getFullIdentifier(), identityType);
- }
-
- return true;
- // TODO: ensure that DATASTORE has recognised @DatastoreIdentity attribute
- }};
-
- add(new MetaModelValidatorVisiting(ensureIdentityType));
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/util/JdoPrimaryKeyPropertyFilter.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/util/JdoPrimaryKeyPropertyFilter.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/util/JdoPrimaryKeyPropertyFilter.java
deleted file mode 100644
index bef761f..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/util/JdoPrimaryKeyPropertyFilter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.runtimes.dflt.objectstores.jdo.metamodel.util;
-
-
-import javax.jdo.annotations.PrimaryKey;
-
-import org.apache.isis.applib.filter.Filter;
-import org.apache.isis.core.metamodel.facets.accessor.PropertyOrCollectionAccessorFacet;
-import org.apache.isis.core.metamodel.facets.properties.modify.PropertySetterFacet;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.prop.primarykey.JdoPrimaryKeyFacet;
-
-/**
- * Use to locate the property annotated with {@link PrimaryKey}.
- * <p>
- * In addition, must also be a {@link OneToOneAssociation}, and can be
- * {@link PropertyAccessorFacet read}.
- * <p>
- * Note that it is NOT necessary for there to be a facet to
- * {@link PropertySetterFacet set} the property.
- */
-public final class JdoPrimaryKeyPropertyFilter implements Filter<ObjectAssociation> {
- @Override
- public boolean accept(final ObjectAssociation noa) {
- return noa.isOneToOneAssociation() &&
- noa.containsFacet(JdoPrimaryKeyFacet.class) &&
- noa.containsFacet(PropertyOrCollectionAccessorFacet.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/auditable/GivenAuditableAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/auditable/GivenAuditableAnnotationFacetFactoryTest.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/auditable/GivenAuditableAnnotationFacetFactoryTest.java
new file mode 100644
index 0000000..4f92a08
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/auditable/GivenAuditableAnnotationFacetFactoryTest.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.objectstore.jdo.metamodel.facets.object.auditable;
+
+import java.util.List;
+
+import javax.jdo.annotations.DatastoreIdentity;
+import javax.jdo.annotations.IdGeneratorStrategy;
+import javax.jdo.annotations.PersistenceCapable;
+
+import junit.framework.Assert;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactory;
+import org.apache.isis.core.objectstore.jdo.applib.annotations.Auditable;
+import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.auditable.AuditableAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.auditable.AuditableFacet;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.auditable.AuditableFacetAnnotation;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacet;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacetAnnotation;
+
+
+public class GivenAuditableAnnotationFacetFactoryTest extends
+ AbstractFacetFactoryTest {
+
+ private AuditableAnnotationFacetFactory facetFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ facetFactory = new AuditableAnnotationFacetFactory();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ facetFactory = null;
+ super.tearDown();
+ }
+
+ public void testFeatureTypes() {
+ final List<FeatureType> featureTypes = facetFactory
+ .getFeatureTypes();
+ Assert.assertTrue(contains(featureTypes, FeatureType.OBJECT));
+ assertFalse(contains(featureTypes, FeatureType.PROPERTY));
+ assertFalse(contains(featureTypes, FeatureType.COLLECTION));
+ Assert.assertFalse(contains(featureTypes, FeatureType.ACTION));
+ assertFalse(contains(featureTypes,
+ FeatureType.ACTION_PARAMETER));
+ }
+
+ public void testAuditableAnnotationPickedUpOnClass() {
+ @Auditable
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final Facet facet = facetHolder.getFacet(AuditableFacet.class);
+ assertNotNull(facet);
+ assertTrue(facet instanceof AuditableFacetAnnotation);
+ }
+
+ public void testIfNoAuditableAnnotationThenNoFacet() {
+
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final Facet facet = facetHolder.getFacet(AuditableFacet.class);
+ assertNull(facet);
+ }
+
+
+ public void testNoMethodsRemoved() {
+ @PersistenceCapable
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ assertNoMethodsRemoved();
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/auditable/GivenAuditableMarkerInterfaceFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/auditable/GivenAuditableMarkerInterfaceFacetFactoryTest.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/auditable/GivenAuditableMarkerInterfaceFacetFactoryTest.java
new file mode 100644
index 0000000..3f33aa5
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/auditable/GivenAuditableMarkerInterfaceFacetFactoryTest.java
@@ -0,0 +1,98 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.auditable;
+
+import java.util.List;
+
+import javax.jdo.annotations.PersistenceCapable;
+
+import junit.framework.Assert;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactory;
+import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
+import org.apache.isis.objectstore.jdo.applib.Auditable;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.auditable.AuditableFacet;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.auditable.AuditableFacetMarkerInterface;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.auditable.AuditableMarkerInterfaceFacetFactory;
+
+
+public class GivenAuditableMarkerInterfaceFacetFactoryTest extends
+ AbstractFacetFactoryTest {
+
+ private AuditableMarkerInterfaceFacetFactory facetFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ facetFactory = new AuditableMarkerInterfaceFacetFactory();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ facetFactory = null;
+ super.tearDown();
+ }
+
+ public void testFeatureTypes() {
+ final List<FeatureType> featureTypes = facetFactory
+ .getFeatureTypes();
+ Assert.assertTrue(contains(featureTypes, FeatureType.OBJECT));
+ assertFalse(contains(featureTypes, FeatureType.PROPERTY));
+ assertFalse(contains(featureTypes, FeatureType.COLLECTION));
+ Assert.assertFalse(contains(featureTypes, FeatureType.ACTION));
+ assertFalse(contains(featureTypes,
+ FeatureType.ACTION_PARAMETER));
+ }
+
+ public void testAuditableMarkerInterfacePickedUpOnClass() {
+ class Customer implements Auditable {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final Facet facet = facetHolder.getFacet(AuditableFacet.class);
+ assertNotNull(facet);
+ assertTrue(facet instanceof AuditableFacetMarkerInterface);
+ }
+
+ public void testIfNoAuditableMarkerInterfaceThenNoFacet() {
+
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final Facet facet = facetHolder.getFacet(AuditableFacet.class);
+ assertNull(facet);
+ }
+
+
+ public void testNoMethodsRemoved() {
+ @PersistenceCapable
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ assertNoMethodsRemoved();
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/datastoreidentity/GivenJdoDatastoreIdentityAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/datastoreidentity/GivenJdoDatastoreIdentityAnnotationFacetFactoryTest.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/datastoreidentity/GivenJdoDatastoreIdentityAnnotationFacetFactoryTest.java
new file mode 100644
index 0000000..194322f
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/datastoreidentity/GivenJdoDatastoreIdentityAnnotationFacetFactoryTest.java
@@ -0,0 +1,125 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.datastoreidentity;
+
+import java.util.List;
+
+import javax.jdo.annotations.DatastoreIdentity;
+import javax.jdo.annotations.IdGeneratorStrategy;
+import javax.jdo.annotations.PersistenceCapable;
+
+import junit.framework.Assert;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactory;
+import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.datastoreidentity.JdoDatastoreIdentityAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.datastoreidentity.JdoDatastoreIdentityFacet;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.datastoreidentity.JdoDatastoreIdentityFacetAnnotation;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacet;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacetAnnotation;
+
+
+public class GivenJdoDatastoreIdentityAnnotationFacetFactoryTest extends
+ AbstractFacetFactoryTest {
+
+ private JdoDatastoreIdentityAnnotationFacetFactory facetFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ facetFactory = new JdoDatastoreIdentityAnnotationFacetFactory();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ facetFactory = null;
+ super.tearDown();
+ }
+
+ public void testFeatureTypes() {
+ final List<FeatureType> featureTypes = facetFactory
+ .getFeatureTypes();
+ Assert.assertTrue(contains(featureTypes, FeatureType.OBJECT));
+ assertFalse(contains(featureTypes, FeatureType.PROPERTY));
+ assertFalse(contains(featureTypes, FeatureType.COLLECTION));
+ Assert.assertFalse(contains(featureTypes, FeatureType.ACTION));
+ assertFalse(contains(featureTypes,
+ FeatureType.ACTION_PARAMETER));
+ }
+
+ public void testDatastoreIdentityAnnotationPickedUpOnClass() {
+ @DatastoreIdentity()
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final Facet facet = facetHolder.getFacet(JdoDatastoreIdentityFacet.class);
+ assertNotNull(facet);
+ assertTrue(facet instanceof JdoDatastoreIdentityFacetAnnotation);
+ }
+
+ public void testIfNoDatastoreIdentityAnnotationThenNoFacet() {
+
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final Facet facet = facetHolder.getFacet(JdoDatastoreIdentityFacet.class);
+ assertNull(facet);
+ }
+
+ public void testDatastoreIdentityAnnotationWithNoExplicitStrategyDefaultsToUnspecified() {
+ @DatastoreIdentity()
+ class Customer {
+ }
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final JdoDatastoreIdentityFacet entityFacet = facetHolder
+ .getFacet(JdoDatastoreIdentityFacet.class);
+ assertEquals(IdGeneratorStrategy.UNSPECIFIED, entityFacet.getStrategy());
+ }
+
+ public void testEntityAnnotationWithExplicitStrategyAttributeProvided() {
+ @DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY)
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final JdoDatastoreIdentityFacet entityFacet = facetHolder
+ .getFacet(JdoDatastoreIdentityFacet.class);
+ assertEquals(IdGeneratorStrategy.IDENTITY, entityFacet.getStrategy());
+ }
+
+ public void testNoMethodsRemoved() {
+ @PersistenceCapable
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ assertNoMethodsRemoved();
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/GivenJdoDiscriminatorAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/GivenJdoDiscriminatorAnnotationFacetFactoryTest.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/GivenJdoDiscriminatorAnnotationFacetFactoryTest.java
new file mode 100644
index 0000000..a3528a7
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/GivenJdoDiscriminatorAnnotationFacetFactoryTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.discriminator;
+
+import java.util.List;
+
+import javax.jdo.annotations.Discriminator;
+import javax.jdo.annotations.PersistenceCapable;
+
+import junit.framework.Assert;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactory;
+import org.apache.isis.core.metamodel.facets.object.objecttype.ObjectSpecIdFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
+import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.discriminator.JdoDiscriminatorAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.discriminator.ObjectSpecIdFacetInferredFromJdoDiscriminatorValueAnnotation;
+
+public class GivenJdoDiscriminatorAnnotationFacetFactoryTest extends AbstractFacetFactoryTest {
+
+ private JdoDiscriminatorAnnotationFacetFactory facetFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ facetFactory = new JdoDiscriminatorAnnotationFacetFactory();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ facetFactory = null;
+ super.tearDown();
+ }
+
+ public void testFeatureTypes() {
+ final List<FeatureType> featureTypes = facetFactory.getFeatureTypes();
+ Assert.assertTrue(contains(featureTypes, FeatureType.OBJECT));
+ assertFalse(contains(featureTypes, FeatureType.PROPERTY));
+ assertFalse(contains(featureTypes, FeatureType.COLLECTION));
+ Assert.assertFalse(contains(featureTypes, FeatureType.ACTION));
+ assertFalse(contains(featureTypes, FeatureType.ACTION_PARAMETER));
+ }
+
+ public void testDiscriminatorValueAnnotationPickedUpOnClass() {
+ @Discriminator("CUS")
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final Facet facet = facetHolder.getFacet(ObjectSpecIdFacet.class);
+ assertNotNull(facet);
+ Assert.assertTrue(facet instanceof ObjectSpecIdFacetInferredFromJdoDiscriminatorValueAnnotation);
+ }
+
+ public void testIfNoEntityAnnotationThenNoFacet() {
+
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final Facet facet = facetHolder.getFacet(ObjectSpecIdFacet.class);
+ assertNull(facet);
+ }
+
+ public void testAnnotationValue() {
+ @Discriminator("CUS")
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final ObjectSpecIdFacet discriminatorValueFacet = facetHolder.getFacet(ObjectSpecIdFacet.class);
+ assertEquals(ObjectSpecId.of("CUS"), discriminatorValueFacet.value());
+ }
+
+ public void testNoMethodsRemoved() {
+ @PersistenceCapable
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ assertNoMethodsRemoved();
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/GivenJdoEmbeddedOnlyAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/GivenJdoEmbeddedOnlyAnnotationFacetFactoryTest.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/GivenJdoEmbeddedOnlyAnnotationFacetFactoryTest.java
new file mode 100644
index 0000000..7909195
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/GivenJdoEmbeddedOnlyAnnotationFacetFactoryTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.embeddedonly;
+
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactory;
+import org.apache.isis.core.metamodel.facets.object.aggregated.ParentedFacet;
+import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.embeddedonly.JdoEmbeddedOnlyAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.embeddedonly.JdoEmbeddedOnlyFacet;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.embeddedonly.JdoEmbeddedOnlyFacetAnnotation;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.embeddedonly.ParentedFacetDerivedFromJdoEmbeddedOnlyAnnotation;
+
+
+public class GivenJdoEmbeddedOnlyAnnotationFacetFactoryTest extends
+ AbstractFacetFactoryTest {
+
+ private JdoEmbeddedOnlyAnnotationFacetFactory facetFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ facetFactory = new JdoEmbeddedOnlyAnnotationFacetFactory();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ facetFactory = null;
+ super.tearDown();
+ }
+
+ public void testFeatureTypes() {
+ final List<FeatureType> featureTypes = facetFactory
+ .getFeatureTypes();
+ Assert
+ .assertTrue(contains(featureTypes,
+ FeatureType.OBJECT));
+ assertFalse(contains(featureTypes,
+ FeatureType.PROPERTY));
+ assertFalse(contains(featureTypes,
+ FeatureType.COLLECTION));
+ Assert
+ .assertFalse(contains(featureTypes,
+ FeatureType.ACTION));
+ assertFalse(contains(featureTypes,
+ FeatureType.ACTION_PARAMETER));
+ }
+
+
+ public void testAggregatedFacetPickedUpOnType() throws Exception {
+ facetFactory.process(new FacetFactory.ProcessClassContext(SimpleObjectWithEmbeddedOnly.class, methodRemover, facetHolder));
+
+ final Facet facet = facetHolder.getFacet(ParentedFacet.class);
+ assertNotNull(facet);
+ Assert
+ .assertTrue(facet instanceof ParentedFacetDerivedFromJdoEmbeddedOnlyAnnotation);
+ }
+
+ public void testJpaEmbeddableFacetPickedUpOnType() throws Exception {
+ facetFactory.process(new FacetFactory.ProcessClassContext(SimpleObjectWithEmbeddedOnly.class, methodRemover, facetHolder));
+
+ final Facet facet = facetHolder.getFacet(JdoEmbeddedOnlyFacet.class);
+ assertNotNull(facet);
+ assertTrue(facet instanceof JdoEmbeddedOnlyFacetAnnotation);
+ }
+
+
+ public void testNoMethodsRemovedForType() throws Exception {
+ facetFactory.process(new FacetFactory.ProcessClassContext(SimpleObjectWithEmbeddedOnly.class, methodRemover, facetHolder));
+ assertNoMethodsRemoved();
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/SimpleObjectWithEmbeddedOnly.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/SimpleObjectWithEmbeddedOnly.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/SimpleObjectWithEmbeddedOnly.java
new file mode 100644
index 0000000..65d0401
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/SimpleObjectWithEmbeddedOnly.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 org.apache.isis.objectstore.jdo.metamodel.facets.object.embeddedonly;
+
+import javax.jdo.annotations.EmbeddedOnly;
+import javax.jdo.annotations.PrimaryKey;
+
+@EmbeddedOnly
+public class SimpleObjectWithEmbeddedOnly {
+
+ private Long id;
+
+ @PrimaryKey
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(final Long id) {
+ this.id = id;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/GivenJdoPersistenceCapableAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/GivenJdoPersistenceCapableAnnotationFacetFactoryTest.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/GivenJdoPersistenceCapableAnnotationFacetFactoryTest.java
new file mode 100644
index 0000000..ae56d33
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/GivenJdoPersistenceCapableAnnotationFacetFactoryTest.java
@@ -0,0 +1,150 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.persistencecapable;
+
+import java.util.List;
+
+import javax.jdo.annotations.IdentityType;
+import javax.jdo.annotations.PersistenceCapable;
+
+import junit.framework.Assert;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactory;
+import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacet;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacetAnnotation;
+
+
+public class GivenJdoPersistenceCapableAnnotationFacetFactoryTest extends
+ AbstractFacetFactoryTest {
+
+ private JdoPersistenceCapableAnnotationFacetFactory facetFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ facetFactory = new JdoPersistenceCapableAnnotationFacetFactory();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ facetFactory = null;
+ super.tearDown();
+ }
+
+ public void testFeatureTypes() {
+ final List<FeatureType> featureTypes = facetFactory
+ .getFeatureTypes();
+ Assert
+ .assertTrue(contains(featureTypes,
+ FeatureType.OBJECT));
+ assertFalse(contains(featureTypes,
+ FeatureType.PROPERTY));
+ assertFalse(contains(featureTypes,
+ FeatureType.COLLECTION));
+ Assert
+ .assertFalse(contains(featureTypes,
+ FeatureType.ACTION));
+ assertFalse(contains(featureTypes,
+ FeatureType.ACTION_PARAMETER));
+ }
+
+ public void testPersistenceCapableAnnotationPickedUpOnClass() {
+ @PersistenceCapable
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final Facet facet = facetHolder.getFacet(JdoPersistenceCapableFacet.class);
+ assertNotNull(facet);
+ assertTrue(facet instanceof JdoPersistenceCapableFacetAnnotation);
+ }
+
+ public void testIfNoPersistenceCapableAnnotationThenNoFacet() {
+
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final Facet facet = facetHolder.getFacet(JdoPersistenceCapableFacet.class);
+ assertNull(facet);
+ }
+
+ public void testEntityAnnotationWithNoExplicitNameDefaultsToClassName() {
+ @PersistenceCapable()
+ class Customer {
+ }
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final JdoPersistenceCapableFacet entityFacet = facetHolder
+ .getFacet(JdoPersistenceCapableFacet.class);
+ assertEquals("Customer", entityFacet.getTable());
+ }
+
+ public void testPersistenceCapableAnnotationWithNoExplicitIdentityTypeDefaultsToUnspecified() {
+ @PersistenceCapable()
+ class Customer {
+ }
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final JdoPersistenceCapableFacet entityFacet = facetHolder
+ .getFacet(JdoPersistenceCapableFacet.class);
+ assertEquals(IdentityType.UNSPECIFIED, entityFacet.getIdentityType());
+ }
+
+ public void testPersistenceCapableAnnotationWithExplicitNameAttributeProvided() {
+ @PersistenceCapable(table = "CUS_CUSTOMER")
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final JdoPersistenceCapableFacet entityFacet = facetHolder
+ .getFacet(JdoPersistenceCapableFacet.class);
+ assertEquals("CUS_CUSTOMER", entityFacet.getTable());
+ }
+
+ public void testPersistenceCapableAnnotationWithExplicitIdentityTypeAttributeProvided() {
+ @PersistenceCapable(identityType=IdentityType.DATASTORE)
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ final JdoPersistenceCapableFacet entityFacet = facetHolder
+ .getFacet(JdoPersistenceCapableFacet.class);
+ assertEquals(IdentityType.DATASTORE, entityFacet.getIdentityType());
+ }
+
+ public void testNoMethodsRemoved() {
+ @PersistenceCapable
+ class Customer {
+ }
+
+ facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
+
+ assertNoMethodsRemoved();
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/GivenJdoPrimaryKeyAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/GivenJdoPrimaryKeyAnnotationFacetFactoryTest.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/GivenJdoPrimaryKeyAnnotationFacetFactoryTest.java
new file mode 100644
index 0000000..0d02691
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/GivenJdoPrimaryKeyAnnotationFacetFactoryTest.java
@@ -0,0 +1,142 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.prop.primarykey;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import javax.jdo.annotations.PrimaryKey;
+
+import junit.framework.Assert;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactory;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacet;
+import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
+import org.apache.isis.core.progmodel.facets.members.disabled.DisabledFacet;
+import org.apache.isis.objectstore.jdo.metamodel.facets.prop.primarykey.DisabledFacetDerivedFromJdoPrimaryKeyAnnotation;
+import org.apache.isis.objectstore.jdo.metamodel.facets.prop.primarykey.JdoPrimaryKeyAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.prop.primarykey.JdoPrimaryKeyFacet;
+import org.apache.isis.objectstore.jdo.metamodel.facets.prop.primarykey.OptionalFacetDerivedFromJdoPrimaryKeyAnnotation;
+
+public class GivenJdoPrimaryKeyAnnotationFacetFactoryTest extends AbstractFacetFactoryTest {
+
+ private JdoPrimaryKeyAnnotationFacetFactory facetFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ facetFactory = new JdoPrimaryKeyAnnotationFacetFactory();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ facetFactory = null;
+ super.tearDown();
+ }
+
+ public void testFeatureTypes() {
+ final List<FeatureType> featureTypes = facetFactory.getFeatureTypes();
+ Assert.assertFalse(contains(featureTypes, FeatureType.OBJECT));
+ assertTrue(contains(featureTypes, FeatureType.PROPERTY));
+ assertFalse(contains(featureTypes, FeatureType.COLLECTION));
+ Assert.assertFalse(contains(featureTypes, FeatureType.ACTION));
+ assertFalse(contains(featureTypes, FeatureType.ACTION_PARAMETER));
+ }
+
+ public void testIdAnnotationPickedUpOnProperty() throws Exception {
+ final Class<?> cls = SimpleObjectWithPrimaryKey.class;
+ final Method method = cls.getMethod("getId");
+ facetFactory.process(new FacetFactory.ProcessMethodContext(cls, method, methodRemover, facetedMethod));
+
+ final Facet facet = facetedMethod.getFacet(JdoPrimaryKeyFacet.class);
+ assertNotNull(facet);
+ assertTrue(facet instanceof JdoPrimaryKeyFacet);
+ }
+
+ public void testOptionalDerivedFromId() throws Exception {
+ final Class<?> cls = SimpleObjectWithPrimaryKey.class;
+ final Method method = cls.getMethod("getId");
+ facetFactory.process(new FacetFactory.ProcessMethodContext(cls, method, methodRemover, facetedMethod));
+
+ final Facet facet = facetedMethod.getFacet(MandatoryFacet.class);
+ assertNotNull(facet);
+ Assert.assertTrue(facet instanceof OptionalFacetDerivedFromJdoPrimaryKeyAnnotation);
+ }
+
+ public void testDisabledDerivedFromId() throws Exception {
+ final Class<?> cls = SimpleObjectWithPrimaryKey.class;
+ final Method method = cls.getMethod("getId");
+ facetFactory.process(new FacetFactory.ProcessMethodContext(cls, method, methodRemover, facetedMethod));
+
+ final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
+ assertNotNull(facet);
+ Assert.assertTrue(facet instanceof DisabledFacetDerivedFromJdoPrimaryKeyAnnotation);
+ }
+
+ public void testIfNoIdAnnotationThenNoFacet() throws Exception {
+
+ class Customer {
+ private Long id;
+
+ // @Id missing
+ @SuppressWarnings("unused")
+ public Long getId() {
+ return id;
+ }
+
+ @SuppressWarnings("unused")
+ public void setId(final Long id) {
+ this.id = id;
+ }
+ }
+
+ final Class<?> cls = Customer.class;
+ final Method method = cls.getMethod("getId");
+ facetFactory.process(new FacetFactory.ProcessMethodContext(cls, method, methodRemover, facetedMethod));
+
+ final Facet facet = facetedMethod.getFacet(JdoPrimaryKeyFacet.class);
+ assertNull(facet);
+ }
+
+ public void testNoMethodsRemoved() throws Exception {
+ class Customer {
+ private Long id;
+
+ @SuppressWarnings("unused")
+ @PrimaryKey
+ public Long getId() {
+ return id;
+ }
+
+ @SuppressWarnings("unused")
+ public void setId(final Long id) {
+ this.id = id;
+ }
+ }
+
+ final Class<?> cls = Customer.class;
+ final Method method = cls.getMethod("getId");
+ facetFactory.process(new FacetFactory.ProcessMethodContext(cls, method, methodRemover, facetedMethod));
+
+ assertNoMethodsRemoved();
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/SimpleObjectWithPrimaryKey.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/SimpleObjectWithPrimaryKey.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/SimpleObjectWithPrimaryKey.java
new file mode 100644
index 0000000..79121c2
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/SimpleObjectWithPrimaryKey.java
@@ -0,0 +1,36 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.prop.primarykey;
+
+import javax.jdo.annotations.PrimaryKey;
+
+
+public class SimpleObjectWithPrimaryKey {
+
+ private Long id;
+
+ @PrimaryKey
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(final Long id) {
+ this.id = id;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/GivenAuditableAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/GivenAuditableAnnotationFacetFactoryTest.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/GivenAuditableAnnotationFacetFactoryTest.java
deleted file mode 100644
index d3767e6..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/GivenAuditableAnnotationFacetFactoryTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.runtimes.dflt.objectstores.jdo.metamodel.facets.object.auditable;
-
-import java.util.List;
-
-import javax.jdo.annotations.DatastoreIdentity;
-import javax.jdo.annotations.IdGeneratorStrategy;
-import javax.jdo.annotations.PersistenceCapable;
-
-import junit.framework.Assert;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.FacetFactory;
-import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.applib.annotations.Auditable;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableAnnotationFacetFactory;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacet;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacetAnnotation;
-
-
-public class GivenAuditableAnnotationFacetFactoryTest extends
- AbstractFacetFactoryTest {
-
- private AuditableAnnotationFacetFactory facetFactory;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- facetFactory = new AuditableAnnotationFacetFactory();
- }
-
- @Override
- protected void tearDown() throws Exception {
- facetFactory = null;
- super.tearDown();
- }
-
- public void testFeatureTypes() {
- final List<FeatureType> featureTypes = facetFactory
- .getFeatureTypes();
- Assert.assertTrue(contains(featureTypes, FeatureType.OBJECT));
- assertFalse(contains(featureTypes, FeatureType.PROPERTY));
- assertFalse(contains(featureTypes, FeatureType.COLLECTION));
- Assert.assertFalse(contains(featureTypes, FeatureType.ACTION));
- assertFalse(contains(featureTypes,
- FeatureType.ACTION_PARAMETER));
- }
-
- public void testAuditableAnnotationPickedUpOnClass() {
- @Auditable
- class Customer {
- }
-
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- final Facet facet = facetHolder.getFacet(AuditableFacet.class);
- assertNotNull(facet);
- assertTrue(facet instanceof AuditableFacetAnnotation);
- }
-
- public void testIfNoAuditableAnnotationThenNoFacet() {
-
- class Customer {
- }
-
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- final Facet facet = facetHolder.getFacet(AuditableFacet.class);
- assertNull(facet);
- }
-
-
- public void testNoMethodsRemoved() {
- @PersistenceCapable
- class Customer {
- }
-
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- assertNoMethodsRemoved();
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/GivenAuditableMarkerInterfaceFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/GivenAuditableMarkerInterfaceFacetFactoryTest.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/GivenAuditableMarkerInterfaceFacetFactoryTest.java
deleted file mode 100644
index 13c4803..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/GivenAuditableMarkerInterfaceFacetFactoryTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.runtimes.dflt.objectstores.jdo.metamodel.facets.object.auditable;
-
-import java.util.List;
-
-import javax.jdo.annotations.PersistenceCapable;
-
-import junit.framework.Assert;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.FacetFactory;
-import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.applib.Auditable;
-
-
-public class GivenAuditableMarkerInterfaceFacetFactoryTest extends
- AbstractFacetFactoryTest {
-
- private AuditableMarkerInterfaceFacetFactory facetFactory;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- facetFactory = new AuditableMarkerInterfaceFacetFactory();
- }
-
- @Override
- protected void tearDown() throws Exception {
- facetFactory = null;
- super.tearDown();
- }
-
- public void testFeatureTypes() {
- final List<FeatureType> featureTypes = facetFactory
- .getFeatureTypes();
- Assert.assertTrue(contains(featureTypes, FeatureType.OBJECT));
- assertFalse(contains(featureTypes, FeatureType.PROPERTY));
- assertFalse(contains(featureTypes, FeatureType.COLLECTION));
- Assert.assertFalse(contains(featureTypes, FeatureType.ACTION));
- assertFalse(contains(featureTypes,
- FeatureType.ACTION_PARAMETER));
- }
-
- public void testAuditableMarkerInterfacePickedUpOnClass() {
- class Customer implements Auditable {
- }
-
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- final Facet facet = facetHolder.getFacet(AuditableFacet.class);
- assertNotNull(facet);
- assertTrue(facet instanceof AuditableFacetMarkerInterface);
- }
-
- public void testIfNoAuditableMarkerInterfaceThenNoFacet() {
-
- class Customer {
- }
-
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- final Facet facet = facetHolder.getFacet(AuditableFacet.class);
- assertNull(facet);
- }
-
-
- public void testNoMethodsRemoved() {
- @PersistenceCapable
- class Customer {
- }
-
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- assertNoMethodsRemoved();
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/GivenJdoDatastoreIdentityAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/GivenJdoDatastoreIdentityAnnotationFacetFactoryTest.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/GivenJdoDatastoreIdentityAnnotationFacetFactoryTest.java
deleted file mode 100644
index 4e119ae..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/GivenJdoDatastoreIdentityAnnotationFacetFactoryTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.runtimes.dflt.objectstores.jdo.metamodel.facets.object.datastoreidentity;
-
-import java.util.List;
-
-import javax.jdo.annotations.DatastoreIdentity;
-import javax.jdo.annotations.IdGeneratorStrategy;
-import javax.jdo.annotations.PersistenceCapable;
-
-import junit.framework.Assert;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.FacetFactory;
-import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableAnnotationFacetFactory;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacet;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacetAnnotation;
-
-
-public class GivenJdoDatastoreIdentityAnnotationFacetFactoryTest extends
- AbstractFacetFactoryTest {
-
- private JdoDatastoreIdentityAnnotationFacetFactory facetFactory;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- facetFactory = new JdoDatastoreIdentityAnnotationFacetFactory();
- }
-
- @Override
- protected void tearDown() throws Exception {
- facetFactory = null;
- super.tearDown();
- }
-
- public void testFeatureTypes() {
- final List<FeatureType> featureTypes = facetFactory
- .getFeatureTypes();
- Assert.assertTrue(contains(featureTypes, FeatureType.OBJECT));
- assertFalse(contains(featureTypes, FeatureType.PROPERTY));
- assertFalse(contains(featureTypes, FeatureType.COLLECTION));
- Assert.assertFalse(contains(featureTypes, FeatureType.ACTION));
- assertFalse(contains(featureTypes,
- FeatureType.ACTION_PARAMETER));
- }
-
- public void testDatastoreIdentityAnnotationPickedUpOnClass() {
- @DatastoreIdentity()
- class Customer {
- }
-
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- final Facet facet = facetHolder.getFacet(JdoDatastoreIdentityFacet.class);
- assertNotNull(facet);
- assertTrue(facet instanceof JdoDatastoreIdentityFacetAnnotation);
- }
-
- public void testIfNoDatastoreIdentityAnnotationThenNoFacet() {
-
- class Customer {
- }
-
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- final Facet facet = facetHolder.getFacet(JdoDatastoreIdentityFacet.class);
- assertNull(facet);
- }
-
- public void testDatastoreIdentityAnnotationWithNoExplicitStrategyDefaultsToUnspecified() {
- @DatastoreIdentity()
- class Customer {
- }
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- final JdoDatastoreIdentityFacet entityFacet = facetHolder
- .getFacet(JdoDatastoreIdentityFacet.class);
- assertEquals(IdGeneratorStrategy.UNSPECIFIED, entityFacet.getStrategy());
- }
-
- public void testEntityAnnotationWithExplicitStrategyAttributeProvided() {
- @DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY)
- class Customer {
- }
-
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- final JdoDatastoreIdentityFacet entityFacet = facetHolder
- .getFacet(JdoDatastoreIdentityFacet.class);
- assertEquals(IdGeneratorStrategy.IDENTITY, entityFacet.getStrategy());
- }
-
- public void testNoMethodsRemoved() {
- @PersistenceCapable
- class Customer {
- }
-
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- assertNoMethodsRemoved();
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/discriminator/GivenJdoDiscriminatorAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/discriminator/GivenJdoDiscriminatorAnnotationFacetFactoryTest.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/discriminator/GivenJdoDiscriminatorAnnotationFacetFactoryTest.java
deleted file mode 100644
index c50fee0..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/discriminator/GivenJdoDiscriminatorAnnotationFacetFactoryTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.runtimes.dflt.objectstores.jdo.metamodel.facets.object.discriminator;
-
-import java.util.List;
-
-import javax.jdo.annotations.Discriminator;
-import javax.jdo.annotations.PersistenceCapable;
-
-import junit.framework.Assert;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.FacetFactory;
-import org.apache.isis.core.metamodel.facets.object.objecttype.ObjectSpecIdFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
-
-public class GivenJdoDiscriminatorAnnotationFacetFactoryTest extends AbstractFacetFactoryTest {
-
- private JdoDiscriminatorAnnotationFacetFactory facetFactory;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- facetFactory = new JdoDiscriminatorAnnotationFacetFactory();
- }
-
- @Override
- protected void tearDown() throws Exception {
- facetFactory = null;
- super.tearDown();
- }
-
- public void testFeatureTypes() {
- final List<FeatureType> featureTypes = facetFactory.getFeatureTypes();
- Assert.assertTrue(contains(featureTypes, FeatureType.OBJECT));
- assertFalse(contains(featureTypes, FeatureType.PROPERTY));
- assertFalse(contains(featureTypes, FeatureType.COLLECTION));
- Assert.assertFalse(contains(featureTypes, FeatureType.ACTION));
- assertFalse(contains(featureTypes, FeatureType.ACTION_PARAMETER));
- }
-
- public void testDiscriminatorValueAnnotationPickedUpOnClass() {
- @Discriminator("CUS")
- class Customer {
- }
-
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- final Facet facet = facetHolder.getFacet(ObjectSpecIdFacet.class);
- assertNotNull(facet);
- Assert.assertTrue(facet instanceof ObjectSpecIdFacetInferredFromJdoDiscriminatorValueAnnotation);
- }
-
- public void testIfNoEntityAnnotationThenNoFacet() {
-
- class Customer {
- }
-
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- final Facet facet = facetHolder.getFacet(ObjectSpecIdFacet.class);
- assertNull(facet);
- }
-
- public void testAnnotationValue() {
- @Discriminator("CUS")
- class Customer {
- }
-
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- final ObjectSpecIdFacet discriminatorValueFacet = facetHolder.getFacet(ObjectSpecIdFacet.class);
- assertEquals(ObjectSpecId.of("CUS"), discriminatorValueFacet.value());
- }
-
- public void testNoMethodsRemoved() {
- @PersistenceCapable
- class Customer {
- }
-
- facetFactory.process(new FacetFactory.ProcessClassContext(Customer.class, methodRemover, facetHolder));
-
- assertNoMethodsRemoved();
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/embeddedonly/GivenJdoEmbeddedOnlyAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/embeddedonly/GivenJdoEmbeddedOnlyAnnotationFacetFactoryTest.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/embeddedonly/GivenJdoEmbeddedOnlyAnnotationFacetFactoryTest.java
deleted file mode 100644
index 414f422..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/embeddedonly/GivenJdoEmbeddedOnlyAnnotationFacetFactoryTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.runtimes.dflt.objectstores.jdo.metamodel.facets.object.embeddedonly;
-
-import java.util.List;
-
-import junit.framework.Assert;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.FacetFactory;
-import org.apache.isis.core.metamodel.facets.object.aggregated.ParentedFacet;
-import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
-
-
-public class GivenJdoEmbeddedOnlyAnnotationFacetFactoryTest extends
- AbstractFacetFactoryTest {
-
- private JdoEmbeddedOnlyAnnotationFacetFactory facetFactory;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- facetFactory = new JdoEmbeddedOnlyAnnotationFacetFactory();
- }
-
- @Override
- protected void tearDown() throws Exception {
- facetFactory = null;
- super.tearDown();
- }
-
- public void testFeatureTypes() {
- final List<FeatureType> featureTypes = facetFactory
- .getFeatureTypes();
- Assert
- .assertTrue(contains(featureTypes,
- FeatureType.OBJECT));
- assertFalse(contains(featureTypes,
- FeatureType.PROPERTY));
- assertFalse(contains(featureTypes,
- FeatureType.COLLECTION));
- Assert
- .assertFalse(contains(featureTypes,
- FeatureType.ACTION));
- assertFalse(contains(featureTypes,
- FeatureType.ACTION_PARAMETER));
- }
-
-
- public void testAggregatedFacetPickedUpOnType() throws Exception {
- facetFactory.process(new FacetFactory.ProcessClassContext(SimpleObjectWithEmbeddedOnly.class, methodRemover, facetHolder));
-
- final Facet facet = facetHolder.getFacet(ParentedFacet.class);
- assertNotNull(facet);
- Assert
- .assertTrue(facet instanceof ParentedFacetDerivedFromJdoEmbeddedOnlyAnnotation);
- }
-
- public void testJpaEmbeddableFacetPickedUpOnType() throws Exception {
- facetFactory.process(new FacetFactory.ProcessClassContext(SimpleObjectWithEmbeddedOnly.class, methodRemover, facetHolder));
-
- final Facet facet = facetHolder.getFacet(JdoEmbeddedOnlyFacet.class);
- assertNotNull(facet);
- assertTrue(facet instanceof JdoEmbeddedOnlyFacetAnnotation);
- }
-
-
- public void testNoMethodsRemovedForType() throws Exception {
- facetFactory.process(new FacetFactory.ProcessClassContext(SimpleObjectWithEmbeddedOnly.class, methodRemover, facetHolder));
- assertNoMethodsRemoved();
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/embeddedonly/SimpleObjectWithEmbeddedOnly.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/embeddedonly/SimpleObjectWithEmbeddedOnly.java b/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/embeddedonly/SimpleObjectWithEmbeddedOnly.java
deleted file mode 100644
index de86749..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/embeddedonly/SimpleObjectWithEmbeddedOnly.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.runtimes.dflt.objectstores.jdo.metamodel.facets.object.embeddedonly;
-
-import javax.jdo.annotations.EmbeddedOnly;
-import javax.jdo.annotations.PrimaryKey;
-
-@EmbeddedOnly
-public class SimpleObjectWithEmbeddedOnly {
-
- private Long id;
-
- @PrimaryKey
- public Long getId() {
- return id;
- }
-
- public void setId(final Long id) {
- this.id = id;
- }
-}
\ No newline at end of file