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/22 13:22:27 UTC

[3/9] [OLINGO-260] Merge from master

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/1abd8e7e/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ContextTestITCase.java
----------------------------------------------------------------------
diff --cc fit/src/test/java/org/apache/olingo/fit/proxy/v3/ContextTestITCase.java
index a3a78b4,df6ef13..8db857a
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ContextTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ContextTestITCase.java
@@@ -62,21 -62,21 +62,21 @@@ public class ContextTestITCase extends 
      final Customer customer1 = container.getCustomer().newCustomer();
      final Customer customer2 = container.getCustomer().newCustomer();
  
-     final EntityTypeInvocationHandler source1 =
-             (EntityTypeInvocationHandler) Proxy.getInvocationHandler(customer1);
-     final EntityTypeInvocationHandler source2 =
-             (EntityTypeInvocationHandler) Proxy.getInvocationHandler(customer2);
+     final EntityInvocationHandler source1 =
+             (EntityInvocationHandler) Proxy.getInvocationHandler(customer1);
+     final EntityInvocationHandler source2 =
+             (EntityInvocationHandler) Proxy.getInvocationHandler(customer2);
  
 -    assertTrue(entityContext.isAttached(source1));
 -    assertTrue(entityContext.isAttached(source2));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(source1));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(source2));
  
 -    entityContext.detach(source1);
 -    assertFalse(entityContext.isAttached(source1));
 -    assertTrue(entityContext.isAttached(source2));
 +    containerFactory.getContext().entityContext().detach(source1);
 +    assertFalse(containerFactory.getContext().entityContext().isAttached(source1));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(source2));
  
 -    entityContext.detach(source2);
 -    assertFalse(entityContext.isAttached(source1));
 -    assertFalse(entityContext.isAttached(source2));
 +    containerFactory.getContext().entityContext().detach(source2);
 +    assertFalse(containerFactory.getContext().entityContext().isAttached(source1));
 +    assertFalse(containerFactory.getContext().entityContext().isAttached(source2));
    }
  
    @Test
@@@ -85,29 -85,29 +85,29 @@@
      final Customer customer2 = container.getCustomer().get(-9);
      final Customer customer3 = container.getCustomer().get(-10);
  
-     final EntityTypeInvocationHandler source1 =
-             (EntityTypeInvocationHandler) Proxy.getInvocationHandler(customer1);
-     final EntityTypeInvocationHandler source2 =
-             (EntityTypeInvocationHandler) Proxy.getInvocationHandler(customer2);
-     final EntityTypeInvocationHandler source3 =
-             (EntityTypeInvocationHandler) Proxy.getInvocationHandler(customer3);
+     final EntityInvocationHandler source1 =
+             (EntityInvocationHandler) Proxy.getInvocationHandler(customer1);
+     final EntityInvocationHandler source2 =
+             (EntityInvocationHandler) Proxy.getInvocationHandler(customer2);
+     final EntityInvocationHandler source3 =
+             (EntityInvocationHandler) Proxy.getInvocationHandler(customer3);
  
 -    assertFalse(entityContext.isAttached(source1));
 -    assertFalse(entityContext.isAttached(source2));
 -    assertFalse(entityContext.isAttached(source3));
 +    assertFalse(containerFactory.getContext().entityContext().isAttached(source1));
 +    assertFalse(containerFactory.getContext().entityContext().isAttached(source2));
 +    assertFalse(containerFactory.getContext().entityContext().isAttached(source3));
  
 -    entityContext.attach(source1);
 -    assertTrue(entityContext.isAttached(source1));
 -    assertFalse(entityContext.isAttached(source2));
 -    assertTrue(entityContext.isAttached(source3));
 +    containerFactory.getContext().entityContext().attach(source1);
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(source1));
 +    assertFalse(containerFactory.getContext().entityContext().isAttached(source2));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(source3));
  
 -    entityContext.attach(source2);
 -    assertTrue(entityContext.isAttached(source1));
 -    assertTrue(entityContext.isAttached(source2));
 -    assertTrue(entityContext.isAttached(source3));
 +    containerFactory.getContext().entityContext().attach(source2);
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(source1));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(source2));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(source3));
  
      try {
 -      entityContext.attach(source3);
 +      containerFactory.getContext().entityContext().attach(source3);
        fail();
      } catch (IllegalStateException ignore) {
        // ignore
@@@ -133,15 -133,15 +133,15 @@@
  
      assertNotNull(customer.getInfo());
  
-     final EntityTypeInvocationHandler source =
-             (EntityTypeInvocationHandler) Proxy.getInvocationHandler(customer);
-     final EntityTypeInvocationHandler target =
-             (EntityTypeInvocationHandler) Proxy.getInvocationHandler(customerInfo);
+     final EntityInvocationHandler source =
+             (EntityInvocationHandler) Proxy.getInvocationHandler(customer);
+     final EntityInvocationHandler target =
+             (EntityInvocationHandler) Proxy.getInvocationHandler(customerInfo);
  
 -    assertTrue(entityContext.isAttached(source));
 -    assertEquals(AttachedEntityStatus.NEW, entityContext.getStatus(source));
 -    assertTrue(entityContext.isAttached(target));
 -    assertEquals(AttachedEntityStatus.LINKED, entityContext.getStatus(target));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(source));
 +    assertEquals(AttachedEntityStatus.NEW, containerFactory.getContext().entityContext().getStatus(source));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(target));
 +    assertEquals(AttachedEntityStatus.LINKED, containerFactory.getContext().entityContext().getStatus(target));
  
      checkUnidirectional("Info", source, "Customer", target, false);
  
