deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject deltaspike git commit: DELTASPIKE-1154 remove "unused" verifier API for now
Date Mon, 23 May 2016 20:42:00 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 243426f22 -> 0bb287f56


DELTASPIKE-1154 remove "unused" verifier API for now

Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/0bb287f5
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/0bb287f5
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/0bb287f5

Branch: refs/heads/master
Commit: 0bb287f56a3e4d2afc9f731ce56fc03102a7dd08
Parents: 243426f
Author: Thomas Andraschko <tandraschko@apache.org>
Authored: Mon May 23 22:41:53 2016 +0200
Committer: Thomas Andraschko <tandraschko@apache.org>
Committed: Mon May 23 22:41:53 2016 +0200

----------------------------------------------------------------------
 .../extractor/AnnotationMetadataExtractor.java  |  3 +-
 .../data/impl/meta/verifier/EntityVerifier.java | 35 -----------
 .../data/impl/meta/verifier/Verifier.java       | 26 --------
 .../deltaspike/data/impl/util/EntityUtils.java  |  4 +-
 .../impl/meta/verifier/EntityVerifierTest.java  | 62 --------------------
 .../data/impl/util/EntityUtilsTest.java         | 30 +++++++++-
 6 files changed, 32 insertions(+), 128 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/0bb287f5/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/extractor/AnnotationMetadataExtractor.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/extractor/AnnotationMetadataExtractor.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/extractor/AnnotationMetadataExtractor.java
index 0801ea9..46bedc8 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/extractor/AnnotationMetadataExtractor.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/extractor/AnnotationMetadataExtractor.java
@@ -20,7 +20,6 @@ package org.apache.deltaspike.data.impl.meta.extractor;
 
 import org.apache.deltaspike.data.api.Repository;
 import org.apache.deltaspike.data.impl.meta.RepositoryEntity;
-import org.apache.deltaspike.data.impl.meta.verifier.EntityVerifier;
 import org.apache.deltaspike.data.impl.util.EntityUtils;
 
 public class AnnotationMetadataExtractor implements MetadataExtractor
