mirror of
https://github.com/apache/olingo-odata4.git
synced 2025-02-06 01:59:12 +00:00
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/olingo-odata4
This commit is contained in:
commit
ed8e0e3cc1
@ -110,13 +110,6 @@
|
|||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
</resource>
|
</resource>
|
||||||
<resource>
|
|
||||||
<directory>..</directory>
|
|
||||||
<targetPath>META-INF</targetPath>
|
|
||||||
<includes>
|
|
||||||
<include>LICENSE</include>
|
|
||||||
</includes>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
<testResources>
|
<testResources>
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
package org.apache.olingo.fit.proxy.v3;
|
package org.apache.olingo.fit.proxy.v3;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
|
import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
|
||||||
import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
|
|
||||||
import org.apache.olingo.ext.proxy.EntityContainerFactory;
|
import org.apache.olingo.ext.proxy.EntityContainerFactory;
|
||||||
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.
|
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.
|
||||||
DefaultContainer;
|
DefaultContainer;
|
||||||
@ -31,19 +31,17 @@ import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.service
|
|||||||
public class AuthEntityRetrieveTestITCase extends EntityRetrieveTestITCase {
|
public class AuthEntityRetrieveTestITCase extends EntityRetrieveTestITCase {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void enableBasicAuth() {
|
public static void setupContaner() {
|
||||||
|
containerFactory = EntityContainerFactory.getV3(testAuthServiceRootURL);
|
||||||
containerFactory.getConfiguration().
|
containerFactory.getConfiguration().
|
||||||
setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
|
setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
|
||||||
|
container = containerFactory.getEntityContainer(DefaultContainer.class);
|
||||||
|
assertNotNull(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void disableBasicAuth() {
|
public static void disableBasicAuth() {
|
||||||
containerFactory.getConfiguration().setHttpClientFactory(new DefaultHttpClientFactory());
|
containerFactory = EntityContainerFactory.getV3(testStaticServiceRootURL);
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
public static void setupContaner() {
|
|
||||||
containerFactory = EntityContainerFactory.getV3(testAuthServiceRootURL);
|
|
||||||
container = containerFactory.getEntityContainer(DefaultContainer.class);
|
container = containerFactory.getEntityContainer(DefaultContainer.class);
|
||||||
assertNotNull(container);
|
assertNotNull(container);
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.olingo.fit.proxy.v3;
|
package org.apache.olingo.fit.proxy.v3;
|
||||||
|
|
||||||
|
import static org.apache.olingo.fit.proxy.v3.AbstractTest.container;
|
||||||
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.
|
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.
|
||||||
types.Customer;
|
types.Customer;
|
||||||
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.
|
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.
|
||||||
@ -44,8 +45,8 @@ import org.junit.Test;
|
|||||||
public class EntityCreateTestITCase extends AbstractTest {
|
public class EntityCreateTestITCase extends AbstractTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
|
||||||
public void create() {
|
public void create() {
|
||||||
|
container.getCustomer().get(-10);
|
||||||
final String sampleName = "sample customer from proxy";
|
final String sampleName = "sample customer from proxy";
|
||||||
final Integer id = 100;
|
final Integer id = 100;
|
||||||
|
|
||||||
@ -108,7 +109,6 @@ public class EntityCreateTestITCase extends AbstractTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
|
||||||
public void createWithNavigation() {
|
public void createWithNavigation() {
|
||||||
final String sampleName = "sample customer from proxy with navigation";
|
final String sampleName = "sample customer from proxy with navigation";
|
||||||
final Integer id = 101;
|
final Integer id = 101;
|
||||||
@ -178,7 +178,6 @@ public class EntityCreateTestITCase extends AbstractTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
|
||||||
public void multiKey() {
|
public void multiKey() {
|
||||||
Message message = container.getMessage().newMessage();
|
Message message = container.getMessage().newMessage();
|
||||||
message.setMessageId(100);
|
message.setMessageId(100);
|
||||||
|
@ -18,31 +18,29 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.olingo.fit.proxy.v4;
|
package org.apache.olingo.fit.proxy.v4;
|
||||||
|
|
||||||
import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
|
|
||||||
import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
|
|
||||||
import org.apache.olingo.ext.proxy.EntityContainerFactory;
|
|
||||||
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
|
import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
|
||||||
|
import org.apache.olingo.ext.proxy.EntityContainerFactory;
|
||||||
|
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
|
||||||
|
|
||||||
public class AuthEntityRetrieveTestITCase extends EntityRetrieveTestITCase {
|
public class AuthEntityRetrieveTestITCase extends EntityRetrieveTestITCase {
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
public static void enableBasicAuth() {
|
|
||||||
containerFactory.getConfiguration().
|
|
||||||
setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterClass
|
|
||||||
public static void disableBasicAuth() {
|
|
||||||
containerFactory.getConfiguration().setHttpClientFactory(new DefaultHttpClientFactory());
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupContaner() {
|
public static void setupContaner() {
|
||||||
containerFactory = EntityContainerFactory.getV3(testAuthServiceRootURL);
|
containerFactory = EntityContainerFactory.getV3(testAuthServiceRootURL);
|
||||||
|
containerFactory.getConfiguration().
|
||||||
|
setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
|
||||||
|
container = containerFactory.getEntityContainer(InMemoryEntities.class);
|
||||||
|
assertNotNull(container);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void disableBasicAuth() {
|
||||||
|
containerFactory = EntityContainerFactory.getV3(testStaticServiceRootURL);
|
||||||
container = containerFactory.getEntityContainer(InMemoryEntities.class);
|
container = containerFactory.getEntityContainer(InMemoryEntities.class);
|
||||||
assertNotNull(container);
|
assertNotNull(container);
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
|
|||||||
createReq.setPrefer(client.newPreferences().returnContent());
|
createReq.setPrefer(client.newPreferences().returnContent());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final ODataEntityCreateResponse createRes = createReq.execute();
|
final ODataEntityCreateResponse<ODataEntity> createRes = createReq.execute();
|
||||||
assertEquals(201, createRes.getStatusCode());
|
assertEquals(201, createRes.getStatusCode());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
fail(e.getMessage());
|
fail(e.getMessage());
|
||||||
|
@ -407,8 +407,20 @@ public final class URIUtils {
|
|||||||
|
|
||||||
public static HttpEntity buildInputStreamEntity(final CommonODataClient<?> client, final InputStream input) {
|
public static HttpEntity buildInputStreamEntity(final CommonODataClient<?> client, final InputStream input) {
|
||||||
HttpEntity entity;
|
HttpEntity entity;
|
||||||
|
|
||||||
|
// --------------------------
|
||||||
|
// Check just required by batch requests since their ansynchronous entity specification mechanism
|
||||||
|
// --------------------------
|
||||||
|
boolean contentAvailable;
|
||||||
|
try {
|
||||||
|
contentAvailable = input.available()>0;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
contentAvailable = false;
|
||||||
|
}
|
||||||
|
// --------------------------
|
||||||
|
|
||||||
boolean repeatableRequired = shouldUseRepeatableHttpBodyEntry(client);
|
boolean repeatableRequired = shouldUseRepeatableHttpBodyEntry(client);
|
||||||
if (!repeatableRequired) {
|
if (!contentAvailable || !repeatableRequired) {
|
||||||
entity = new InputStreamEntity(input, -1);
|
entity = new InputStreamEntity(input, -1);
|
||||||
} else {
|
} else {
|
||||||
byte[] bytes = new byte[0];
|
byte[] bytes = new byte[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user