public void testModifyPrivateOwned() throws Exception { createTestTypeWithOneToOneAttribute(); OrmPersistentType ormPersistentType = getEntityMappings() .addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); OrmSpecifiedPersistentAttribute ormPersistentAttribute = ormPersistentType.addAttributeToXml( ormPersistentType.getAttributeNamed("oneToOne"), MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); EclipseLinkOneToOneMapping contextOneToOne = (EclipseLinkOneToOneMapping) ormPersistentAttribute.getMapping(); XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0); XmlOneToOne resourceOneToOne = (XmlOneToOne) resourceEntity.getAttributes().getOneToOnes().get(0); // check defaults assertFalse(resourceOneToOne.isPrivateOwned()); assertFalse(contextOneToOne.getPrivateOwned().isPrivateOwned()); // set context private owned to true, check resource contextOneToOne.getPrivateOwned().setPrivateOwned(true); assertTrue(resourceOneToOne.isPrivateOwned()); assertTrue(contextOneToOne.getPrivateOwned().isPrivateOwned()); // set context private owned back to false, check resource contextOneToOne.getPrivateOwned().setPrivateOwned(false); }
public void testModifyJoinFetch() throws Exception { createTestTypeWithOneToOneAttribute(); OrmPersistentType ormPersistentType = getEntityMappings() .addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); OrmSpecifiedPersistentAttribute ormPersistentAttribute = ormPersistentType.addAttributeToXml( ormPersistentType.getAttributeNamed("oneToOne"), MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); EclipseLinkOneToOneMapping contextOneToOne = (EclipseLinkOneToOneMapping) ormPersistentAttribute.getMapping(); XmlEntity resourceEntity = (XmlEntity) getXmlEntityMappings().getEntities().get(0); XmlOneToOne resourceOneToOne = (XmlOneToOne) resourceEntity.getAttributes().getOneToOnes().get(0); // check defaults assertNull(resourceOneToOne.getJoinFetch()); assertNull(contextOneToOne.getJoinFetch().getValue()); // set context join fetch to INNER, check resource contextOneToOne.getJoinFetch().setValue(EclipseLinkJoinFetchType.INNER); assertEquals(XmlJoinFetchType.INNER, resourceOneToOne.getJoinFetch()); assertEquals(EclipseLinkJoinFetchType.INNER, contextOneToOne.getJoinFetch().getValue()); // set context join fetch to OUTER, check resource contextOneToOne.getJoinFetch().setValue(EclipseLinkJoinFetchType.OUTER); assertEquals(XmlJoinFetchType.OUTER, resourceOneToOne.getJoinFetch()); assertEquals(EclipseLinkJoinFetchType.OUTER, contextOneToOne.getJoinFetch().getValue()); // set context join fetch to null, check resource contextOneToOne.getJoinFetch().setValue(null); assertNull(resourceOneToOne.getJoinFetch()); assertNull(contextOneToOne.getJoinFetch().getValue()); }