@@@ -160,15 -160,15 +160,15 @@@
  
      assertNotNull(customer.getInfo());
  
-     final EntityTypeInvocationHandler source =
-             (EntityTypeInvocationHandler) Proxy.getInvocationHandler(customer);
-     final EntityTypeInvocationHandler target =
-             (EntityTypeInvocationHandler) Proxy.getInvocationHandler(customerInfo);
+     final EntityInvocationHandler source =
+             (EntityInvocationHandler) Proxy.getInvocationHandler(customer);
+     final EntityInvocationHandler target =
+             (EntityInvocationHandler) Proxy.getInvocationHandler(customerInfo);
  
 -    assertTrue(entityContext.isAttached(source));
 -    assertEquals(AttachedEntityStatus.CHANGED, entityContext.getStatus(source));
 -    assertTrue(entityContext.isAttached(target));
 -    assertEquals(AttachedEntityStatus.NEW, entityContext.getStatus(target));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(source));
 +    assertEquals(AttachedEntityStatus.CHANGED, containerFactory.getContext().entityContext().getStatus(source));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(target));
 +    assertEquals(AttachedEntityStatus.NEW, containerFactory.getContext().entityContext().getStatus(target));
  
      checkUnidirectional("Info", source, "Customer", target, false);
  
@@@ -187,15 -187,15 +187,15 @@@
  
      assertNotNull(customer.getInfo());
  
-     final EntityTypeInvocationHandler source =
-             (EntityTypeInvocationHandler) Proxy.getInvocationHandler(customer);
-     final EntityTypeInvocationHandler target =
-             (EntityTypeInvocationHandler) Proxy.getInvocationHandler(customerInfo);
+     final EntityInvocationHandler source =
+             (EntityInvocationHandler) Proxy.getInvocationHandler(customer);
+     final EntityInvocationHandler target =
+             (EntityInvocationHandler) Proxy.getInvocationHandler(customerInfo);
  
 -    assertTrue(entityContext.isAttached(source));
 -    assertEquals(AttachedEntityStatus.CHANGED, entityContext.getStatus(source));
 -    assertTrue(entityContext.isAttached(target));
 -    assertEquals(AttachedEntityStatus.LINKED, entityContext.getStatus(target));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(source));
 +    assertEquals(AttachedEntityStatus.CHANGED, containerFactory.getContext().entityContext().getStatus(source));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(target));
 +    assertEquals(AttachedEntityStatus.LINKED, containerFactory.getContext().entityContext().getStatus(target));
  
      checkUnidirectional("Info", source, "Customer", target, false);
  
@@@ -218,27 -218,26 +218,27 @@@
      assertNotNull(customer.getOrders());
      assertEquals(3, customer.getOrders().size());
  
-     final EntityTypeInvocationHandler source = (EntityTypeInvocationHandler) Proxy.getInvocationHandler(customer);
+     final EntityInvocationHandler source = (EntityInvocationHandler) Proxy.getInvocationHandler(customer);
  
 -    assertTrue(entityContext.isAttached(source));
 -    assertEquals(AttachedEntityStatus.NEW, entityContext.getStatus(source));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(source));
 +    assertEquals(AttachedEntityStatus.NEW, containerFactory.getContext().entityContext().getStatus(source));
      assertEquals(3, ((Collection) (source.getLinkChanges().entrySet().iterator().next().getValue())).size());
  
      for (Order order : toBeLinked) {
-       final EntityTypeInvocationHandler target = (EntityTypeInvocationHandler) Proxy.getInvocationHandler(order);
+       final EntityInvocationHandler target = (EntityInvocationHandler) Proxy.getInvocationHandler(order);
  
 -      assertTrue(entityContext.isAttached(target));
 -      assertEquals(AttachedEntityStatus.NEW, entityContext.getStatus(target));
 +      assertTrue(containerFactory.getContext().entityContext().isAttached(target));
 +      assertEquals(AttachedEntityStatus.NEW, containerFactory.getContext().entityContext().getStatus(target));
        checkUnidirectional("Orders", source, "Customer", target, true);
      }
  
 -    entityContext.detachAll();
 +    containerFactory.getContext().entityContext().detachAll();
  
 -    assertFalse(entityContext.isAttached(source));
 +    assertFalse(containerFactory.getContext().entityContext().isAttached(source));
  
      for (Order order : toBeLinked) {
 -      assertFalse(entityContext.isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(order)));
 +      assertFalse(containerFactory.getContext().entityContext().
-               isAttached((EntityTypeInvocationHandler) Proxy.getInvocationHandler(order)));
++              isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(order)));
      }
    }
  
