[OLINGO-260] provided entity update integration test on proxy

This commit is contained in:
fmartelli 2014-05-13 15:16:45 +02:00 committed by Stephan Klevenz
parent d4400f608e
commit 42c29def0b
2 changed files with 7 additions and 24 deletions

View File

@ -24,7 +24,7 @@ import static org.junit.Assert.assertNotNull;
import java.lang.reflect.Proxy;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.ext.proxy.commons.EntityInvocationHandler;
import org.apache.olingo.ext.proxy.commons.EntityTypeInvocationHandler;
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.
types.ConcurrencyInfo;
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.
@ -113,7 +113,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
@Test
public void concurrentModification() {
Product product = container.getProduct().get(-10);
final String etag = ((EntityInvocationHandler) Proxy.getInvocationHandler(product)).getETag();
final String etag = ((EntityTypeInvocationHandler) Proxy.getInvocationHandler(product)).getETag();
assertTrue(StringUtils.isNotBlank(etag));
final String baseConcurrency = String.valueOf(System.currentTimeMillis());

View File

@ -18,24 +18,20 @@
*/
package org.apache.olingo.fit.proxy.v4;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.lang.reflect.Proxy;
import java.math.BigDecimal;
import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.ext.proxy.commons.EntityInvocationHandler;
import org.apache.olingo.ext.proxy.commons.EntityTypeInvocationHandler;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailKey;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.
PaymentInstrument;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
@ -109,7 +105,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
@Test
public void concurrentModification() {
Order order = container.getOrders().get(8);
final String etag = ((EntityInvocationHandler) Proxy.getInvocationHandler(order)).getETag();
final String etag = ((EntityTypeInvocationHandler) Proxy.getInvocationHandler(order)).getETag();
assertTrue(StringUtils.isNotBlank(etag));
order.setShelfLife(BigDecimal.TEN);
@ -119,17 +115,4 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
order = container.getOrders().get(8);
assertEquals(BigDecimal.TEN, order.getShelfLife());
}
@Test
public void contained() {
PaymentInstrument instrument = container.getAccounts().get(101).getMyPaymentInstruments().get(101901);
final String newName = UUID.randomUUID().toString();
instrument.setFriendlyName(newName);
container.flush();
instrument = container.getAccounts().get(101).getMyPaymentInstruments().get(101901);
assertEquals(newName, instrument.getFriendlyName());
}
}