You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/08/04 13:09:55 UTC

[1/2] git commit: Turning log4j.properties into log4j.xml and tuning things to avoid Tomcat's DEBUG statement polluting the log file

Repository: olingo-odata4
Updated Branches:
  refs/heads/olingo365 fce2155cd -> 34f082560


Turning log4j.properties into log4j.xml and tuning things to avoid Tomcat's DEBUG statement polluting the log file


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/a13a0d86
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/a13a0d86
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/a13a0d86

Branch: refs/heads/olingo365
Commit: a13a0d865f6240190f60909bbdd37739d407f3d7
Parents: fce2155
Author: Francesco Chicchiriccò <--global>
Authored: Mon Aug 4 12:07:01 2014 +0200
Committer: Francesco Chicchiriccò <--global>
Committed: Mon Aug 4 12:07:01 2014 +0200

----------------------------------------------------------------------
 fit/src/main/resources/log4j.properties | 23 ------------
 fit/src/main/resources/log4j.xml        | 53 ++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a13a0d86/fit/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/log4j.properties b/fit/src/main/resources/log4j.properties
deleted file mode 100644
index 0b0bb4d..0000000
--- a/fit/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,23 +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.
-#
-log4j.rootLogger=DEBUG, FILE
-log4j.appender.FILE=org.apache.log4j.RollingFileAppender
-log4j.appender.FILE.File=${project.build.directory}/emb-tom-fit/fit.log
-log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
-log4j.appender.FILE.layout.ConversionPattern=[%-5p] %r %c - %m%n

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a13a0d86/fit/src/main/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/log4j.xml b/fit/src/main/resources/log4j.xml
new file mode 100644
index 0000000..5af23dd
--- /dev/null
+++ b/fit/src/main/resources/log4j.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC
+  "-//APACHE//DTD LOG4J 1.2//EN" 
+  "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
+<!--
+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.
+-->
+<log4j:configuration debug="true"
+                     xmlns:log4j='http://jakarta.apache.org/log4j/'>
+
+  <appender name="fitlog" class="org.apache.log4j.RollingFileAppender">
+    <param name="append" value="false"/>
+    <param name="file" value="${project.build.directory}/emb-tom-fit/fit.log"/>
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %C:%L - %m%n"/>
+    </layout>
+  </appender>
+  
+  <logger name="org.apache.tomcat">
+    <level value="ERROR" />
+    <appender-ref ref="fitlog"/>
+  </logger>
+  <logger name="org.apache.catalina">
+    <level value="ERROR" />
+    <appender-ref ref="fitlog"/>
+  </logger>
+
+  <logger name="org.apache.cxf">
+    <level value="ERROR" />
+    <appender-ref ref="fitlog"/>
+  </logger>
+
+  <root>
+    <level value="DEBUG"/>
+    <appender-ref ref="fitlog"/>
+  </root>
+
+</log4j:configuration>
\ No newline at end of file


[2/2] git commit: [OLINGO-365] Adding checks for enhanced composable invoker

Posted by il...@apache.org.
[OLINGO-365] Adding checks for enhanced composable invoker


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/34f08256
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/34f08256
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/34f08256

Branch: refs/heads/olingo365
Commit: 34f0825604a76a8803a357bd9c9ccaf88657d264
Parents: a13a0d8
Author: Francesco Chicchiriccò <--global>
Authored: Mon Aug 4 13:09:47 2014 +0200
Committer: Francesco Chicchiriccò <--global>
Committed: Mon Aug 4 13:09:47 2014 +0200

----------------------------------------------------------------------
 .../java/org/apache/olingo/fit/V4Services.java  | 67 ++++++++++++++------
 .../fit/proxy/v4/APIBasicDesignTestITCase.java  | 22 ++++++-
 2 files changed, 68 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/34f08256/fit/src/main/java/org/apache/olingo/fit/V4Services.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4Services.java b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
index 5b59ddc..4f751aa 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
@@ -112,19 +112,6 @@ public class V4Services extends AbstractServices {
     super(ODataServiceVersion.V40, metadata);
   }
 
-  @POST
-  @Path("/GetAllProducts()/Discount")
-  public Response discount() {
-    try {
-      final String basePath = "Products" + File.separatorChar + "feed";
-
-      final InputStream feed = FSManager.instance(version).readFile(basePath, Accept.JSON_FULLMETA);
-      return xml.createResponse(null, feed, Commons.getETag(basePath, version), Accept.JSON_FULLMETA);
-    } catch (Exception e) {
-      return xml.createFaultResponse(Accept.JSON_FULLMETA.toString(version), e);
-    }
-  }
-
   @GET
   @Path("/redirect/{name}({id})")
   public Response conformanceRedirect(
@@ -386,7 +373,7 @@ public class V4Services extends AbstractServices {
     return StringUtils.isBlank(filter) && StringUtils.isBlank(search)
             ? NumberUtils.isNumber(type)
             ? super.getEntityInternal(
-            uriInfo.getRequestUri().toASCIIString(), accept, "People", type, format, null, null)
+                    uriInfo.getRequestUri().toASCIIString(), accept, "People", type, format, null, null)
             : super.getEntitySet(accept, "People", type)
             : super.getEntitySet(uriInfo, accept, "People", top, skip, format, count, filter, orderby, skiptoken);
   }
