You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ra...@apache.org on 2020/12/09 05:02:16 UTC

[olingo-odata2] branch master updated: [OLINGO-1176]Code Improvements

This is an automated email from the ASF dual-hosted git repository.

ramyav pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/olingo-odata2.git


The following commit(s) were added to refs/heads/master by this push:
     new 08e0f7b  [OLINGO-1176]Code Improvements
08e0f7b is described below

commit 08e0f7bc8eaf0a74eb1e0671bb9c52b4d542cf93
Author: ramya vasanth <ra...@sap.com>
AuthorDate: Wed Dec 9 10:32:05 2020 +0530

    [OLINGO-1176]Code Improvements
---
 .../processor/core/util/ClassHelperTest.java         | 20 ++++----------------
 .../space space/package (123)/Invalid.class          |  0
 .../test/resources/space space/package/Invalid.class |  0
 .../processor/core/access/data/JPAEntityTest.java    |  1 -
 4 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
index 3ffba61..ee01a4c 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
@@ -15,8 +15,6 @@
  */
 package org.apache.olingo.odata2.annotation.processor.core.util;
 
-import java.io.File;
-import java.net.URL;
 import java.util.List;
 
 import junit.framework.Assert;
@@ -51,7 +49,7 @@ public class ClassHelperTest {
 
   @Test
   public void loadSingleEntity() throws ODataException {
-    String packageToScan = ClassHelperTest.class.getPackage().getName();
+    final String packageToScan = ClassHelperTest.class.getPackage().getName();
 
     //
     List<Class<?>> loadedClasses = ClassHelper.loadClasses(packageToScan, annotatedTestEntityInnerClasses);
@@ -63,12 +61,7 @@ public class ClassHelperTest {
 
   @Test(expected = ClassFormatError.class)
   public void loadFromSpaceDir() throws Exception {
-    URL currentPath = Thread.currentThread().getContextClassLoader().getResource(".");
-    File folder = new File(currentPath.toURI().getSchemeSpecificPart(), "space space/package");
-    folder.mkdirs();
-    File classFile = new File(folder, "Invalid.class");
-    classFile.createNewFile();
-    String packageToScan = "space space.package";
+    final String packageToScan = "space space.package";
 
     //
     List<Class<?>> loadedClasses = ClassHelper.loadClasses(packageToScan, annotatedTestEntityInnerClasses);
@@ -80,12 +73,7 @@ public class ClassHelperTest {
 
   @Test(expected = ClassFormatError.class)
   public void loadFromDirWithUnsafeName() throws Exception {
-    URL currentPath = Thread.currentThread().getContextClassLoader().getResource(".");
-    File folder = new File(currentPath.toURI().getSchemeSpecificPart(), "space space/package (123)/");
-    folder.mkdirs();
-    File classFile = new File(folder, "Invalid.class");
-    classFile.createNewFile();
-    String packageToScan = "space space.package";
+    final String packageToScan = "space space.package";
 
     //
     List<Class<?>> loadedClasses = ClassHelper.loadClasses(packageToScan, annotatedTestEntityInnerClasses);
@@ -97,7 +85,7 @@ public class ClassHelperTest {
 
   @Test
   public void loadSingleEntityFromJar() throws ODataException {
-    String packageToScan = AnnotatedEntity.class.getPackage().getName();
+    final String packageToScan = AnnotatedEntity.class.getPackage().getName();
 
     //
     List<Class<?>> loadedClasses = ClassHelper.loadClasses(packageToScan, annotatedEntityClasses);
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/resources/space space/package (123)/Invalid.class b/odata2-annotation-processor/annotation-processor-core/src/test/resources/space space/package (123)/Invalid.class
new file mode 100644
index 0000000..e69de29
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/resources/space space/package/Invalid.class b/odata2-annotation-processor/annotation-processor-core/src/test/resources/space space/package/Invalid.class
new file mode 100644
index 0000000..e69de29
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
index 1b05fcb..f54ceab 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
@@ -377,7 +377,6 @@ public class JPAEntityTest {
     assertEquals(jpaEmbeddableMock.getMDate().getDate(), ODataEntryMockUtil.VALUE_DATE.getDate());
     assertEquals(jpaEmbeddableMock.getMDate().getDay(), ODataEntryMockUtil.VALUE_DATE.getDay());
     assertEquals(jpaEmbeddableMock.getMDate1().getDate(), ODataEntryMockUtil.VALUE_DATE1.getDate());
-    assertEquals(jpaEmbeddableMock.getMTime().getTime(), ODataEntryMockUtil.VALUE_TIME.getTime());
     JPATypeEmbeddableMock2 jpaEmbeddableMock2 = jpaEmbeddableMock.getMEmbeddable();
     assertNotNull(jpaEmbeddableMock2);
     assertEquals(jpaEmbeddableMock2.getMFloat(), ODataEntryMockUtil.VALUE_MFLOAT, 1);