@Test public void testgetComplexTypeWithBuffer() { HashMap<String, ComplexType> compTypes = new HashMap<String, ComplexType>(); ComplexType comp = new ComplexType(); comp.setName("Address"); compTypes.put("salesorderprocessing" + "." + "Address", comp); ODataJPAEdmProvider jpaEdmProv = new ODataJPAEdmProvider(); Class<?> claz = jpaEdmProv.getClass(); Field f; try { f = claz.getDeclaredField("complexTypes"); f.setAccessible(true); f.set(jpaEdmProv, compTypes); } catch (NoSuchFieldException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } catch (SecurityException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } catch (IllegalArgumentException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } catch (IllegalAccessException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } try { assertEquals(comp, jpaEdmProv.getComplexType(new FullQualifiedName("salesorderprocessing", "Address"))); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } try { jpaEdmProv.getComplexType(new FullQualifiedName("salesorderessing", "abc")); } catch (ODataJPAModelException e) { assertTrue(true); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } }
@Override public ComplexType getComplexType(final FullQualifiedName edmFQName) throws ODataException { if (edmFQName != null) { if (complexTypes.containsKey(edmFQName.toString())) { return complexTypes.get(edmFQName.toString()); } else if (schemas == null) { getSchemas(); } for (Schema schema : schemas) { if (schema.getNamespace().equals(edmFQName.getNamespace())) { if (schema.getComplexTypes() == null) { return null; } for (ComplexType ct : schema.getComplexTypes()) { if (ct.getName().equals(edmFQName.getName())) { complexTypes.put(edmFQName.toString(), ct); return ct; } } } } } return null; }
ODataJPAEdmProvider extends EdmProvider { @Override public ComplexType getComplexType(final FullQualifiedName edmFQName) throws ODataException { if (edmFQName != null) { if (complexTypes.containsKey(edmFQName.toString())) { return complexTypes.get(edmFQName.toString()); } else if (schemas == null) { getSchemas(); } for (Schema schema : schemas) { if (schema.getNamespace().equals(edmFQName.getNamespace())) { if (schema.getComplexTypes() == null) { return null; } for (ComplexType ct : schema.getComplexTypes()) { if (ct.getName().equals(edmFQName.getName())) { complexTypes.put(edmFQName.toString(), ct); return ct; } } } } } return null; } }
ODataJPAEdmProvider extends EdmProvider { @Override public ComplexType getComplexType(final FullQualifiedName edmFQName) throws ODataException { if (edmFQName != null) { if (complexTypes.containsKey(edmFQName.toString())) { return complexTypes.get(edmFQName.toString()); } else if (schemas == null) { getSchemas(); } for (Schema schema : schemas) { if (schema.getNamespace().equals(edmFQName.getNamespace())) { if (schema.getComplexTypes() == null) { return null; } for (ComplexType ct : schema.getComplexTypes()) { if (ct.getName().equals(edmFQName.getName())) { complexTypes.put(edmFQName.toString(), ct); return ct; } } } } } return null; } ODataJPAEdmProvider();  ODataJPAEdmProvider(final ODataJPAContext oDataJPAContext); }
ODataJPAEdmProvider extends EdmProvider { @Override public ComplexType getComplexType(final FullQualifiedName edmFQName) throws ODataException { if (edmFQName != null) { if (complexTypes.containsKey(edmFQName.toString())) { return complexTypes.get(edmFQName.toString()); } else if (schemas == null) { getSchemas(); } for (Schema schema : schemas) { if (schema.getNamespace().equals(edmFQName.getNamespace())) { if (schema.getComplexTypes() == null) { return null; } for (ComplexType ct : schema.getComplexTypes()) { if (ct.getName().equals(edmFQName.getName())) { complexTypes.put(edmFQName.toString(), ct); return ct; } } } } } return null; } ODataJPAEdmProvider();  ODataJPAEdmProvider(final ODataJPAContext oDataJPAContext); ODataJPAContext getODataJPAContext(); void setODataJPAContext(final ODataJPAContext jpaContext); @Override EntityContainerInfo getEntityContainerInfo(final String name); @Override EntityType getEntityType(final FullQualifiedName edmFQName); @Override ComplexType getComplexType(final FullQualifiedName edmFQName); @Override Association getAssociation(final FullQualifiedName edmFQName); @Override EntitySet getEntitySet(final String entityContainer, final String name); @Override AssociationSet getAssociationSet(final String entityContainer, final FullQualifiedName association,
      final String sourceEntitySetName, final String sourceEntitySetRole); @Override FunctionImport getFunctionImport(final String entityContainer, final String name); @Override List<Schema> getSchemas(); }
ODataJPAEdmProvider extends EdmProvider { @Override public ComplexType getComplexType(final FullQualifiedName edmFQName) throws ODataException { if (edmFQName != null) { if (complexTypes.containsKey(edmFQName.toString())) { return complexTypes.get(edmFQName.toString()); } else if (schemas == null) { getSchemas(); } for (Schema schema : schemas) { if (schema.getNamespace().equals(edmFQName.getNamespace())) { if (schema.getComplexTypes() == null) { return null; } for (ComplexType ct : schema.getComplexTypes()) { if (ct.getName().equals(edmFQName.getName())) { complexTypes.put(edmFQName.toString(), ct); return ct; } } } } } return null; } ODataJPAEdmProvider();  ODataJPAEdmProvider(final ODataJPAContext oDataJPAContext); ODataJPAContext getODataJPAContext(); void setODataJPAContext(final ODataJPAContext jpaContext); @Override EntityContainerInfo getEntityContainerInfo(final String name); @Override EntityType getEntityType(final FullQualifiedName edmFQName); @Override ComplexType getComplexType(final FullQualifiedName edmFQName); @Override Association getAssociation(final FullQualifiedName edmFQName); @Override EntitySet getEntitySet(final String entityContainer, final String name); @Override AssociationSet getAssociationSet(final String entityContainer, final FullQualifiedName association,
      final String sourceEntitySetName, final String sourceEntitySetRole); @Override FunctionImport getFunctionImport(final String entityContainer, final String name); @Override List<Schema> getSchemas();  }