@@ -31,7 +30,7 @@ public class AnnotationMetadataExtractor implements MetadataExtractor
     {
         Repository repo = repoClass.getAnnotation(Repository.class);
         Class<?> repoEntity = repo.forEntity();
-        boolean isEntityClass = !Object.class.equals(repoEntity) && EntityVerifier.INSTANCE.verify(repoEntity);
+        boolean isEntityClass = !Object.class.equals(repoEntity) && EntityUtils.isEntityClass(repoEntity);
         if (isEntityClass)
         {
             return new RepositoryEntity(repoEntity, EntityUtils.primaryKeyClass(repoEntity));

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/0bb287f5/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/verifier/EntityVerifier.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/verifier/EntityVerifier.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/verifier/EntityVerifier.java
deleted file mode 100644
index 5ef310a..0000000
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/verifier/EntityVerifier.java
+++ /dev/null
@@ -1,35 +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.deltaspike.data.impl.meta.verifier;
-
-import javax.persistence.Entity;
-import org.apache.deltaspike.jpa.spi.descriptor.xml.PersistenceUnitDescriptorProvider;
-
-public class EntityVerifier implements Verifier<Class<?>>
-{
-    public static final EntityVerifier INSTANCE = new EntityVerifier();
-
-    @Override
-    public boolean verify(Class<?> entity)
-    {
-        return entity.isAnnotationPresent(Entity.class)
-                || PersistenceUnitDescriptorProvider.getInstance().isEntity(entity);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/0bb287f5/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/verifier/Verifier.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/verifier/Verifier.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/verifier/Verifier.java
deleted file mode 100644
index 62fe3ab..0000000
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/verifier/Verifier.java
+++ /dev/null
@@ -1,26 +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.deltaspike.data.impl.meta.verifier;
-
-public interface Verifier<T>
-{
-
-    boolean verify(T t);
-
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/0bb287f5/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/EntityUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/EntityUtils.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/EntityUtils.java
index 54444b6..cfe2606 100755
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/EntityUtils.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/EntityUtils.java
@@ -32,7 +32,6 @@ import javax.persistence.Version;
 import javax.persistence.metamodel.EntityType;
 import org.apache.deltaspike.core.util.StringUtils;
 
-import org.apache.deltaspike.data.impl.meta.verifier.EntityVerifier;
 import org.apache.deltaspike.data.impl.property.Property;
 import org.apache.deltaspike.data.impl.property.query.AnnotatedPropertyCriteria;
 import org.apache.deltaspike.data.impl.property.query.NamedPropertyCriteria;
@@ -109,7 +108,8 @@ public final class EntityUtils
 
     public static boolean isEntityClass(Class<?> entityClass)
     {
-        return EntityVerifier.INSTANCE.verify(entityClass);
+        return entityClass.isAnnotationPresent(Entity.class)
+                || PersistenceUnitDescriptorProvider.getInstance().isEntity(entityClass);
     }
 
     public static Property<Serializable> primaryKeyProperty(Class<?> entityClass)

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/0bb287f5/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/meta/verifier/EntityVerifierTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/meta/verifier/EntityVerifierTest.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/meta/verifier/EntityVerifierTest.java
deleted file mode 100644
index e190022..0000000
--- a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/meta/verifier/EntityVerifierTest.java
+++ /dev/null
@@ -1,62 +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.deltaspike.data.impl.meta.verifier;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.deltaspike.data.impl.meta.verifier.EntityVerifier;
-import org.apache.deltaspike.data.test.domain.Simple;
-import org.junit.Test;
-
-public class EntityVerifierTest
-{
-
-    @Test
-    public void should_accept_entity_class()
-    {
-        // given
-        EntityVerifier entityVerifier = new EntityVerifier();
-
-        // when
-        boolean isValid = entityVerifier.verify(Simple.class);
-
-        // then
-        assertTrue(isValid);
-    }
-
-    @Test
-    public void should_not_accept_class_without_entity_annotation()
-    {
-        // given
-        EntityVerifier entityVerifier = new EntityVerifier();
-
-        // when
-        boolean isValid = entityVerifier.verify(EntityWithoutId.class);
-
-        // then
-        assertFalse(isValid);
-
-    }
-
-    private static class EntityWithoutId
-    {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/0bb287f5/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/util/EntityUtilsTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/util/EntityUtilsTest.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/util/EntityUtilsTest.java
index cde1590..fa8bd81 100755
--- a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/util/EntityUtilsTest.java
+++ b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/util/EntityUtilsTest.java
@@ -20,7 +20,7 @@ package org.apache.deltaspike.data.impl.util;
 
 import java.io.Serializable;
 
-import org.apache.deltaspike.data.impl.util.EntityUtils;
+import org.apache.deltaspike.data.test.domain.Simple;
 import org.apache.deltaspike.data.test.domain.Tee;
 import org.apache.deltaspike.data.test.domain.Tee2;
 import org.apache.deltaspike.data.test.domain.TeeId;
@@ -53,4 +53,32 @@ public class EntityUtilsTest
         // then
         Assert.assertEquals(TeeId.class, pkClass);
     }
+    
+    @Test
+    public void should_accept_entity_class()
+    {
+        // given
+
+        // when
+        boolean isValid = EntityUtils.isEntityClass(Simple.class);
+
+        // then
+        Assert.assertTrue(isValid);
+    }
+
+    @Test
+    public void should_not_accept_class_without_entity_annotation()
+    {
+        // given
+
+        // when
+        boolean isValid = EntityUtils.isEntityClass(EntityWithoutId.class);
+
+        // then
+        Assert.assertFalse(isValid);
+    }
+
+    private static class EntityWithoutId
+    {
+    }
 }


Mime
View raw message