@@@ -264,14 -263,14 +264,14 @@@
      assertEquals(2, customer.getBackupContactInfo().iterator().next().getAlternativeNames().size());
      assertTrue(customer.getBackupContactInfo().iterator().next().getAlternativeNames().contains("alternative4"));
  
-     final EntityTypeInvocationHandler source = (EntityTypeInvocationHandler) Proxy.getInvocationHandler(customer);
+     final EntityInvocationHandler source = (EntityInvocationHandler) Proxy.getInvocationHandler(customer);
  
 -    assertTrue(entityContext.isAttached(source));
 -    assertEquals(AttachedEntityStatus.NEW, entityContext.getStatus(source));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(source));
 +    assertEquals(AttachedEntityStatus.NEW, containerFactory.getContext().entityContext().getStatus(source));
  
 -    entityContext.detachAll();
 +    containerFactory.getContext().entityContext().detachAll();
  
 -    assertFalse(entityContext.isAttached(source));
 +    assertFalse(containerFactory.getContext().entityContext().isAttached(source));
    }
  
    @Test
@@@ -321,9 -320,9 +321,9 @@@
    public void checkContextInCaseOfErrors() {
      final Login login = container.getLogin().newLogin();
  
-     final EntityTypeInvocationHandler handler = (EntityTypeInvocationHandler) Proxy.getInvocationHandler(login);
+     final EntityInvocationHandler handler = (EntityInvocationHandler) Proxy.getInvocationHandler(login);
  
 -    assertTrue(entityContext.isAttached(handler));
 +    assertTrue(containerFactory.getContext().entityContext().isAttached(handler));
  
      try {
        container.flush();
@@@ -388,24 -387,18 +388,24 @@@
      customer.setPrimaryContactInfo(cd);
      customer.setBackupContactInfo(Collections.<ContactDetails>singletonList(bcd));
  
 -    assertTrue(entityContext.isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(customerInfo)));
 -    assertTrue(entityContext.isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(customer)));
 +    assertTrue(containerFactory.getContext().entityContext().
-             isAttached((EntityTypeInvocationHandler) Proxy.getInvocationHandler(customerInfo)));
++            isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(customerInfo)));
 +    assertTrue(containerFactory.getContext().entityContext().
-             isAttached((EntityTypeInvocationHandler) Proxy.getInvocationHandler(customer)));
++            isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(customer)));
      for (Order linked : toBeLinked) {
 -      assertTrue(entityContext.isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(linked)));
 +      assertTrue(containerFactory.getContext().entityContext().
-               isAttached((EntityTypeInvocationHandler) Proxy.getInvocationHandler(linked)));
++              isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(linked)));
      }
  
      container.flush();
  
 -    assertFalse(entityContext.isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(customerInfo)));
 -    assertFalse(entityContext.isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(customer)));
 +    assertFalse(containerFactory.getContext().entityContext().
-             isAttached((EntityTypeInvocationHandler) Proxy.getInvocationHandler(customerInfo)));
++            isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(customerInfo)));
 +    assertFalse(containerFactory.getContext().entityContext().
-             isAttached((EntityTypeInvocationHandler) Proxy.getInvocationHandler(customer)));
++            isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(customer)));
      for (Order linked : toBeLinked) {
 -      assertFalse(entityContext.isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(linked)));
 +      assertFalse(containerFactory.getContext().entityContext().
-               isAttached((EntityTypeInvocationHandler) Proxy.getInvocationHandler(linked)));
++              isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(linked)));
      }
  
      assertEquals("some new info ...", container.getCustomerInfo().get(16).getInformation());
@@@ -413,20 -406,16 +413,20 @@@
      container.getOrder().delete(toBeLinked);
      container.getCustomer().delete(customer.getCustomerId());
  
 -    assertTrue(entityContext.isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(customer)));
 +    assertTrue(containerFactory.getContext().entityContext().
-             isAttached((EntityTypeInvocationHandler) Proxy.getInvocationHandler(customer)));
++            isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(customer)));
      for (Order linked : toBeLinked) {
 -      assertTrue(entityContext.isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(linked)));
 +      assertTrue(containerFactory.getContext().entityContext().
-               isAttached((EntityTypeInvocationHandler) Proxy.getInvocationHandler(linked)));
++              isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(linked)));
      }
  
      container.flush();
  
 -    assertFalse(entityContext.isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(customer)));
 +    assertFalse(containerFactory.getContext().entityContext().
-             isAttached((EntityTypeInvocationHandler) Proxy.getInvocationHandler(customer)));
++            isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(customer)));
      for (Order linked : toBeLinked) {
 -      assertFalse(entityContext.isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(linked)));
 +      assertFalse(containerFactory.getContext().entityContext().
-               isAttached((EntityTypeInvocationHandler) Proxy.getInvocationHandler(linked)));
++              isAttached((EntityInvocationHandler) Proxy.getInvocationHandler(linked)));
      }
    }
  

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/1abd8e7e/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java
----------------------------------------------------------------------