@@ -767,7 +754,7 @@ public class V4Services extends AbstractServices {
 
       return utils.getValue().createResponse(
               FSManager.instance(version).readFile(Constants.get(version, ConstantKey.REF)
-              + File.separatorChar + filename, utils.getKey()),
+                      + File.separatorChar + filename, utils.getKey()),
               null,
               utils.getKey());
     } catch (Exception e) {
@@ -807,7 +794,7 @@ public class V4Services extends AbstractServices {
 
     final Response response =
             getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
-            accept, entitySetName, entityId, accept, StringUtils.EMPTY, StringUtils.EMPTY);
+                    accept, entitySetName, entityId, accept, StringUtils.EMPTY, StringUtils.EMPTY);
     return response.getStatus() >= 400
             ? super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, changes)
             : super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId, changes);
@@ -1033,7 +1020,7 @@ public class V4Services extends AbstractServices {
       // 1. Fetch the contained entity to be removed
       final InputStream entry = FSManager.instance(version).
               readFile(containedPath(entityId, containedEntitySetName).
-              append('(').append(containedEntityId).append(')').toString(), Accept.ATOM);
+                      append('(').append(containedEntityId).append(')').toString(), Accept.ATOM);
       final ResWrap<Entity> container = atomDeserializer.toEntity(entry);
 
       // 2. Remove the contained entity
@@ -1161,6 +1148,37 @@ public class V4Services extends AbstractServices {
   }
 
   @GET
+  @Path("/GetPerson2({param:.*})/Emails")
+  public Response functionGetPerson2Emails(
+          @Context final UriInfo uriInfo,
+          @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+          @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+    return getPath(accept, "Customers", "1", "Emails", format);
+  }
+
+  @GET
+  @Path("/GetPerson2({param:.*})/HomeAddress")
+  public Response functionGetPerson2HomeAddress(
+          @Context final UriInfo uriInfo,
+          @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+          @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+    return getPath(accept, "Customers", "1", "HomeAddress", format);
+  }
+
+  @GET
+  @Path("/GetPerson2({param:.*})/Parent")
+  public Response functionGetPerson2Parent(
+          @Context final UriInfo uriInfo,
+          @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+          @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+    return getEntityInternal(
+            uriInfo.getRequestUri().toASCIIString(), accept, "Customers", "2", format, null, null);
+  }
+
+  @GET
   @Path("/GetPerson({param:.*})")
   public Response functionGetPerson(
           @Context final UriInfo uriInfo,
@@ -1284,6 +1302,19 @@ public class V4Services extends AbstractServices {
   }
 
   @POST
+  @Path("/GetAllProducts()/Discount")
+  public Response actionBoundDiscount() {
+    try {
+      final String basePath = "Products" + File.separatorChar + "feed";
+
+      final InputStream feed = FSManager.instance(version).readFile(basePath, Accept.JSON_FULLMETA);
+      return xml.createResponse(null, feed, Commons.getETag(basePath, version), Accept.JSON_FULLMETA);
+    } catch (Exception e) {
+      return xml.createFaultResponse(Accept.JSON_FULLMETA.toString(version), e);
+    }
+  }
+
+  @POST
   @Path("/ResetBossAddress()")
   public Response actionResetBossAddress(
           @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
@@ -1307,7 +1338,7 @@ public class V4Services extends AbstractServices {
 
       final ResWrap<Property> result = new ResWrap<Property>(
               URI.create(Constants.get(version, ConstantKey.ODATA_METADATA_PREFIX)
-              + "Microsoft.Test.OData.Services.ODataWCFService.Address"),
+                      + "Microsoft.Test.OData.Services.ODataWCFService.Address"),
               null,
               entity.getProperty("address"));
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/34f08256/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
index ce537de..7d592c6 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
@@ -550,10 +550,26 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
             expand("ProductDetail").
             orderBy("Name").skip(3).top(5).execute();
 
+    // Complex/Entity
     final PersonComposableInvoker invoker2 = container.operations().getPerson2("London");
 
-    // Complex/Entity (available only select and expand: after query option composition is not available anymore)
-    invoker2.select("Name"). // after the first query option no composition is possible
-            expand("Order").execute();
+    // a. whole entity
+    final Person person = invoker2.select("Name").expand("Order").execute();
+    assertNotNull(person);
+    assertEquals(1, person.getPersonID(), 0);
+
+    // b. primitive collection property
+    final PrimitiveCollection<String> emails = invoker2.getEmails().execute();
+    assertNotNull(emails);
+    assertFalse(emails.isEmpty());
+
+    // c. complex property
+    final Address homeAddress = invoker2.getHomeAddress().load();
+    assertNotNull(homeAddress);
+
+    // d. navigation property
+    final Person parent = invoker2.getParent().load();
+    assertNotNull(parent);
+    assertEquals(2, parent.getPersonID(), 0);
   }
 }