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/05/27 11:00:44 UTC

[2/3] [OLINGO-260] Adding option to work non-transactionally (e.g. without batch)

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a66bd98b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalAuthEntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalAuthEntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalAuthEntityCreateTestITCase.java
new file mode 100644
index 0000000..1dd08b5
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalAuthEntityCreateTestITCase.java
@@ -0,0 +1,53 @@
+/*
+ * 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.olingo.fit.proxy.v4;
+
+import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.ext.proxy.EntityContainerFactory;
+
+import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
+import static org.apache.olingo.fit.proxy.v4.AbstractTestITCase.testAuthServiceRootURL;
+import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+
+public class NonTransactionalAuthEntityCreateTestITCase extends EntityCreateTestITCase {
+
+  private EntityContainerFactory<EdmEnabledODataClient> ecf;
+
+  private InMemoryEntities ime;
+
+  @Override
+  protected EntityContainerFactory<EdmEnabledODataClient> getContainerFactory() {
+    if (ecf == null) {
+      ecf = EntityContainerFactory.getV4(testAuthServiceRootURL, false);
+      ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+      ecf.getClient().getConfiguration().
+              setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
+    }
+    return ecf;
+  }
+
+  @Override
+  protected InMemoryEntities getContainer() {
+    if (ime == null) {
+      ime = getContainerFactory().getEntityContainer(InMemoryEntities.class);
+    }
+    return ime;
+  }  
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a66bd98b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityCreateTestITCase.java
new file mode 100644
index 0000000..ac31cfe
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityCreateTestITCase.java
@@ -0,0 +1,50 @@
+/*
+ * 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.olingo.fit.proxy.v4;
+
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.ext.proxy.EntityContainerFactory;
+
+import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
+import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+
+public class NonTransactionalEntityCreateTestITCase extends EntityCreateTestITCase {
+
+  private EntityContainerFactory<EdmEnabledODataClient> ecf;
+
+  private InMemoryEntities ime;
+
+  @Override
+  protected EntityContainerFactory<EdmEnabledODataClient> getContainerFactory() {
+    if (ecf == null) {
+      ecf = EntityContainerFactory.getV4(testStaticServiceRootURL, false);
+      ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+    }
+    return ecf;
+  }
+
+  @Override
+  protected InMemoryEntities getContainer() {
+    if (ime == null) {
+      ime = getContainerFactory().getEntityContainer(InMemoryEntities.class);
+    }
+    return ime;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a66bd98b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityUpdateTestITCase.java
new file mode 100644
index 0000000..4b8c6e9
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityUpdateTestITCase.java
@@ -0,0 +1,49 @@
+/*
+ * 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.olingo.fit.proxy.v4;
+
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.ext.proxy.EntityContainerFactory;
+
+import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
+import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+
+public class NonTransactionalEntityUpdateTestITCase extends EntityUpdateTestITCase {
+
+  private EntityContainerFactory<EdmEnabledODataClient> ecf;
+
+  private InMemoryEntities ime;
+
+  @Override
+  protected EntityContainerFactory<EdmEnabledODataClient> getContainerFactory() {
+    if (ecf == null) {
+      ecf = EntityContainerFactory.getV4(testStaticServiceRootURL, false);
+      ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+    }
+    return ecf;
+  }
+
+  @Override
+  protected InMemoryEntities getContainer() {
+    if (ime == null) {
+      ime = getContainerFactory().getEntityContainer(InMemoryEntities.class);
+    }
+    return ime;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a66bd98b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalMediaEntityTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalMediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalMediaEntityTestITCase.java
new file mode 100644
index 0000000..1c3c583
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalMediaEntityTestITCase.java
@@ -0,0 +1,50 @@
+/*
+ * 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.olingo.fit.proxy.v4;
+
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.ext.proxy.EntityContainerFactory;
+
+import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
+import org.apache.olingo.fit.proxy.v4.demo.odatademo.DemoService;
+
+public class NonTransactionalMediaEntityTestITCase extends MediaEntityTestITCase {
+
+  private EntityContainerFactory<EdmEnabledODataClient> ecf;
+
+  private DemoService ime;
+
+  @Override
+  protected EntityContainerFactory<EdmEnabledODataClient> getContainerFactory() {
+    if (ecf == null) {
+      ecf = EntityContainerFactory.getV4(testDemoServiceRootURL, false);
+      ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+    }
+    return ecf;
+  }
+
+  @Override
+  protected DemoService getContainer() {
+    if (ime == null) {
+      ime = getContainerFactory().getEntityContainer(DemoService.class);
+    }
+    return ime;
+  }
+
+}