|
Lines 110-118
Link Here
|
| 110 |
*/ |
110 |
*/ |
| 111 |
public class MetamodelMetamodelTest extends MetamodelTest { |
111 |
public class MetamodelMetamodelTest extends MetamodelTest { |
| 112 |
|
112 |
|
| 113 |
public static final int METAMODEL_ALL_ATTRIBUTES_SIZE = 100;//94; |
113 |
public static final int METAMODEL_ALL_ATTRIBUTES_SIZE = 102;//100;//94; |
| 114 |
public static final int METAMODEL_ALL_TYPES = 40;//37; |
114 |
public static final int METAMODEL_ALL_TYPES = 40;//37; |
| 115 |
public static final int METAMODEL_MANUFACTURER_DECLARED_TYPES = 27; |
115 |
public static final int METAMODEL_MANUFACTURER_DECLARED_TYPES = 28; |
| 116 |
|
116 |
|
| 117 |
public MetamodelMetamodelTest() { |
117 |
public MetamodelMetamodelTest() { |
| 118 |
super(); |
118 |
super(); |
|
Lines 124-234
Link Here
|
| 124 |
|
124 |
|
| 125 |
public static Test suite() { |
125 |
public static Test suite() { |
| 126 |
TestSuite suite = new TestSuite("MetamodelMetamodelTest"); |
126 |
TestSuite suite = new TestSuite("MetamodelMetamodelTest"); |
| 127 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_getPersistentAttributeType_BASIC_Method")); |
127 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_getPersistentAttributeType_BASIC_Method")); |
| 128 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_getPersistentAttributeType_EMBEDDED_Method")); |
128 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_getPersistentAttributeType_EMBEDDED_Method")); |
| 129 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_getPersistentAttributeType_ONE_TO_ONE_Method")); |
129 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_getPersistentAttributeType_ONE_TO_ONE_Method")); |
| 130 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_getPersistentAttributeType_ONE_TO_MANY_Method")); |
130 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_getPersistentAttributeType_ONE_TO_MANY_Method")); |
| 131 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_getPersistentAttributeType_MANY_TO_MANY_Method")); |
131 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_getPersistentAttributeType_MANY_TO_MANY_Method")); |
| 132 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_getPersistentAttributeType_MANY_TO_ONE_Method")); |
132 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_getPersistentAttributeType_MANY_TO_ONE_Method")); |
| 133 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_getPersistentAttributeType_ELEMENT_COLLECTION_Method")); |
133 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_getPersistentAttributeType_ELEMENT_COLLECTION_Method")); |
| 134 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_getName_Method")); |
134 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_getName_Method")); |
| 135 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_getDeclaringType_Method")); |
135 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_getDeclaringType_Method")); |
| 136 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_getJavaType_BasicType_Method")); |
136 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_getJavaType_BasicType_Method")); |
| 137 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_getJavaType_ManagedType_Method")); |
137 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_getJavaType_ManagedType_Method")); |
| 138 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_getJavaMember_BasicType_on_MappedSuperclass_Method")); |
138 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_getJavaMember_BasicType_on_MappedSuperclass_Method")); |
| 139 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_getJavaMember_BasicType_on_Entity_Method")); |
139 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_getJavaMember_BasicType_on_Entity_Method")); |
| 140 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_getJavaMember_ManagedType_Method")); |
140 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_getJavaMember_ManagedType_Method")); |
| 141 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_isAssociation_on_Plural_Method")); |
141 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_isAssociation_on_Plural_Method")); |
| 142 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_isAssociation_on_Singular_Method")); |
142 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_isAssociation_on_Singular_Method")); |
| 143 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_isCollection_false_Method")); |
143 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_isCollection_false_Method")); |
| 144 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_Interface_isCollection_true_Method")); |
144 |
suite.addTest(new MetamodelMetamodelTest("testAttribute_isCollection_true_Method")); |
| 145 |
|
145 |
|
| 146 |
suite.addTest(new MetamodelMetamodelTest("testBasicType_Interface")); |
146 |
suite.addTest(new MetamodelMetamodelTest("testBasicType")); |
| 147 |
suite.addTest(new MetamodelMetamodelTest("testBindable_Interface_getBindableType_Method")); |
147 |
suite.addTest(new MetamodelMetamodelTest("testBindable_getBindableType_Method")); |
| 148 |
suite.addTest(new MetamodelMetamodelTest("testBindable_Interface_getBindableJavaType_Method")); |
148 |
suite.addTest(new MetamodelMetamodelTest("testBindable_getBindableJavaType_Method")); |
| 149 |
suite.addTest(new MetamodelMetamodelTest("testEmbeddableType_Interface")); |
149 |
suite.addTest(new MetamodelMetamodelTest("testEmbeddableType")); |
| 150 |
suite.addTest(new MetamodelMetamodelTest("testEntityType_Interface")); |
150 |
suite.addTest(new MetamodelMetamodelTest("testEntityType")); |
| 151 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_Interface_getIdType_Method")); |
151 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getIdType_Method")); |
| 152 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_Interface_getIdClassAttributes_Method")); |
152 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getIdClassAttributes_Method")); |
| 153 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_Interface_hasVersionAttribute_Method")); |
153 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_hasVersionAttribute_Method")); |
| 154 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_Interface_hasSingleIdAttribute_Method")); |
154 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_hasSingleIdAttribute_Method")); |
| 155 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_Interface_getSupertype_Method")); |
155 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getSupertype_Method")); |
| 156 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_Interface_getDeclaredVersion_Method")); |
156 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getDeclaredVersion_exists_Method")); |
| 157 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_Interface_getVersion_Method")); |
157 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getDeclaredVersion_exists_above_Method")); |
| 158 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_Interface_getDeclaredId_Method")); |
158 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getDeclaredVersion_does_not_exist_at_all_Method")); |
| 159 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_Interface_getId_Method")); |
159 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getVersion_Method")); |
|
|
160 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getDeclaredId_Method")); |
| 161 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getId_Method")); |
| 160 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getDeclaredId_normal_execution_attribute_is_declared")); |
162 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getDeclaredId_normal_execution_attribute_is_declared")); |
| 161 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getDeclaredId_variant_execution_attribute_is_declared_above")); |
163 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getDeclaredId_variant_execution_attribute_is_declared_above")); |
| 162 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getDeclaredId_variant_execution_attribute_is_not_declared_at_all")); |
164 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getDeclaredId_variant_execution_attribute_is_not_declared_at_all")); |
| 163 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getDeclaredId_normal_execution_attribute_is_declared")); |
165 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getDeclaredId_normal_execution_attribute_is_declared")); |
| 164 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getIdType_handles_possible_null_cmppolicy")); |
166 |
suite.addTest(new MetamodelMetamodelTest("testIdentifiableType_getIdType_handles_possible_null_cmppolicy")); |
| 165 |
|
167 |
|
| 166 |
suite.addTest(new MetamodelMetamodelTest("testListAttribute_Interface")); |
168 |
suite.addTest(new MetamodelMetamodelTest("testListAttribute")); |
| 167 |
|
169 |
|
| 168 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getAttributes_Method")); |
170 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getAttributes_Method")); |
| 169 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredAttributes_Method")); |
171 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredAttributes_Method")); |
| 170 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getSingularAttribute_Type_param_Method")); |
172 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getSingularAttribute_Type_param_Method")); |
| 171 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredSingularAttribute_Type_param_Method")); |
173 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredSingularAttribute_Type_param_Method")); |
| 172 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getSingularAttributes_Method")); |
174 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getSingularAttributes_Method")); |
| 173 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredSingularAttributes_Method")); |
175 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredSingularAttributes_Method")); |
| 174 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getCollection_Type_param_Method")); |
176 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getCollection_Type_param_Method")); |
| 175 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredCollection_Type_param_Method")); |
177 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredCollection_Type_param_Method")); |
| 176 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getSet_Type_param_Method")); |
178 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getSet_Type_param_Method")); |
| 177 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredSet_Type_param_Method")); |
179 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredSet_Type_param_Method")); |
| 178 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getList_Type_param_Method")); |
180 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getList_Type_param_Method")); |
| 179 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredList_Type_param_Method")); |
181 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredList_Type_param_Method")); |
| 180 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getMap_Type_param_Method")); |
182 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getMap_Type_param_Method")); |
| 181 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredMap_Type_param_Method")); |
183 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredMap_Type_param_Method")); |
| 182 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getPluralAttributes_Method")); |
184 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredMap_Type_param_not_found_iae_Method")); |
| 183 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredPluralAttributes_internal_entity_Method")); |
185 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredMap_Type_param_declared_above_Method")); |
| 184 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredPluralAttributes_root_entity_Method")); |
186 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getPluralAttributes_Method")); |
| 185 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredPluralAttributes_root_mappedSuperclass_Method")); |
187 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredPluralAttributes_internal_entity_Method")); |
| 186 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getAttribute_on_Entity_Method")); |
188 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredPluralAttributes_root_entity_Method")); |
| 187 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getAttribute_on_MappedSuperclass_Method")); |
189 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredPluralAttributes_root_mappedSuperclass_Method")); |
| 188 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getAttribute_doesNotExist_on_Entity_Method")); |
190 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getAttribute_on_Entity_Method")); |
| 189 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getAttribute_doesNotExist_on_MappedSuperclass_Method")); |
191 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getAttribute_on_MappedSuperclass_Method")); |
| 190 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredAttribute_Method")); |
192 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getAttribute_doesNotExist_on_Entity_Method")); |
| 191 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredAttribute_above_throws_iae_Method")); |
193 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getAttribute_doesNotExist_on_MappedSuperclass_Method")); |
| 192 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredAttribute_doesNotExist_Method")); |
194 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredAttribute_Method")); |
| 193 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getSingularAttribute_BASIC_Method")); |
195 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredAttribute_above_throws_iae_Method")); |
| 194 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getSingularAttribute_EMBEDDED_Method")); |
196 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredAttribute_doesNotExist_Method")); |
| 195 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredSingularAttribute_on_Entity_Method")); |
197 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getSingularAttribute_BASIC_Method")); |
| 196 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredSingularAttribute_on_MappedSuperclass_Method")); |
198 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getSingularAttribute_EMBEDDED_Method")); |
| 197 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getCollection_Method")); |
199 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredSingularAttribute_on_Entity_Method")); |
| 198 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredCollection_Method")); |
200 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredSingularAttribute_on_MappedSuperclass_Method")); |
| 199 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getSet_Method")); |
201 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getCollection_Method")); |
| 200 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredSet_Method")); |
202 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredCollection_Method")); |
| 201 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getList_Method")); |
203 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getSet_Method")); |
| 202 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredList_Method")); |
204 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredSet_Method")); |
| 203 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getMap_Method")); |
205 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getList_Method")); |
| 204 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_getDeclaredMap_Method")); |
206 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredList_Method")); |
| 205 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_Interface_variantCases")); |
207 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getMap_Method")); |
| 206 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_Interface_getKeyJavaType_Method")); |
208 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_getDeclaredMap_Method")); |
| 207 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_Interface_getKeyType_Method")); |
209 |
suite.addTest(new MetamodelMetamodelTest("testManagedType_variantCases")); |
|
|
210 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_getKeyJavaType_UC0_Method")); |
| 211 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_getKeyJavaType_UC1a_Method")); |
| 212 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_getKeyJavaType_UC2_Method")); |
| 213 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_getKeyJavaType_UC4_Method")); |
| 214 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_getKeyJavaType_UC7_Method")); |
| 215 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_getKeyJavaType_UC8_Method")); |
| 216 |
// http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_86:_20090921:_Handle_Embeddable_Type_keyType_in_MapAttributeImpl_constructor suite.addTest(new MetamodelMetamodelTest("testMapAttribute_getKeyJavaType_UC9_DI86_Embeddable_IdClass_keyType_Method")); |
| 217 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_getKeyType_UC0_Method")); |
| 218 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_getKeyType_UC1a_Method")); |
| 219 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_getKeyType_UC2_Method")); |
| 220 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_getKeyType_UC4_Method")); |
| 221 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_getKeyType_UC7_Method")); |
| 222 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_getKeyType_UC8_Method")); |
| 223 |
suite.addTest(new MetamodelMetamodelTest("testMapAttribute_getKeyType_UC9_DI86_Embeddable_IdClass_keyType_Method")); |
| 208 |
suite.addTest(new MetamodelMetamodelTest("testMapAtributeElementTypeWhenMapKeySetButNameAttributeIsDefaulted")); |
224 |
suite.addTest(new MetamodelMetamodelTest("testMapAtributeElementTypeWhenMapKeySetButNameAttributeIsDefaulted")); |
| 209 |
suite.addTest(new MetamodelMetamodelTest("testMapAtributeElementTypeWhenMapKeySetAndNameAttributeSet")); |
225 |
suite.addTest(new MetamodelMetamodelTest("testMapAtributeElementTypeWhenMapKeySetAndNameAttributeSet")); |
| 210 |
suite.addTest(new MetamodelMetamodelTest("testMappedSuperclassType_Interface")); |
226 |
// Pending implementation |
| 211 |
suite.addTest(new MetamodelMetamodelTest("testMetamodel_Interface_entity_Method")); |
227 |
//suite.addTest(new MetamodelMetamodelTest("testMapAtributeElementTypeWhenMapKeyNotSet_MapKeyColumnSet")); |
| 212 |
suite.addTest(new MetamodelMetamodelTest("testMetamodel_Interface_embeddable_Method")); |
228 |
//suite.addTest(new MetamodelMetamodelTest("testMapAtributeElementTypeWhenMapKeyNotSet_MapKeyColumnSet")); // JPA 2.0 specific |
| 213 |
suite.addTest(new MetamodelMetamodelTest("testMetamodel_Interface_managedType_Method")); |
229 |
|
| 214 |
suite.addTest(new MetamodelMetamodelTest("testMetamodel_Interface_getEntities_Method")); |
230 |
suite.addTest(new MetamodelMetamodelTest("testMappedSuperclassType")); |
| 215 |
suite.addTest(new MetamodelMetamodelTest("testMetamodel_Interface_getManagedTypes_Method")); |
231 |
suite.addTest(new MetamodelMetamodelTest("testMetamodel_entity_Method")); |
| 216 |
suite.addTest(new MetamodelMetamodelTest("testMetamodel_Interface_getEmbeddables_Method")); |
232 |
suite.addTest(new MetamodelMetamodelTest("testMetamodel_embeddable_Method")); |
| 217 |
suite.addTest(new MetamodelMetamodelTest("testPluralAttribute_Interface_CollectionType_enum")); |
233 |
suite.addTest(new MetamodelMetamodelTest("testMetamodel_managedType_Method")); |
| 218 |
suite.addTest(new MetamodelMetamodelTest("testPluralAttribute_Interface_getCollectionType_Method")); |
234 |
suite.addTest(new MetamodelMetamodelTest("testMetamodel_getEntities_Method")); |
| 219 |
suite.addTest(new MetamodelMetamodelTest("testPluralAttribute_Interface_getElementType_Method")); |
235 |
suite.addTest(new MetamodelMetamodelTest("testMetamodel_getManagedTypes_Method")); |
| 220 |
suite.addTest(new MetamodelMetamodelTest("testSetAttribute_Interface")); |
236 |
suite.addTest(new MetamodelMetamodelTest("testMetamodel_getEmbeddables_Method")); |
| 221 |
suite.addTest(new MetamodelMetamodelTest("testSingularAttribute_Interface_isOptional_Method")); |
237 |
suite.addTest(new MetamodelMetamodelTest("testPluralAttribute_CollectionType_enum")); |
| 222 |
suite.addTest(new MetamodelMetamodelTest("testSingularAttribute_Interface_isId_Method")); |
238 |
suite.addTest(new MetamodelMetamodelTest("testPluralAttribute_getCollectionType_Method")); |
| 223 |
suite.addTest(new MetamodelMetamodelTest("testSingularAttribute_Interface_isVersion_Method")); |
239 |
suite.addTest(new MetamodelMetamodelTest("testPluralAttribute_getElementType_Method")); |
| 224 |
suite.addTest(new MetamodelMetamodelTest("testSingularAttribute_Interface_getBindableType_Method")); |
240 |
suite.addTest(new MetamodelMetamodelTest("testSetAttribute")); |
| 225 |
suite.addTest(new MetamodelMetamodelTest("testSingularAttribute_Interface_getBindableJavaType_Method")); |
241 |
suite.addTest(new MetamodelMetamodelTest("testSingularAttribute_isOptional_Method")); |
| 226 |
suite.addTest(new MetamodelMetamodelTest("testSingularAttribute_Interface_getJavaType_Method")); |
242 |
suite.addTest(new MetamodelMetamodelTest("testSingularAttribute_isId_Method")); |
| 227 |
suite.addTest(new MetamodelMetamodelTest("testSingularAttribute_Interface_getType_Method")); |
243 |
suite.addTest(new MetamodelMetamodelTest("testSingularAttribute_isVersion_Method")); |
|
|
244 |
suite.addTest(new MetamodelMetamodelTest("testSingularAttribute_getBindableType_Method")); |
| 245 |
suite.addTest(new MetamodelMetamodelTest("testSingularAttribute_getBindableJavaType_Method")); |
| 246 |
suite.addTest(new MetamodelMetamodelTest("testSingularAttribute_getJavaType_Method")); |
| 247 |
suite.addTest(new MetamodelMetamodelTest("testSingularAttribute_getType_Method")); |
| 228 |
suite.addTest(new MetamodelMetamodelTest("testToStringOverrides")); |
248 |
suite.addTest(new MetamodelMetamodelTest("testToStringOverrides")); |
| 229 |
suite.addTest(new MetamodelMetamodelTest("testType_Interface_PersistenceType_enum")); |
249 |
suite.addTest(new MetamodelMetamodelTest("testType_PersistenceType_enum")); |
| 230 |
suite.addTest(new MetamodelMetamodelTest("testType_Interface_getPersistenceType_Method")); |
250 |
suite.addTest(new MetamodelMetamodelTest("testType_getPersistenceType_Method")); |
| 231 |
suite.addTest(new MetamodelMetamodelTest("testType_Interface_getJavaType_Method")); |
251 |
suite.addTest(new MetamodelMetamodelTest("testType_getJavaType_Method")); |
| 232 |
suite.addTest(new MetamodelMetamodelTest("testOutOfSpecificationInternalAPI")); |
252 |
suite.addTest(new MetamodelMetamodelTest("testOutOfSpecificationInternalAPI")); |
| 233 |
// Not implemented yet |
253 |
// Not implemented yet |
| 234 |
//suite.addTest(new MetamodelMetamodelTest("testObscureInvalidStateUnitTests")); |
254 |
//suite.addTest(new MetamodelMetamodelTest("testObscureInvalidStateUnitTests")); |
|
Lines 284-305
Link Here
|
| 284 |
Type<?> personIdType = null; |
304 |
Type<?> personIdType = null; |
| 285 |
MappedSuperclassTypeImpl<Person> msPerson_ = (MappedSuperclassTypeImpl)metamodel.managedType(Person.class); |
305 |
MappedSuperclassTypeImpl<Person> msPerson_ = (MappedSuperclassTypeImpl)metamodel.managedType(Person.class); |
| 286 |
assertNotNull(msPerson_); |
306 |
assertNotNull(msPerson_); |
| 287 |
|
307 |
|
| 288 |
try { |
308 |
personIdType = msPerson_.getIdType(); |
| 289 |
personIdType = msPerson_.getIdType(); |
|
|
| 290 |
} catch (IllegalArgumentException iae) { |
| 291 |
// expecting no exception |
| 292 |
iae.printStackTrace(); |
| 293 |
expectedIAExceptionThrown = true; |
| 294 |
} |
| 295 |
assertFalse("An IAE exception should not occur here.", expectedIAExceptionThrown); |
309 |
assertFalse("An IAE exception should not occur here.", expectedIAExceptionThrown); |
| 296 |
assertNotNull(personIdType); |
310 |
assertNotNull(personIdType); |
| 297 |
assertEquals(PersistenceType.BASIC, personIdType.getPersistenceType()); |
311 |
assertEquals(PersistenceType.BASIC, personIdType.getPersistenceType()); |
| 298 |
assertEquals(Integer.class, personIdType.getJavaType()); |
312 |
assertEquals(Integer.class, personIdType.getJavaType()); |
| 299 |
} catch (Exception e) { |
313 |
} catch (IllegalArgumentException iae) { |
| 300 |
// we enter here on a failed commit() - for example if the table schema is incorrectly defined |
314 |
// expecting no exception |
| 301 |
e.printStackTrace(); |
315 |
iae.printStackTrace(); |
| 302 |
exceptionThrown = true; |
316 |
exceptionThrown = true; |
| 303 |
} finally { |
317 |
} finally { |
| 304 |
cleanup(em); |
318 |
cleanup(em); |
| 305 |
assertFalse("An IAE exception should not occur on getIdType() here.", exceptionThrown); |
319 |
assertFalse("An IAE exception should not occur on getIdType() here.", exceptionThrown); |
|
Lines 322-330
Link Here
|
| 322 |
|
336 |
|
| 323 |
// Test toString() for a Type without a javaType attribute |
337 |
// Test toString() for a Type without a javaType attribute |
| 324 |
//Type invalidType = new BasicTypeImpl(null); |
338 |
//Type invalidType = new BasicTypeImpl(null); |
| 325 |
} catch (Exception e) { |
339 |
} catch (IllegalArgumentException iae) { |
| 326 |
// we enter here on a failed commit() - for example if the table schema is incorrectly defined |
340 |
iae.printStackTrace(); |
| 327 |
e.printStackTrace(); |
|
|
| 328 |
exceptionThrown = true; |
341 |
exceptionThrown = true; |
| 329 |
} finally { |
342 |
} finally { |
| 330 |
cleanup(em); |
343 |
cleanup(em); |
|
Lines 332-415
Link Here
|
| 332 |
} |
345 |
} |
| 333 |
} |
346 |
} |
| 334 |
} |
347 |
} |
| 335 |
|
|
|
| 336 |
/** |
| 337 |
* This test will verify that MapAttribute instance have their elementType set correctly. |
| 338 |
* The elementType corresponds to the 3rd V parameter on the class definition - which is the Map value. |
| 339 |
* MapAttributeImpl<X, K, V> |
| 340 |
*/ |
| 341 |
public void testMapAtributeElementTypeWhenMapKeySetButNameAttributeIsDefaulted() { |
| 342 |
if(!this.isJPA10()) { |
| 343 |
boolean exceptionThrown = false; |
| 344 |
EntityManager em = null; |
| 345 |
try { |
| 346 |
em = privateTestSetup(); |
| 347 |
assertNotNull(em); |
| 348 |
Metamodel metamodel = em.getMetamodel(); |
| 349 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 350 |
|
| 351 |
EntityType<Manufacturer> entityManufacturer = metamodel.entity(Manufacturer.class); |
| 352 |
assertNotNull(entityManufacturer); |
| 353 |
Attribute hardwareDesignersMap = entityManufacturer.getAttribute("hardwareDesignersMapUC8"); |
| 354 |
assertNotNull(hardwareDesignersMap); |
| 355 |
assertTrue(hardwareDesignersMap.isCollection()); |
| 356 |
assertTrue(hardwareDesignersMap instanceof MapAttributeImpl); |
| 357 |
MapAttribute<? super Manufacturer, ?, ?> manufactuerHardwareDesignersMap = entityManufacturer.getMap("hardwareDesignersMapUC8"); |
| 358 |
// Verify owning type |
| 359 |
assertNotNull(manufactuerHardwareDesignersMap); |
| 360 |
assertEquals(entityManufacturer, manufactuerHardwareDesignersMap.getDeclaringType()); |
| 361 |
// Verify Map Key - should be PK of owning type |
| 362 |
assertEquals(Integer.class, manufactuerHardwareDesignersMap.getKeyJavaType()); |
| 363 |
// Verify Map Value |
| 364 |
assertEquals(HardwareDesigner.class, manufactuerHardwareDesignersMap.getElementType().getJavaType()); |
| 365 |
|
| 366 |
} catch (Exception e) { |
| 367 |
// we enter here on a failed commit() - for example if the table schema is incorrectly defined |
| 368 |
e.printStackTrace(); |
| 369 |
exceptionThrown = true; |
| 370 |
} finally { |
| 371 |
cleanup(em); |
| 372 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 373 |
} |
| 374 |
} |
| 375 |
} |
| 376 |
|
348 |
|
| 377 |
public void testMapAtributeElementTypeWhenMapKeySetAndNameAttributeSet() { |
|
|
| 378 |
if(!this.isJPA10()) { |
| 379 |
EntityManager em = null; |
| 380 |
boolean exceptionThrown = false; |
| 381 |
try { |
| 382 |
em = privateTestSetup(); |
| 383 |
assertNotNull(em); |
| 384 |
Metamodel metamodel = em.getMetamodel(); |
| 385 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 386 |
|
| 387 |
EntityType<Manufacturer> entityManufacturer = metamodel.entity(Manufacturer.class); |
| 388 |
assertNotNull(entityManufacturer); |
| 389 |
Attribute hardwareDesignersMap = entityManufacturer.getAttribute("hardwareDesignersMapUC4"); |
| 390 |
assertNotNull(hardwareDesignersMap); |
| 391 |
assertTrue(hardwareDesignersMap.isCollection()); |
| 392 |
assertTrue(hardwareDesignersMap instanceof MapAttributeImpl); |
| 393 |
MapAttribute<? super Manufacturer, ?, ?> manufactuerHardwareDesignersMap = entityManufacturer.getMap("hardwareDesignersMapUC4"); |
| 394 |
// Verify owning type |
| 395 |
assertNotNull(manufactuerHardwareDesignersMap); |
| 396 |
assertEquals(entityManufacturer, manufactuerHardwareDesignersMap.getDeclaringType()); |
| 397 |
// Verify Map Key - should be PK of owning type |
| 398 |
assertEquals(String.class, manufactuerHardwareDesignersMap.getKeyJavaType()); |
| 399 |
// Verify Map Value |
| 400 |
assertEquals(HardwareDesigner.class, manufactuerHardwareDesignersMap.getElementType().getJavaType()); |
| 401 |
|
| 402 |
} catch (Exception e) { |
| 403 |
// we enter here on a failed commit() - for example if the table schema is incorrectly defined |
| 404 |
e.printStackTrace(); |
| 405 |
exceptionThrown = true; |
| 406 |
} finally { |
| 407 |
cleanup(em); |
| 408 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 409 |
} |
| 410 |
} |
| 411 |
} |
| 412 |
|
| 413 |
public void testIdentifiableType_getDeclaredId_variant_execution_attribute_is_declared_above() { |
349 |
public void testIdentifiableType_getDeclaredId_variant_execution_attribute_is_declared_above() { |
| 414 |
if(!this.isJPA10()) { |
350 |
if(!this.isJPA10()) { |
| 415 |
EntityManager em = null; |
351 |
EntityManager em = null; |
|
Lines 435-443
Link Here
|
| 435 |
//<Y> SingularAttribute<X, Y> getDeclaredId(Class<Y> type); |
371 |
//<Y> SingularAttribute<X, Y> getDeclaredId(Class<Y> type); |
| 436 |
// Not declared - invalid - IAE thrown (actually declared 2 levels above in "Person") |
372 |
// Not declared - invalid - IAE thrown (actually declared 2 levels above in "Person") |
| 437 |
Attribute idAttribute = ((IdentifiableType)entityManufacturer_).getDeclaredId(Integer.class); |
373 |
Attribute idAttribute = ((IdentifiableType)entityManufacturer_).getDeclaredId(Integer.class); |
| 438 |
} catch (Exception e) { |
374 |
} catch (IllegalArgumentException iae) { |
| 439 |
// we enter here on a failed commit() - for example if the table schema is incorrectly defined |
375 |
//iae.printStackTrace(); |
| 440 |
//e.printStackTrace(); |
|
|
| 441 |
exceptionThrown = true; |
376 |
exceptionThrown = true; |
| 442 |
} finally { |
377 |
} finally { |
| 443 |
cleanup(em); |
378 |
cleanup(em); |
|
Lines 482-490
Link Here
|
| 482 |
// Require a version on a MappedSuperclass |
417 |
// Require a version on a MappedSuperclass |
| 483 |
|
418 |
|
| 484 |
//assertNotNull(msPerson1_.getDeclaredId(Integer.class)); |
419 |
//assertNotNull(msPerson1_.getDeclaredId(Integer.class)); |
| 485 |
} catch (Exception e) { |
420 |
} catch (IllegalArgumentException iae) { |
| 486 |
// we enter here on a failed commit() - for example if the table schema is incorrectly defined |
421 |
//iae.printStackTrace(); |
| 487 |
//e.printStackTrace(); |
|
|
| 488 |
exceptionThrown = true; |
422 |
exceptionThrown = true; |
| 489 |
} finally { |
423 |
} finally { |
| 490 |
cleanup(em); |
424 |
cleanup(em); |
|
Lines 492-499
Link Here
|
| 492 |
} |
426 |
} |
| 493 |
} |
427 |
} |
| 494 |
} |
428 |
} |
| 495 |
|
429 |
|
| 496 |
public void testAttribute_Interface_getPersistentAttributeType_BASIC_Method() { |
430 |
public void testAttribute_getPersistentAttributeType_BASIC_Method() { |
| 497 |
if(!this.isJPA10()) { |
431 |
if(!this.isJPA10()) { |
| 498 |
EntityManager em = null; |
432 |
EntityManager em = null; |
| 499 |
boolean exceptionThrown = false; |
433 |
boolean exceptionThrown = false; |
|
Lines 522-529
Link Here
|
| 522 |
assertNotNull(anAttribute); |
456 |
assertNotNull(anAttribute); |
| 523 |
assertEquals(int.class, anAttribute.getJavaType()); |
457 |
assertEquals(int.class, anAttribute.getJavaType()); |
| 524 |
assertEquals(PersistentAttributeType.BASIC, anAttribute.getPersistentAttributeType()); |
458 |
assertEquals(PersistentAttributeType.BASIC, anAttribute.getPersistentAttributeType()); |
| 525 |
} catch (Exception e) { |
459 |
} catch (IllegalArgumentException iae) { |
| 526 |
//e.printStackTrace(); |
460 |
//iae.printStackTrace(); |
| 527 |
exceptionThrown = true; |
461 |
exceptionThrown = true; |
| 528 |
} finally { |
462 |
} finally { |
| 529 |
cleanup(em); |
463 |
cleanup(em); |
|
Lines 532-538
Link Here
|
| 532 |
} |
466 |
} |
| 533 |
} |
467 |
} |
| 534 |
|
468 |
|
| 535 |
public void testAttribute_Interface_getPersistentAttributeType_ONE_TO_ONE_Method() { |
469 |
public void testAttribute_getPersistentAttributeType_ONE_TO_ONE_Method() { |
| 536 |
if(!this.isJPA10()) { |
470 |
if(!this.isJPA10()) { |
| 537 |
EntityManager em = null; |
471 |
EntityManager em = null; |
| 538 |
boolean exceptionThrown = false; |
472 |
boolean exceptionThrown = false; |
|
Lines 560-567
Link Here
|
| 560 |
assertNotNull(anAttribute); |
494 |
assertNotNull(anAttribute); |
| 561 |
assertEquals(GalacticPosition.class, anAttribute.getJavaType()); |
495 |
assertEquals(GalacticPosition.class, anAttribute.getJavaType()); |
| 562 |
assertEquals(PersistentAttributeType.ONE_TO_ONE, anAttribute.getPersistentAttributeType()); |
496 |
assertEquals(PersistentAttributeType.ONE_TO_ONE, anAttribute.getPersistentAttributeType()); |
| 563 |
} catch (Exception e) { |
497 |
} catch (IllegalArgumentException iae) { |
| 564 |
//e.printStackTrace(); |
498 |
//iae.printStackTrace(); |
| 565 |
exceptionThrown = true; |
499 |
exceptionThrown = true; |
| 566 |
} finally { |
500 |
} finally { |
| 567 |
cleanup(em); |
501 |
cleanup(em); |
|
Lines 570-576
Link Here
|
| 570 |
} |
504 |
} |
| 571 |
} |
505 |
} |
| 572 |
|
506 |
|
| 573 |
public void testAttribute_Interface_getPersistentAttributeType_ONE_TO_MANY_Method() { |
507 |
public void testAttribute_getPersistentAttributeType_ONE_TO_MANY_Method() { |
| 574 |
if(!this.isJPA10()) { |
508 |
if(!this.isJPA10()) { |
| 575 |
EntityManager em = null; |
509 |
EntityManager em = null; |
| 576 |
boolean exceptionThrown = false; |
510 |
boolean exceptionThrown = false; |
|
Lines 599-606
Link Here
|
| 599 |
assertNotNull(anAttribute); |
533 |
assertNotNull(anAttribute); |
| 600 |
assertEquals(Computer.class, anAttribute.getJavaType()); |
534 |
assertEquals(Computer.class, anAttribute.getJavaType()); |
| 601 |
assertEquals(PersistentAttributeType.ONE_TO_MANY, anAttribute.getPersistentAttributeType()); |
535 |
assertEquals(PersistentAttributeType.ONE_TO_MANY, anAttribute.getPersistentAttributeType()); |
| 602 |
} catch (Exception e) { |
536 |
} catch (IllegalArgumentException iae) { |
| 603 |
//e.printStackTrace(); |
537 |
//iae.printStackTrace(); |
| 604 |
exceptionThrown = true; |
538 |
exceptionThrown = true; |
| 605 |
} finally { |
539 |
} finally { |
| 606 |
cleanup(em); |
540 |
cleanup(em); |
|
Lines 609-615
Link Here
|
| 609 |
} |
543 |
} |
| 610 |
} |
544 |
} |
| 611 |
|
545 |
|
| 612 |
public void testAttribute_Interface_getPersistentAttributeType_MANY_TO_MANY_Method() { |
546 |
public void testAttribute_getPersistentAttributeType_MANY_TO_MANY_Method() { |
| 613 |
if(!this.isJPA10()) { |
547 |
if(!this.isJPA10()) { |
| 614 |
EntityManager em = null; |
548 |
EntityManager em = null; |
| 615 |
boolean exceptionThrown = false; |
549 |
boolean exceptionThrown = false; |
|
Lines 632-639
Link Here
|
| 632 |
//PersistentAttributeType getPersistentAttributeType(); |
566 |
//PersistentAttributeType getPersistentAttributeType(); |
| 633 |
// note: not implemented yet - need a manyToMany in the model |
567 |
// note: not implemented yet - need a manyToMany in the model |
| 634 |
//assertEquals(PersistentAttributeType.MANY_TO_MANY, anAttribute.getPersistentAttributeType()); |
568 |
//assertEquals(PersistentAttributeType.MANY_TO_MANY, anAttribute.getPersistentAttributeType()); |
| 635 |
} catch (Exception e) { |
569 |
} catch (IllegalArgumentException iae) { |
| 636 |
//e.printStackTrace(); |
570 |
//iae.printStackTrace(); |
| 637 |
exceptionThrown = true; |
571 |
exceptionThrown = true; |
| 638 |
} finally { |
572 |
} finally { |
| 639 |
cleanup(em); |
573 |
cleanup(em); |
|
Lines 642-648
Link Here
|
| 642 |
} |
576 |
} |
| 643 |
} |
577 |
} |
| 644 |
|
578 |
|
| 645 |
public void testAttribute_Interface_getPersistentAttributeType_MANY_TO_ONE_Method() { |
579 |
public void testAttribute_getPersistentAttributeType_MANY_TO_ONE_Method() { |
| 646 |
if(!this.isJPA10()) { |
580 |
if(!this.isJPA10()) { |
| 647 |
EntityManager em = null; |
581 |
EntityManager em = null; |
| 648 |
boolean exceptionThrown = false; |
582 |
boolean exceptionThrown = false; |
|
Lines 672-679
Link Here
|
| 672 |
assertEquals(Computer.class, anAttribute.getJavaType()); |
606 |
assertEquals(Computer.class, anAttribute.getJavaType()); |
| 673 |
// Note: internally our MANY_TO_ONE is treated as a ONE_TO_ONE - although with a DB constraint |
607 |
// Note: internally our MANY_TO_ONE is treated as a ONE_TO_ONE - although with a DB constraint |
| 674 |
assertEquals(PersistentAttributeType.MANY_TO_ONE, anAttribute.getPersistentAttributeType()); |
608 |
assertEquals(PersistentAttributeType.MANY_TO_ONE, anAttribute.getPersistentAttributeType()); |
| 675 |
} catch (Exception e) { |
609 |
} catch (IllegalArgumentException iae) { |
| 676 |
//e.printStackTrace(); |
610 |
//iae.printStackTrace(); |
| 677 |
exceptionThrown = true; |
611 |
exceptionThrown = true; |
| 678 |
} finally { |
612 |
} finally { |
| 679 |
cleanup(em); |
613 |
cleanup(em); |
|
Lines 682-688
Link Here
|
| 682 |
} |
616 |
} |
| 683 |
} |
617 |
} |
| 684 |
|
618 |
|
| 685 |
public void testAttribute_Interface_getPersistentAttributeType_ELEMENT_COLLECTION_Method() { |
619 |
public void testAttribute_getPersistentAttributeType_ELEMENT_COLLECTION_Method() { |
| 686 |
if(!this.isJPA10()) { |
620 |
if(!this.isJPA10()) { |
| 687 |
EntityManager em = null; |
621 |
EntityManager em = null; |
| 688 |
boolean exceptionThrown = false; |
622 |
boolean exceptionThrown = false; |
|
Lines 712-719
Link Here
|
| 712 |
//assertNotNull(anAttribute); |
646 |
//assertNotNull(anAttribute); |
| 713 |
//assertEquals(Computer.class, anAttribute.getJavaType()); |
647 |
//assertEquals(Computer.class, anAttribute.getJavaType()); |
| 714 |
//assertEquals(PersistentAttributeType.ELEMENT_COLLECTION, anAttribute.getPersistentAttributeType()); |
648 |
//assertEquals(PersistentAttributeType.ELEMENT_COLLECTION, anAttribute.getPersistentAttributeType()); |
| 715 |
} catch (Exception e) { |
649 |
} catch (IllegalArgumentException iae) { |
| 716 |
//e.printStackTrace(); |
650 |
//iae.printStackTrace(); |
| 717 |
exceptionThrown = true; |
651 |
exceptionThrown = true; |
| 718 |
} finally { |
652 |
} finally { |
| 719 |
cleanup(em); |
653 |
cleanup(em); |
|
Lines 722-728
Link Here
|
| 722 |
} |
656 |
} |
| 723 |
} |
657 |
} |
| 724 |
|
658 |
|
| 725 |
public void testAttribute_Interface_getPersistentAttributeType_EMBEDDED_Method() { |
659 |
public void testAttribute_getPersistentAttributeType_EMBEDDED_Method() { |
| 726 |
if(!this.isJPA10()) { |
660 |
if(!this.isJPA10()) { |
| 727 |
EntityManager em = null; |
661 |
EntityManager em = null; |
| 728 |
boolean exceptionThrown = false; |
662 |
boolean exceptionThrown = false; |
|
Lines 751-758
Link Here
|
| 751 |
assertNotNull(anAttribute); |
685 |
assertNotNull(anAttribute); |
| 752 |
assertEquals(EmbeddedPK.class, anAttribute.getJavaType()); |
686 |
assertEquals(EmbeddedPK.class, anAttribute.getJavaType()); |
| 753 |
assertEquals(PersistentAttributeType.EMBEDDED, anAttribute.getPersistentAttributeType()); |
687 |
assertEquals(PersistentAttributeType.EMBEDDED, anAttribute.getPersistentAttributeType()); |
| 754 |
} catch (Exception e) { |
688 |
} catch (IllegalArgumentException iae) { |
| 755 |
//e.printStackTrace(); |
689 |
//iae.printStackTrace(); |
| 756 |
exceptionThrown = true; |
690 |
exceptionThrown = true; |
| 757 |
} finally { |
691 |
} finally { |
| 758 |
cleanup(em); |
692 |
cleanup(em); |
|
Lines 761-767
Link Here
|
| 761 |
} |
695 |
} |
| 762 |
} |
696 |
} |
| 763 |
|
697 |
|
| 764 |
public void testAttribute_Interface_getName_Method() { |
698 |
public void testAttribute_getName_Method() { |
| 765 |
if(!this.isJPA10()) { |
699 |
if(!this.isJPA10()) { |
| 766 |
EntityManager em = null; |
700 |
EntityManager em = null; |
| 767 |
boolean exceptionThrown = false; |
701 |
boolean exceptionThrown = false; |
|
Lines 776-784
Link Here
|
| 776 |
* @return name |
710 |
* @return name |
| 777 |
*/ |
711 |
*/ |
| 778 |
//String getName(); |
712 |
//String getName(); |
| 779 |
|
713 |
|
| 780 |
} catch (Exception e) { |
714 |
ManagedType<Person> msPerson = metamodel.managedType(Person.class); |
| 781 |
//e.printStackTrace(); |
715 |
assertNotNull(msPerson); |
|
|
716 |
assertEquals(Type.PersistenceType.MAPPED_SUPERCLASS, msPerson.getPersistenceType()); |
| 717 |
Attribute idAttribute = ((IdentifiableType)msPerson).getDeclaredId(Integer.class); |
| 718 |
assertNotNull(idAttribute); |
| 719 |
assertEquals(Integer.class, idAttribute.getJavaType()); |
| 720 |
assertEquals("id", idAttribute.getName()); |
| 721 |
} catch (IllegalArgumentException iae) { |
| 722 |
//iae.printStackTrace(); |
| 782 |
exceptionThrown = true; |
723 |
exceptionThrown = true; |
| 783 |
} finally { |
724 |
} finally { |
| 784 |
cleanup(em); |
725 |
cleanup(em); |
|
Lines 787-793
Link Here
|
| 787 |
} |
728 |
} |
| 788 |
} |
729 |
} |
| 789 |
|
730 |
|
| 790 |
public void testAttribute_Interface_getDeclaringType_Method() { |
731 |
public void testAttribute_getDeclaringType_Method() { |
| 791 |
if(!this.isJPA10()) { |
732 |
if(!this.isJPA10()) { |
| 792 |
EntityManager em = null; |
733 |
EntityManager em = null; |
| 793 |
boolean exceptionThrown = false; |
734 |
boolean exceptionThrown = false; |
|
Lines 811-822
Link Here
|
| 811 |
// Test case |
752 |
// Test case |
| 812 |
Attribute anAttribute = entityManufacturer_.getDeclaredAttribute("hardwareDesignersMapUC4"); |
753 |
Attribute anAttribute = entityManufacturer_.getDeclaredAttribute("hardwareDesignersMapUC4"); |
| 813 |
ManagedType aManagedType = anAttribute.getDeclaringType(); |
754 |
ManagedType aManagedType = anAttribute.getDeclaringType(); |
| 814 |
assertEquals(entityManufacturer_, aManagedType); |
755 |
assertEquals(entityManufacturer_, aManagedType); |
| 815 |
|
|
|
| 816 |
assertNotNull(anAttribute); |
756 |
assertNotNull(anAttribute); |
| 817 |
assertEquals(PersistentAttributeType.ONE_TO_MANY, anAttribute.getPersistentAttributeType()); |
757 |
assertEquals(PersistentAttributeType.ONE_TO_MANY, anAttribute.getPersistentAttributeType()); |
| 818 |
} catch (Exception e) { |
758 |
} catch (IllegalArgumentException iae) { |
| 819 |
//e.printStackTrace(); |
759 |
//iae.printStackTrace(); |
| 820 |
exceptionThrown = true; |
760 |
exceptionThrown = true; |
| 821 |
} finally { |
761 |
} finally { |
| 822 |
cleanup(em); |
762 |
cleanup(em); |
|
Lines 825-831
Link Here
|
| 825 |
} |
765 |
} |
| 826 |
} |
766 |
} |
| 827 |
|
767 |
|
| 828 |
public void testAttribute_Interface_getJavaType_BasicType_Method() { |
768 |
public void testAttribute_getJavaType_BasicType_Method() { |
| 829 |
if(!this.isJPA10()) { |
769 |
if(!this.isJPA10()) { |
| 830 |
EntityManager em = null; |
770 |
EntityManager em = null; |
| 831 |
boolean exceptionThrown = false; |
771 |
boolean exceptionThrown = false; |
|
Lines 846-853
Link Here
|
| 846 |
Attribute idAttribute = ((IdentifiableType)msPerson).getDeclaredId(Integer.class); |
786 |
Attribute idAttribute = ((IdentifiableType)msPerson).getDeclaredId(Integer.class); |
| 847 |
assertNotNull(idAttribute); |
787 |
assertNotNull(idAttribute); |
| 848 |
assertEquals(Integer.class, idAttribute.getJavaType()); |
788 |
assertEquals(Integer.class, idAttribute.getJavaType()); |
| 849 |
} catch (Exception e) { |
789 |
} catch (IllegalArgumentException iae) { |
| 850 |
//e.printStackTrace(); |
790 |
//iae.printStackTrace(); |
| 851 |
exceptionThrown = true; |
791 |
exceptionThrown = true; |
| 852 |
} finally { |
792 |
} finally { |
| 853 |
cleanup(em); |
793 |
cleanup(em); |
|
Lines 856-862
Link Here
|
| 856 |
} |
796 |
} |
| 857 |
} |
797 |
} |
| 858 |
|
798 |
|
| 859 |
public void testAttribute_Interface_getJavaType_ManagedType_Method() { |
799 |
public void testAttribute_getJavaType_ManagedType_Method() { |
| 860 |
if(!this.isJPA10()) { |
800 |
if(!this.isJPA10()) { |
| 861 |
EntityManager em = null; |
801 |
EntityManager em = null; |
| 862 |
boolean exceptionThrown = false; |
802 |
boolean exceptionThrown = false; |
|
Lines 877-884
Link Here
|
| 877 |
Attribute anAttribute = entityManufacturer_.getAttribute("computers"); |
817 |
Attribute anAttribute = entityManufacturer_.getAttribute("computers"); |
| 878 |
assertNotNull(anAttribute); |
818 |
assertNotNull(anAttribute); |
| 879 |
assertEquals(Computer.class, anAttribute.getJavaType()); |
819 |
assertEquals(Computer.class, anAttribute.getJavaType()); |
| 880 |
} catch (Exception e) { |
820 |
} catch (IllegalArgumentException iae) { |
| 881 |
//e.printStackTrace(); |
821 |
//iae.printStackTrace(); |
| 882 |
exceptionThrown = true; |
822 |
exceptionThrown = true; |
| 883 |
} finally { |
823 |
} finally { |
| 884 |
cleanup(em); |
824 |
cleanup(em); |
|
Lines 887-893
Link Here
|
| 887 |
} |
827 |
} |
| 888 |
} |
828 |
} |
| 889 |
|
829 |
|
| 890 |
public void testAttribute_Interface_getJavaMember_BasicType_on_MappedSuperclass_Method() { |
830 |
public void testAttribute_getJavaMember_BasicType_on_MappedSuperclass_Method() { |
| 891 |
if(!this.isJPA10()) { |
831 |
if(!this.isJPA10()) { |
| 892 |
EntityManager em = null; |
832 |
EntityManager em = null; |
| 893 |
boolean exceptionThrown = false; |
833 |
boolean exceptionThrown = false; |
|
Lines 917-924
Link Here
|
| 917 |
assertEquals("id", aMember.getName()); |
857 |
assertEquals("id", aMember.getName()); |
| 918 |
assertNotNull(((Field)aMember).getType()); |
858 |
assertNotNull(((Field)aMember).getType()); |
| 919 |
assertEquals(Integer.class.getName(), ((Field)aMember).getType().getName()); |
859 |
assertEquals(Integer.class.getName(), ((Field)aMember).getType().getName()); |
| 920 |
} catch (Exception e) { |
860 |
} catch (IllegalArgumentException iae) { |
| 921 |
//e.printStackTrace(); |
861 |
//iae.printStackTrace(); |
| 922 |
exceptionThrown = true; |
862 |
exceptionThrown = true; |
| 923 |
} finally { |
863 |
} finally { |
| 924 |
cleanup(em); |
864 |
cleanup(em); |
|
Lines 927-933
Link Here
|
| 927 |
} |
867 |
} |
| 928 |
} |
868 |
} |
| 929 |
|
869 |
|
| 930 |
public void testAttribute_Interface_getJavaMember_BasicType_on_Entity_Method() { |
870 |
public void testAttribute_getJavaMember_BasicType_on_Entity_Method() { |
| 931 |
if(!this.isJPA10()) { |
871 |
if(!this.isJPA10()) { |
| 932 |
EntityManager em = null; |
872 |
EntityManager em = null; |
| 933 |
boolean exceptionThrown = false; |
873 |
boolean exceptionThrown = false; |
|
Lines 957-964
Link Here
|
| 957 |
assertEquals("anInt", aMember.getName()); |
897 |
assertEquals("anInt", aMember.getName()); |
| 958 |
assertNotNull(((Field)aMember).getType()); |
898 |
assertNotNull(((Field)aMember).getType()); |
| 959 |
assertEquals(int.class.getName(), ((Field)aMember).getType().getName()); |
899 |
assertEquals(int.class.getName(), ((Field)aMember).getType().getName()); |
| 960 |
} catch (Exception e) { |
900 |
} catch (IllegalArgumentException iae) { |
| 961 |
//e.printStackTrace(); |
901 |
//iae.printStackTrace(); |
| 962 |
exceptionThrown = true; |
902 |
exceptionThrown = true; |
| 963 |
} finally { |
903 |
} finally { |
| 964 |
cleanup(em); |
904 |
cleanup(em); |
|
Lines 967-973
Link Here
|
| 967 |
} |
907 |
} |
| 968 |
} |
908 |
} |
| 969 |
|
909 |
|
| 970 |
public void testAttribute_Interface_getJavaMember_ManagedType_Method() { |
910 |
public void testAttribute_getJavaMember_ManagedType_Method() { |
| 971 |
if(!this.isJPA10()) { |
911 |
if(!this.isJPA10()) { |
| 972 |
EntityManager em = null; |
912 |
EntityManager em = null; |
| 973 |
boolean exceptionThrown = false; |
913 |
boolean exceptionThrown = false; |
|
Lines 995-1002
Link Here
|
| 995 |
assertEquals("computers", aMember.getName()); |
935 |
assertEquals("computers", aMember.getName()); |
| 996 |
assertNotNull(((Field)aMember).getType()); |
936 |
assertNotNull(((Field)aMember).getType()); |
| 997 |
assertEquals(Set.class.getName(), ((Field)aMember).getType().getName()); |
937 |
assertEquals(Set.class.getName(), ((Field)aMember).getType().getName()); |
| 998 |
} catch (Exception e) { |
938 |
} catch (IllegalArgumentException iae) { |
| 999 |
//e.printStackTrace(); |
939 |
//iae.printStackTrace(); |
| 1000 |
exceptionThrown = true; |
940 |
exceptionThrown = true; |
| 1001 |
} finally { |
941 |
} finally { |
| 1002 |
cleanup(em); |
942 |
cleanup(em); |
|
Lines 1005-1011
Link Here
|
| 1005 |
} |
945 |
} |
| 1006 |
} |
946 |
} |
| 1007 |
|
947 |
|
| 1008 |
public void testAttribute_Interface_isAssociation_on_Plural_Method() { |
948 |
public void testAttribute_isAssociation_on_Plural_Method() { |
| 1009 |
if(!this.isJPA10()) { |
949 |
if(!this.isJPA10()) { |
| 1010 |
EntityManager em = null; |
950 |
EntityManager em = null; |
| 1011 |
boolean exceptionThrown = false; |
951 |
boolean exceptionThrown = false; |
|
Lines 1029-1036
Link Here
|
| 1029 |
assertEquals(Computer.class, anAttribute.getJavaType()); |
969 |
assertEquals(Computer.class, anAttribute.getJavaType()); |
| 1030 |
boolean isAssociation = anAttribute.isAssociation(); |
970 |
boolean isAssociation = anAttribute.isAssociation(); |
| 1031 |
assertFalse(isAssociation); |
971 |
assertFalse(isAssociation); |
| 1032 |
} catch (Exception e) { |
972 |
} catch (IllegalArgumentException iae) { |
| 1033 |
//e.printStackTrace(); |
973 |
//iae.printStackTrace(); |
| 1034 |
exceptionThrown = true; |
974 |
exceptionThrown = true; |
| 1035 |
} finally { |
975 |
} finally { |
| 1036 |
cleanup(em); |
976 |
cleanup(em); |
|
Lines 1039-1045
Link Here
|
| 1039 |
} |
979 |
} |
| 1040 |
} |
980 |
} |
| 1041 |
|
981 |
|
| 1042 |
public void testAttribute_Interface_isAssociation_on_Singular_Method() { |
982 |
public void testAttribute_isAssociation_on_Singular_Method() { |
| 1043 |
if(!this.isJPA10()) { |
983 |
if(!this.isJPA10()) { |
| 1044 |
EntityManager em = null; |
984 |
EntityManager em = null; |
| 1045 |
boolean exceptionThrown = false; |
985 |
boolean exceptionThrown = false; |
|
Lines 1065-1072
Link Here
|
| 1065 |
boolean isAssociation = anAttribute.isAssociation(); |
1005 |
boolean isAssociation = anAttribute.isAssociation(); |
| 1066 |
// Only a ReferenceMapping that extends ObjectReferenceMapping returns true |
1006 |
// Only a ReferenceMapping that extends ObjectReferenceMapping returns true |
| 1067 |
assertFalse(isAssociation); |
1007 |
assertFalse(isAssociation); |
| 1068 |
} catch (Exception e) { |
1008 |
} catch (IllegalArgumentException iae) { |
| 1069 |
//e.printStackTrace(); |
1009 |
//iae.printStackTrace(); |
| 1070 |
exceptionThrown = true; |
1010 |
exceptionThrown = true; |
| 1071 |
} finally { |
1011 |
} finally { |
| 1072 |
cleanup(em); |
1012 |
cleanup(em); |
|
Lines 1075-1081
Link Here
|
| 1075 |
} |
1015 |
} |
| 1076 |
} |
1016 |
} |
| 1077 |
|
1017 |
|
| 1078 |
public void testAttribute_Interface_isCollection_false_Method() { |
1018 |
public void testAttribute_isCollection_false_Method() { |
| 1079 |
if(!this.isJPA10()) { |
1019 |
if(!this.isJPA10()) { |
| 1080 |
EntityManager em = null; |
1020 |
EntityManager em = null; |
| 1081 |
boolean exceptionThrown = false; |
1021 |
boolean exceptionThrown = false; |
|
Lines 1111-1118
Link Here
|
| 1111 |
Type embeddableType = ((SingularAttributeImpl)locationIdAttribute).getType(); |
1051 |
Type embeddableType = ((SingularAttributeImpl)locationIdAttribute).getType(); |
| 1112 |
assertNotNull(embeddableType); |
1052 |
assertNotNull(embeddableType); |
| 1113 |
assertNotSame(embeddableType, locationIdAttributeManagedType); |
1053 |
assertNotSame(embeddableType, locationIdAttributeManagedType); |
| 1114 |
} catch (Exception e) { |
1054 |
} catch (IllegalArgumentException iae) { |
| 1115 |
//e.printStackTrace(); |
1055 |
//iae.printStackTrace(); |
| 1116 |
exceptionThrown = true; |
1056 |
exceptionThrown = true; |
| 1117 |
} finally { |
1057 |
} finally { |
| 1118 |
cleanup(em); |
1058 |
cleanup(em); |
|
Lines 1121-1127
Link Here
|
| 1121 |
} |
1061 |
} |
| 1122 |
} |
1062 |
} |
| 1123 |
|
1063 |
|
| 1124 |
public void testAttribute_Interface_isCollection_true_Method() { |
1064 |
public void testAttribute_isCollection_true_Method() { |
| 1125 |
if(!this.isJPA10()) { |
1065 |
if(!this.isJPA10()) { |
| 1126 |
EntityManager em = null; |
1066 |
EntityManager em = null; |
| 1127 |
boolean exceptionThrown = false; |
1067 |
boolean exceptionThrown = false; |
|
Lines 1145-1152
Link Here
|
| 1145 |
//boolean isCollection(); |
1085 |
//boolean isCollection(); |
| 1146 |
assertTrue(anAttribute.isCollection()); |
1086 |
assertTrue(anAttribute.isCollection()); |
| 1147 |
assertTrue(((AttributeImpl)anAttribute).isPlural()); // non-spec. |
1087 |
assertTrue(((AttributeImpl)anAttribute).isPlural()); // non-spec. |
| 1148 |
} catch (Exception e) { |
1088 |
} catch (IllegalArgumentException iae) { |
| 1149 |
//e.printStackTrace(); |
1089 |
//iae.printStackTrace(); |
| 1150 |
exceptionThrown = true; |
1090 |
exceptionThrown = true; |
| 1151 |
} finally { |
1091 |
} finally { |
| 1152 |
cleanup(em); |
1092 |
cleanup(em); |
|
Lines 1155-1161
Link Here
|
| 1155 |
} |
1095 |
} |
| 1156 |
} |
1096 |
} |
| 1157 |
|
1097 |
|
| 1158 |
public void testBasicType_Interface() { |
1098 |
public void testBasicType() { |
| 1159 |
if(!this.isJPA10()) { |
1099 |
if(!this.isJPA10()) { |
| 1160 |
EntityManager em = null; |
1100 |
EntityManager em = null; |
| 1161 |
boolean exceptionThrown = false; |
1101 |
boolean exceptionThrown = false; |
|
Lines 1172-1179
Link Here
|
| 1172 |
BasicTypeImpl aRandomBasicType = (BasicTypeImpl) aRandomType; |
1112 |
BasicTypeImpl aRandomBasicType = (BasicTypeImpl) aRandomType; |
| 1173 |
assertFalse(aRandomBasicType.isEntity()); |
1113 |
assertFalse(aRandomBasicType.isEntity()); |
| 1174 |
assertFalse(aRandomBasicType.isMappedSuperclass()); |
1114 |
assertFalse(aRandomBasicType.isMappedSuperclass()); |
| 1175 |
} catch (Exception e) { |
1115 |
} catch (IllegalArgumentException iae) { |
| 1176 |
//e.printStackTrace(); |
1116 |
//iae.printStackTrace(); |
| 1177 |
exceptionThrown = true; |
1117 |
exceptionThrown = true; |
| 1178 |
} finally { |
1118 |
} finally { |
| 1179 |
cleanup(em); |
1119 |
cleanup(em); |
|
Lines 1182-1188
Link Here
|
| 1182 |
} |
1122 |
} |
| 1183 |
} |
1123 |
} |
| 1184 |
|
1124 |
|
| 1185 |
public void testBindable_Interface_getBindableType_Method() { |
1125 |
public void testBindable_getBindableType_Method() { |
| 1186 |
if(!this.isJPA10()) { |
1126 |
if(!this.isJPA10()) { |
| 1187 |
EntityManager em = null; |
1127 |
EntityManager em = null; |
| 1188 |
boolean exceptionThrown = false; |
1128 |
boolean exceptionThrown = false; |
|
Lines 1215-1222
Link Here
|
| 1215 |
entityManufacturer_.getDeclaredList("hardwareDesigners", HardwareDesigner.class); |
1155 |
entityManufacturer_.getDeclaredList("hardwareDesigners", HardwareDesigner.class); |
| 1216 |
assertNotNull(manufacturer_hardwareDesignersList); |
1156 |
assertNotNull(manufacturer_hardwareDesignersList); |
| 1217 |
assertEquals(Bindable.BindableType.PLURAL_ATTRIBUTE, manufacturer_hardwareDesignersList.getBindableType()); |
1157 |
assertEquals(Bindable.BindableType.PLURAL_ATTRIBUTE, manufacturer_hardwareDesignersList.getBindableType()); |
| 1218 |
} catch (Exception e) { |
1158 |
} catch (IllegalArgumentException iae) { |
| 1219 |
//e.printStackTrace(); |
1159 |
//iae.printStackTrace(); |
| 1220 |
exceptionThrown = true; |
1160 |
exceptionThrown = true; |
| 1221 |
} finally { |
1161 |
} finally { |
| 1222 |
cleanup(em); |
1162 |
cleanup(em); |
|
Lines 1225-1231
Link Here
|
| 1225 |
} |
1165 |
} |
| 1226 |
} |
1166 |
} |
| 1227 |
|
1167 |
|
| 1228 |
public void testBindable_Interface_getBindableJavaType_Method() { |
1168 |
public void testBindable_getBindableJavaType_Method() { |
| 1229 |
if(!this.isJPA10()) { |
1169 |
if(!this.isJPA10()) { |
| 1230 |
EntityManager em = null; |
1170 |
EntityManager em = null; |
| 1231 |
boolean exceptionThrown = false; |
1171 |
boolean exceptionThrown = false; |
|
Lines 1267-1274
Link Here
|
| 1267 |
assertNotNull(manufacturer_hardwareDesignersType); |
1207 |
assertNotNull(manufacturer_hardwareDesignersType); |
| 1268 |
assertNotNull(manufacturer_hardwareDesignersType.getJavaType()); |
1208 |
assertNotNull(manufacturer_hardwareDesignersType.getJavaType()); |
| 1269 |
assertEquals(manufacturer_hardwareDesignersType.getJavaType(), manufacturer_hardwareDesignersList.getBindableJavaType()); |
1209 |
assertEquals(manufacturer_hardwareDesignersType.getJavaType(), manufacturer_hardwareDesignersList.getBindableJavaType()); |
| 1270 |
} catch (Exception e) { |
1210 |
} catch (IllegalArgumentException iae) { |
| 1271 |
//e.printStackTrace(); |
1211 |
//iae.printStackTrace(); |
| 1272 |
exceptionThrown = true; |
1212 |
exceptionThrown = true; |
| 1273 |
} finally { |
1213 |
} finally { |
| 1274 |
cleanup(em); |
1214 |
cleanup(em); |
|
Lines 1277-1283
Link Here
|
| 1277 |
} |
1217 |
} |
| 1278 |
} |
1218 |
} |
| 1279 |
|
1219 |
|
| 1280 |
public void testEmbeddableType_Interface() { |
1220 |
public void testEmbeddableType() { |
| 1281 |
if(!this.isJPA10()) { |
1221 |
if(!this.isJPA10()) { |
| 1282 |
EntityManager em = null; |
1222 |
EntityManager em = null; |
| 1283 |
boolean exceptionThrown = false; |
1223 |
boolean exceptionThrown = false; |
|
Lines 1295-1302
Link Here
|
| 1295 |
assertFalse("Expected EmbeddedPK.isMappedSuperclass = false", embeddableType_.isMappedSuperclass()); |
1235 |
assertFalse("Expected EmbeddedPK.isMappedSuperclass = false", embeddableType_.isMappedSuperclass()); |
| 1296 |
assertEquals(PersistenceType.EMBEDDABLE, embeddableType_.getPersistenceType()); |
1236 |
assertEquals(PersistenceType.EMBEDDABLE, embeddableType_.getPersistenceType()); |
| 1297 |
assertEquals(EmbeddedPK.class, embeddableType_.getJavaType()); |
1237 |
assertEquals(EmbeddedPK.class, embeddableType_.getJavaType()); |
| 1298 |
} catch (Exception e) { |
1238 |
} catch (IllegalArgumentException iae) { |
| 1299 |
//e.printStackTrace(); |
1239 |
//iae.printStackTrace(); |
| 1300 |
exceptionThrown = true; |
1240 |
exceptionThrown = true; |
| 1301 |
} finally { |
1241 |
} finally { |
| 1302 |
cleanup(em); |
1242 |
cleanup(em); |
|
Lines 1305-1311
Link Here
|
| 1305 |
} |
1245 |
} |
| 1306 |
} |
1246 |
} |
| 1307 |
|
1247 |
|
| 1308 |
public void testEntityType_Interface() { |
1248 |
public void testEntityType() { |
| 1309 |
if(!this.isJPA10()) { |
1249 |
if(!this.isJPA10()) { |
| 1310 |
EntityManager em = null; |
1250 |
EntityManager em = null; |
| 1311 |
boolean exceptionThrown = false; |
1251 |
boolean exceptionThrown = false; |
|
Lines 1343-1352
Link Here
|
| 1343 |
|
1283 |
|
| 1344 |
// get an Attribute<Container, Type==MappedSuperclass> |
1284 |
// get an Attribute<Container, Type==MappedSuperclass> |
| 1345 |
Attribute employerAttribute = entityHardwareDesigner_.getAttribute("employer"); |
1285 |
Attribute employerAttribute = entityHardwareDesigner_.getAttribute("employer"); |
| 1346 |
assertTrue(null != employerAttribute); |
1286 |
assertTrue(null != employerAttribute); |
| 1347 |
|
1287 |
} catch (IllegalArgumentException iae) { |
| 1348 |
} catch (Exception e) { |
1288 |
//iae.printStackTrace(); |
| 1349 |
//e.printStackTrace(); |
|
|
| 1350 |
exceptionThrown = true; |
1289 |
exceptionThrown = true; |
| 1351 |
} finally { |
1290 |
} finally { |
| 1352 |
cleanup(em); |
1291 |
cleanup(em); |
|
Lines 1355-1361
Link Here
|
| 1355 |
} |
1294 |
} |
| 1356 |
} |
1295 |
} |
| 1357 |
|
1296 |
|
| 1358 |
public void testIdentifiableType_Interface_getId_Method() { |
1297 |
public void testIdentifiableType_getId_Method() { |
| 1359 |
if(!this.isJPA10()) { |
1298 |
if(!this.isJPA10()) { |
| 1360 |
EntityManager em = null; |
1299 |
EntityManager em = null; |
| 1361 |
boolean expectedIAExceptionThrown = false; |
1300 |
boolean expectedIAExceptionThrown = false; |
|
Lines 1387-1394
Link Here
|
| 1387 |
// declared and valid |
1326 |
// declared and valid |
| 1388 |
MappedSuperclassTypeImpl<Person> msPerson1_ = (MappedSuperclassTypeImpl)metamodel.managedType(Person.class); |
1327 |
MappedSuperclassTypeImpl<Person> msPerson1_ = (MappedSuperclassTypeImpl)metamodel.managedType(Person.class); |
| 1389 |
assertNotNull(msPerson1_.getId(Integer.class)); |
1328 |
assertNotNull(msPerson1_.getId(Integer.class)); |
| 1390 |
} catch (Exception e) { |
1329 |
} catch (IllegalArgumentException iae) { |
| 1391 |
//e.printStackTrace(); |
1330 |
//iae.printStackTrace(); |
| 1392 |
expectedIAExceptionThrown = true; |
1331 |
expectedIAExceptionThrown = true; |
| 1393 |
} finally { |
1332 |
} finally { |
| 1394 |
cleanup(em); |
1333 |
cleanup(em); |
|
Lines 1397-1403
Link Here
|
| 1397 |
} |
1336 |
} |
| 1398 |
} |
1337 |
} |
| 1399 |
|
1338 |
|
| 1400 |
public void testIdentifiableType_Interface_getDeclaredId_Method() { |
1339 |
public void testIdentifiableType_getVersion_Method() { |
| 1401 |
if(!this.isJPA10()) { |
1340 |
if(!this.isJPA10()) { |
| 1402 |
EntityManager em = null; |
1341 |
EntityManager em = null; |
| 1403 |
boolean expectedIAExceptionThrown = false; |
1342 |
boolean expectedIAExceptionThrown = false; |
|
Lines 1415-1420
Link Here
|
| 1415 |
|
1354 |
|
| 1416 |
// Actual Test Case |
1355 |
// Actual Test Case |
| 1417 |
/** |
1356 |
/** |
|
|
1357 |
* Return the attribute that corresponds to the version |
| 1358 |
* attribute of the entity or mapped superclass. |
| 1359 |
* @param type the type of the represented version attribute |
| 1360 |
* @return version attribute |
| 1361 |
* @throws IllegalArgumentException if version attribute of the |
| 1362 |
* given type is not present in the identifiable type |
| 1363 |
*/ |
| 1364 |
//<Y> SingularAttribute<? super X, Y> getVersion(Class<Y> type); |
| 1365 |
// EntityType<Enclosure> anEnclosureType = metamodel.entity(Enclosure.class); |
| 1366 |
// assertNotNull(anEnclosureType.getVersion(Integer.class)); |
| 1367 |
// declared and inherited |
| 1368 |
|
| 1369 |
// declared |
| 1370 |
assertNotNull(entityManufacturer_.getVersion(int.class)); |
| 1371 |
// declared and valid |
| 1372 |
// TODO : require MS version |
| 1373 |
// assertNotNull(msPerson1_.getVersion(Integer.class)); |
| 1374 |
} catch (IllegalArgumentException iae) { |
| 1375 |
//iae.printStackTrace(); |
| 1376 |
expectedIAExceptionThrown = true; |
| 1377 |
} finally { |
| 1378 |
cleanup(em); |
| 1379 |
assertFalse("An IAE exception should not occur here.", expectedIAExceptionThrown); |
| 1380 |
} |
| 1381 |
} |
| 1382 |
} |
| 1383 |
|
| 1384 |
public void testIdentifiableType_getDeclaredId_Method() { |
| 1385 |
if(!this.isJPA10()) { |
| 1386 |
EntityManager em = null; |
| 1387 |
boolean expectedIAExceptionThrown = false; |
| 1388 |
try { |
| 1389 |
em = privateTestSetup(); |
| 1390 |
assertNotNull(em); |
| 1391 |
Metamodel metamodel = em.getMetamodel(); |
| 1392 |
assertNotNull(metamodel); |
| 1393 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 1394 |
assertNotNull(entityManufacturer_); |
| 1395 |
EntityTypeImpl<GalacticPosition> entityLocation_ = (EntityTypeImpl) metamodel.entity(GalacticPosition.class); |
| 1396 |
assertNotNull(entityLocation_); |
| 1397 |
EntityTypeImpl<Computer> entityComputer_ = (EntityTypeImpl)metamodel.entity(Computer.class); |
| 1398 |
assertNotNull(entityComputer_); |
| 1399 |
|
| 1400 |
// Actual Test Case |
| 1401 |
/** |
| 1418 |
* Return the attribute that corresponds to the id attribute |
1402 |
* Return the attribute that corresponds to the id attribute |
| 1419 |
* declared by the entity or mapped superclass. |
1403 |
* declared by the entity or mapped superclass. |
| 1420 |
* @param type the type of the represented declared id attribute |
1404 |
* @param type the type of the represented declared id attribute |
|
Lines 1441-1448
Link Here
|
| 1441 |
} |
1425 |
} |
| 1442 |
} |
1426 |
} |
| 1443 |
} |
1427 |
} |
|
|
1428 |
|
| 1429 |
public void testIdentifiableType_getDeclaredVersion_exists_Method() { |
| 1430 |
if(!this.isJPA10()) { |
| 1431 |
EntityManager em = null; |
| 1432 |
boolean expectedIAExceptionThrown = false; |
| 1433 |
try { |
| 1434 |
em = privateTestSetup(); |
| 1435 |
assertNotNull(em); |
| 1436 |
Metamodel metamodel = em.getMetamodel(); |
| 1437 |
assertNotNull(metamodel); |
| 1438 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 1439 |
assertNotNull(entityManufacturer_); |
| 1444 |
|
1440 |
|
| 1445 |
public void testIdentifiableType_Interface_getVersion_Method() { |
1441 |
// Actual Test Case |
|
|
1442 |
/** |
| 1443 |
* Return the attribute that corresponds to the version |
| 1444 |
* attribute declared by the entity or mapped superclass. |
| 1445 |
* @param type the type of the represented declared version |
| 1446 |
* attribute |
| 1447 |
* @return declared version attribute |
| 1448 |
* @throws IllegalArgumentException if version attribute of the |
| 1449 |
* type is not declared in the identifiable type |
| 1450 |
*/ |
| 1451 |
//<Y> SingularAttribute<X, Y> getDeclaredVersion(Class<Y> type); |
| 1452 |
// FUTURE: need an undeclared subclass |
| 1453 |
// Is declared |
| 1454 |
SingularAttribute<Manufacturer,?> anAttribute = entityManufacturer_.getDeclaredVersion(int.class); |
| 1455 |
assertNotNull(anAttribute); |
| 1456 |
assertNotNull(anAttribute.getType()); |
| 1457 |
assertNotNull(anAttribute.getBindableType()); |
| 1458 |
assertNotNull(anAttribute.getBindableJavaType()); |
| 1459 |
assertNotNull(anAttribute.getDeclaringType()); |
| 1460 |
assertEquals(entityManufacturer_, anAttribute.getDeclaringType()); |
| 1461 |
assertFalse(anAttribute.isId()); |
| 1462 |
assertTrue(anAttribute.isVersion()); |
| 1463 |
assertEquals(PersistentAttributeType.BASIC, anAttribute.getPersistentAttributeType()); |
| 1464 |
assertTrue(anAttribute.isOptional()); |
| 1465 |
assertNotNull(anAttribute.getJavaType()); |
| 1466 |
assertFalse(anAttribute.isAssociation()); |
| 1467 |
assertFalse(anAttribute.isCollection()); |
| 1468 |
} catch (IllegalArgumentException iae) { |
| 1469 |
//iae.printStackTrace(); |
| 1470 |
expectedIAExceptionThrown = true; |
| 1471 |
} finally { |
| 1472 |
cleanup(em); |
| 1473 |
assertFalse("An IAE exception should not occur here.", expectedIAExceptionThrown); |
| 1474 |
} |
| 1475 |
} |
| 1476 |
} |
| 1477 |
|
| 1478 |
public void testIdentifiableType_getDeclaredVersion_exists_above_Method() { |
| 1446 |
if(!this.isJPA10()) { |
1479 |
if(!this.isJPA10()) { |
| 1447 |
EntityManager em = null; |
1480 |
EntityManager em = null; |
| 1448 |
boolean expectedIAExceptionThrown = false; |
1481 |
boolean expectedIAExceptionThrown = false; |
|
Lines 1453-1484
Link Here
|
| 1453 |
assertNotNull(metamodel); |
1486 |
assertNotNull(metamodel); |
| 1454 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
1487 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 1455 |
assertNotNull(entityManufacturer_); |
1488 |
assertNotNull(entityManufacturer_); |
| 1456 |
EntityTypeImpl<GalacticPosition> entityLocation_ = (EntityTypeImpl) metamodel.entity(GalacticPosition.class); |
|
|
| 1457 |
assertNotNull(entityLocation_); |
| 1458 |
EntityTypeImpl<Computer> entityComputer_ = (EntityTypeImpl)metamodel.entity(Computer.class); |
| 1459 |
assertNotNull(entityComputer_); |
| 1460 |
|
1489 |
|
| 1461 |
// Actual Test Case |
1490 |
// Actual Test Case |
| 1462 |
/** |
1491 |
/** |
| 1463 |
* Return the attribute that corresponds to the version |
1492 |
* Return the attribute that corresponds to the version |
| 1464 |
* attribute of the entity or mapped superclass. |
1493 |
* attribute declared by the entity or mapped superclass. |
| 1465 |
* @param type the type of the represented version attribute |
1494 |
* @param type the type of the represented declared version |
| 1466 |
* @return version attribute |
1495 |
* attribute |
|
|
1496 |
* @return declared version attribute |
| 1467 |
* @throws IllegalArgumentException if version attribute of the |
1497 |
* @throws IllegalArgumentException if version attribute of the |
| 1468 |
* given type is not present in the identifiable type |
1498 |
* type is not declared in the identifiable type |
| 1469 |
*/ |
1499 |
*/ |
| 1470 |
//<Y> SingularAttribute<? super X, Y> getVersion(Class<Y> type); |
1500 |
//<Y> SingularAttribute<X, Y> getDeclaredVersion(Class<Y> type); |
| 1471 |
// EntityType<Enclosure> anEnclosureType = metamodel.entity(Enclosure.class); |
1501 |
// Does not exist |
| 1472 |
// assertNotNull(anEnclosureType.getVersion(Integer.class)); |
1502 |
// EntityType<Enclosure> anEnclosureType = metamodel.entity(Enclosure.class); |
| 1473 |
// declared and inherited |
1503 |
// assertNotNull(anEnclosureType.getDeclaredVersion(Integer.class)); |
|
|
1504 |
// Is declared |
| 1505 |
assertNotNull(entityManufacturer_.getDeclaredVersion(int.class)); |
| 1474 |
|
1506 |
|
| 1475 |
// declared |
1507 |
// TODO: need an undeclared subclass |
| 1476 |
assertNotNull(entityManufacturer_.getVersion(int.class)); |
1508 |
// Is declared |
| 1477 |
// declared and valid |
1509 |
// assertNotNull(msPerson1_.getDeclaredVersion(Integer.class)); |
| 1478 |
// TODO : require MS version |
1510 |
} catch (IllegalArgumentException iae) { |
| 1479 |
// assertNotNull(msPerson1_.getVersion(Integer.class)); |
1511 |
//iae.printStackTrace(); |
| 1480 |
} catch (Exception e) { |
|
|
| 1481 |
//e.printStackTrace(); |
| 1482 |
expectedIAExceptionThrown = true; |
1512 |
expectedIAExceptionThrown = true; |
| 1483 |
} finally { |
1513 |
} finally { |
| 1484 |
cleanup(em); |
1514 |
cleanup(em); |
|
Lines 1487-1493
Link Here
|
| 1487 |
} |
1517 |
} |
| 1488 |
} |
1518 |
} |
| 1489 |
|
1519 |
|
| 1490 |
public void testIdentifiableType_Interface_getDeclaredVersion_Method() { |
1520 |
public void testIdentifiableType_getDeclaredVersion_does_not_exist_at_all_Method() { |
| 1491 |
if(!this.isJPA10()) { |
1521 |
if(!this.isJPA10()) { |
| 1492 |
EntityManager em = null; |
1522 |
EntityManager em = null; |
| 1493 |
boolean expectedIAExceptionThrown = false; |
1523 |
boolean expectedIAExceptionThrown = false; |
|
Lines 1519-1526
Link Here
|
| 1519 |
// TODO: need an undeclared subclass |
1549 |
// TODO: need an undeclared subclass |
| 1520 |
// Is declared |
1550 |
// Is declared |
| 1521 |
// assertNotNull(msPerson1_.getDeclaredVersion(Integer.class)); |
1551 |
// assertNotNull(msPerson1_.getDeclaredVersion(Integer.class)); |
| 1522 |
} catch (Exception e) { |
1552 |
} catch (IllegalArgumentException iae) { |
| 1523 |
//e.printStackTrace(); |
1553 |
//iae.printStackTrace(); |
| 1524 |
expectedIAExceptionThrown = true; |
1554 |
expectedIAExceptionThrown = true; |
| 1525 |
} finally { |
1555 |
} finally { |
| 1526 |
cleanup(em); |
1556 |
cleanup(em); |
|
Lines 1528-1535
Link Here
|
| 1528 |
} |
1558 |
} |
| 1529 |
} |
1559 |
} |
| 1530 |
} |
1560 |
} |
| 1531 |
|
1561 |
|
| 1532 |
public void testIdentifiableType_Interface_getSupertype_Method() { |
1562 |
public void testIdentifiableType_getSupertype_Method() { |
| 1533 |
if(!this.isJPA10()) { |
1563 |
if(!this.isJPA10()) { |
| 1534 |
EntityManager em = null; |
1564 |
EntityManager em = null; |
| 1535 |
boolean expectedIAExceptionThrown = false; |
1565 |
boolean expectedIAExceptionThrown = false; |
|
Lines 1595-1602
Link Here
|
| 1595 |
} |
1625 |
} |
| 1596 |
assertFalse(expectedIAExceptionThrown); |
1626 |
assertFalse(expectedIAExceptionThrown); |
| 1597 |
assertNull(superTypeLocation); |
1627 |
assertNull(superTypeLocation); |
| 1598 |
} catch (Exception e) { |
1628 |
} catch (IllegalArgumentException iae) { |
| 1599 |
//e.printStackTrace(); |
1629 |
//iae.printStackTrace(); |
| 1600 |
expectedIAExceptionThrown = true; |
1630 |
expectedIAExceptionThrown = true; |
| 1601 |
} finally { |
1631 |
} finally { |
| 1602 |
cleanup(em); |
1632 |
cleanup(em); |
|
Lines 1605-1611
Link Here
|
| 1605 |
} |
1635 |
} |
| 1606 |
} |
1636 |
} |
| 1607 |
|
1637 |
|
| 1608 |
public void testIdentifiableType_Interface_hasSingleIdAttribute_Method() { |
1638 |
public void testIdentifiableType_hasSingleIdAttribute_Method() { |
| 1609 |
if(!this.isJPA10()) { |
1639 |
if(!this.isJPA10()) { |
| 1610 |
EntityManager em = null; |
1640 |
EntityManager em = null; |
| 1611 |
boolean expectedIAExceptionThrown = false; |
1641 |
boolean expectedIAExceptionThrown = false; |
|
Lines 1669-1676
Link Here
|
| 1669 |
} |
1699 |
} |
| 1670 |
assertFalse(expectedIAExceptionThrown); |
1700 |
assertFalse(expectedIAExceptionThrown); |
| 1671 |
assertFalse(hasSingleIdAttribute); |
1701 |
assertFalse(hasSingleIdAttribute); |
| 1672 |
} catch (Exception e) { |
1702 |
} catch (IllegalArgumentException iae) { |
| 1673 |
//e.printStackTrace(); |
1703 |
//iae.printStackTrace(); |
| 1674 |
expectedIAExceptionThrown = true; |
1704 |
expectedIAExceptionThrown = true; |
| 1675 |
} finally { |
1705 |
} finally { |
| 1676 |
cleanup(em); |
1706 |
cleanup(em); |
|
Lines 1679-1685
Link Here
|
| 1679 |
} |
1709 |
} |
| 1680 |
} |
1710 |
} |
| 1681 |
|
1711 |
|
| 1682 |
public void testIdentifiableType_Interface_hasVersionAttribute_Method() { |
1712 |
public void testIdentifiableType_hasVersionAttribute_Method() { |
| 1683 |
if(!this.isJPA10()) { |
1713 |
if(!this.isJPA10()) { |
| 1684 |
EntityManager em = null; |
1714 |
EntityManager em = null; |
| 1685 |
boolean expectedIAExceptionThrown = false; |
1715 |
boolean expectedIAExceptionThrown = false; |
|
Lines 1701-1708
Link Here
|
| 1701 |
EntityType<Enclosure> anEnclosureType = metamodel.entity(Enclosure.class); |
1731 |
EntityType<Enclosure> anEnclosureType = metamodel.entity(Enclosure.class); |
| 1702 |
assertFalse(anEnclosureType.hasVersionAttribute()); |
1732 |
assertFalse(anEnclosureType.hasVersionAttribute()); |
| 1703 |
assertTrue(entityManufacturer_.hasVersionAttribute()); |
1733 |
assertTrue(entityManufacturer_.hasVersionAttribute()); |
| 1704 |
} catch (Exception e) { |
1734 |
} catch (IllegalArgumentException iae) { |
| 1705 |
//e.printStackTrace(); |
1735 |
//iae.printStackTrace(); |
| 1706 |
expectedIAExceptionThrown = true; |
1736 |
expectedIAExceptionThrown = true; |
| 1707 |
} finally { |
1737 |
} finally { |
| 1708 |
cleanup(em); |
1738 |
cleanup(em); |
|
Lines 1711-1717
Link Here
|
| 1711 |
} |
1741 |
} |
| 1712 |
} |
1742 |
} |
| 1713 |
|
1743 |
|
| 1714 |
public void testIdentifiableType_Interface_getIdClassAttributes_Method() { |
1744 |
public void testIdentifiableType_getIdClassAttributes_Method() { |
| 1715 |
if(!this.isJPA10()) { |
1745 |
if(!this.isJPA10()) { |
| 1716 |
EntityManager em = null; |
1746 |
EntityManager em = null; |
| 1717 |
boolean expectedIAExceptionThrown = false; |
1747 |
boolean expectedIAExceptionThrown = false; |
|
Lines 1733-1755
Link Here
|
| 1733 |
expectedIAExceptionThrown = false; |
1763 |
expectedIAExceptionThrown = false; |
| 1734 |
boolean hasSingleIdAttribute = true; |
1764 |
boolean hasSingleIdAttribute = true; |
| 1735 |
Set<SingularAttribute<? super Enclosure, ?>> idClassAttributes = null; |
1765 |
Set<SingularAttribute<? super Enclosure, ?>> idClassAttributes = null; |
| 1736 |
try { |
1766 |
EntityType<Enclosure> aType = metamodel.entity(Enclosure.class); |
| 1737 |
EntityType<Enclosure> aType = metamodel.entity(Enclosure.class); |
1767 |
hasSingleIdAttribute = aType.hasSingleIdAttribute(); |
| 1738 |
hasSingleIdAttribute = aType.hasSingleIdAttribute(); |
1768 |
// We verify that an @IdClass exists - no single @Id or @EmbeddedId exists |
| 1739 |
// We verify that an @IdClass exists - no single @Id or @EmbeddedId exists |
1769 |
assertFalse(hasSingleIdAttribute); |
| 1740 |
assertFalse(hasSingleIdAttribute); |
1770 |
idClassAttributes = aType.getIdClassAttributes(); |
| 1741 |
idClassAttributes = aType.getIdClassAttributes(); |
|
|
| 1742 |
|
| 1743 |
} catch (IllegalArgumentException iae) { |
| 1744 |
//iae.printStackTrace(); |
| 1745 |
expectedIAExceptionThrown = true; |
| 1746 |
} |
| 1747 |
assertFalse(expectedIAExceptionThrown); |
1771 |
assertFalse(expectedIAExceptionThrown); |
| 1748 |
assertFalse(hasSingleIdAttribute); |
1772 |
assertFalse(hasSingleIdAttribute); |
| 1749 |
assertNotNull(idClassAttributes); |
1773 |
assertNotNull(idClassAttributes); |
| 1750 |
assertEquals(3, idClassAttributes.size()); |
1774 |
assertEquals(4, idClassAttributes.size()); |
| 1751 |
} catch (Exception e) { |
1775 |
} catch (IllegalArgumentException iae) { |
| 1752 |
//e.printStackTrace(); |
1776 |
//iae.printStackTrace(); |
| 1753 |
expectedIAExceptionThrown = true; |
1777 |
expectedIAExceptionThrown = true; |
| 1754 |
} finally { |
1778 |
} finally { |
| 1755 |
cleanup(em); |
1779 |
cleanup(em); |
|
Lines 1758-1764
Link Here
|
| 1758 |
} |
1782 |
} |
| 1759 |
} |
1783 |
} |
| 1760 |
|
1784 |
|
| 1761 |
public void testIdentifiableType_Interface_getIdType_Method() { |
1785 |
public void testIdentifiableType_getIdType_Method() { |
| 1762 |
if(!this.isJPA10()) { |
1786 |
if(!this.isJPA10()) { |
| 1763 |
EntityManager em = null; |
1787 |
EntityManager em = null; |
| 1764 |
boolean expectedIAExceptionThrown = false; |
1788 |
boolean expectedIAExceptionThrown = false; |
|
Lines 1842-1858
Link Here
|
| 1842 |
assertNotNull(msCorporation_); |
1866 |
assertNotNull(msCorporation_); |
| 1843 |
|
1867 |
|
| 1844 |
// Verify all types (entities, embeddables, mappedsuperclasses and basic) |
1868 |
// Verify all types (entities, embeddables, mappedsuperclasses and basic) |
| 1845 |
try { |
1869 |
// get all 21 types (a non spec function - for testing introspection) |
| 1846 |
// get all 21 types (a non spec function - for testing introspection) |
1870 |
Map<Class, TypeImpl<?>> typesMap = ((MetamodelImpl)metamodel).getTypes(); |
| 1847 |
Map<Class, TypeImpl<?>> typesMap = ((MetamodelImpl)metamodel).getTypes(); |
1871 |
// verify each one |
| 1848 |
// verify each one |
1872 |
assertNotNull(typesMap); |
| 1849 |
assertNotNull(typesMap); |
1873 |
assertEquals(METAMODEL_ALL_TYPES, typesMap.size()); |
| 1850 |
assertEquals(METAMODEL_ALL_TYPES, typesMap.size()); |
1874 |
} catch (IllegalArgumentException iae) { |
| 1851 |
} catch (Exception e) { |
1875 |
//iae.printStackTrace(); |
| 1852 |
e.printStackTrace(); |
|
|
| 1853 |
} |
| 1854 |
} catch (Exception e) { |
| 1855 |
//e.printStackTrace(); |
| 1856 |
expectedIAExceptionThrown = true; |
1876 |
expectedIAExceptionThrown = true; |
| 1857 |
} finally { |
1877 |
} finally { |
| 1858 |
cleanup(em); |
1878 |
cleanup(em); |
|
Lines 1861-1867
Link Here
|
| 1861 |
} |
1881 |
} |
| 1862 |
} |
1882 |
} |
| 1863 |
|
1883 |
|
| 1864 |
public void testListAttribute_Interface() { |
1884 |
public void testListAttribute() { |
| 1865 |
if(!this.isJPA10()) { |
1885 |
if(!this.isJPA10()) { |
| 1866 |
EntityManager em = null; |
1886 |
EntityManager em = null; |
| 1867 |
boolean exceptionThrown = false; |
1887 |
boolean exceptionThrown = false; |
|
Lines 1873-1880
Link Here
|
| 1873 |
|
1893 |
|
| 1874 |
// Actual Test Case |
1894 |
// Actual Test Case |
| 1875 |
|
1895 |
|
| 1876 |
} catch (Exception e) { |
1896 |
} catch (IllegalArgumentException iae) { |
| 1877 |
//e.printStackTrace(); |
1897 |
//iae.printStackTrace(); |
| 1878 |
exceptionThrown = true; |
1898 |
exceptionThrown = true; |
| 1879 |
} finally { |
1899 |
} finally { |
| 1880 |
cleanup(em); |
1900 |
cleanup(em); |
|
Lines 1883-1889
Link Here
|
| 1883 |
} |
1903 |
} |
| 1884 |
} |
1904 |
} |
| 1885 |
|
1905 |
|
| 1886 |
public void testManagedType_Interface_getAttributes_Method() { |
1906 |
public void testManagedType_getAttributes_Method() { |
| 1887 |
if(!this.isJPA10()) { |
1907 |
if(!this.isJPA10()) { |
| 1888 |
EntityManager em = null; |
1908 |
EntityManager em = null; |
| 1889 |
boolean expectedIAExceptionThrown = false; |
1909 |
boolean expectedIAExceptionThrown = false; |
|
Lines 2261-2268
Link Here
|
| 2261 |
//java.util.Set<SingularAttribute<? super X, ?>> getSingularAttributes(); |
2281 |
//java.util.Set<SingularAttribute<? super X, ?>> getSingularAttributes(); |
| 2262 |
Set<SingularAttribute<? super Manufacturer, ?>> singularAttributeSet = entityManufacturer_.getSingularAttributes(); |
2282 |
Set<SingularAttribute<? super Manufacturer, ?>> singularAttributeSet = entityManufacturer_.getSingularAttributes(); |
| 2263 |
assertNotNull(singularAttributeSet); |
2283 |
assertNotNull(singularAttributeSet); |
| 2264 |
// We should see 3+17 singular attributes for Manufacturer (id(from the mappedSuperclass), version, name(from the mappedSuperclass)) |
2284 |
// We should see 3+18 singular attributes for Manufacturer (id(from the mappedSuperclass), version, name(from the mappedSuperclass)) |
| 2265 |
assertEquals(METAMODEL_MANUFACTURER_DECLARED_TYPES - 6, singularAttributeSet.size()); |
2285 |
assertEquals(METAMODEL_MANUFACTURER_DECLARED_TYPES - 7, singularAttributeSet.size()); |
| 2266 |
// for each managed entity we will see 2 entries (one for the Id, one for the Version) |
2286 |
// for each managed entity we will see 2 entries (one for the Id, one for the Version) |
| 2267 |
assertTrue(singularAttributeSet.contains(entityManufacturer_.getAttribute("id"))); // |
2287 |
assertTrue(singularAttributeSet.contains(entityManufacturer_.getAttribute("id"))); // |
| 2268 |
assertTrue(singularAttributeSet.contains(entityManufacturer_.getAttribute("version"))); // |
2288 |
assertTrue(singularAttributeSet.contains(entityManufacturer_.getAttribute("version"))); // |
|
Lines 2312-2462
Link Here
|
| 2312 |
*/ |
2332 |
*/ |
| 2313 |
//<E> ListAttribute<? super X, E> getList(String name, Class<E> elementType); |
2333 |
//<E> ListAttribute<? super X, E> getList(String name, Class<E> elementType); |
| 2314 |
|
2334 |
|
| 2315 |
/** |
|
|
| 2316 |
* Return the Map-valued attribute of the managed type that |
| 2317 |
* corresponds to the specified name and Java key and value |
| 2318 |
* types. |
| 2319 |
* @param name the name of the represented attribute |
| 2320 |
* @param keyType the key type of the represented attribute |
| 2321 |
* @param valueType the value type of the represented attribute |
| 2322 |
* @return MapAttribute of the given name and key and value |
| 2323 |
* types |
| 2324 |
* @throws IllegalArgumentException if attribute of the given |
| 2325 |
* name and type is not present in the managed type |
| 2326 |
*/ |
| 2327 |
//<K, V> MapAttribute<? super X, K, V> getMap(String name, Class<K> keyType, Class<V> valueType); |
| 2328 |
expectedIAExceptionThrown = false; |
| 2329 |
try { |
| 2330 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 2331 |
entityManufacturer_.getMap("hardwareDesignersMap"); |
| 2332 |
// verify the default key type is the not the Map key - rather that is is the managedType PK |
| 2333 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 2334 |
//@OneToMany(cascade=ALL, mappedBy="mappedEmployer") |
| 2335 |
//private Map<String, HardwareDesigner> hardwareDesignersMap;// = new HashMap<String, HardwareDesigner>(); |
| 2336 |
// http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_63:_20090824:_Add_Map_support_for_.40MapKey_to_MapAttribute |
| 2337 |
// Key is the primary key (PK) of the target entity - in this case HardwareDesigner which inherits its @Id from the Person @MappedSuperclass as '''Integer'''. |
| 2338 |
Type keyType = anAttribute.getKeyType(); |
| 2339 |
//assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 2340 |
assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 2341 |
assertNotNull(keyType); |
| 2342 |
assertTrue(keyType instanceof Type); |
| 2343 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 2344 |
|
| 2345 |
} catch (IllegalArgumentException iae) { |
| 2346 |
iae.printStackTrace(); |
| 2347 |
expectedIAExceptionThrown = true; |
| 2348 |
} |
| 2349 |
assertFalse(expectedIAExceptionThrown); |
| 2350 |
|
| 2351 |
expectedIAExceptionThrown = false; |
| 2352 |
try { |
| 2353 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 2354 |
entityManufacturer_.getMap("hardwareDesignersMapUC1a"); |
| 2355 |
// verify the key type is the Map key - not the managedType PK |
| 2356 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 2357 |
// UC 1a: Generics KV set, no @MapKey present, PK is singular field |
| 2358 |
//@OneToMany(cascade=ALL, mappedBy="mappedEmployerUC1a") |
| 2359 |
//private Map<String, HardwareDesigner> hardwareDesignersMapUC1a; |
| 2360 |
Type keyType = anAttribute.getKeyType(); |
| 2361 |
//assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 2362 |
assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 2363 |
assertNotNull(keyType); |
| 2364 |
assertTrue(keyType instanceof Type); |
| 2365 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 2366 |
} catch (IllegalArgumentException iae) { |
| 2367 |
iae.printStackTrace(); |
| 2368 |
expectedIAExceptionThrown = true; |
| 2369 |
} |
| 2370 |
assertFalse(expectedIAExceptionThrown); |
| 2371 |
|
| 2372 |
expectedIAExceptionThrown = false; |
| 2373 |
try { |
| 2374 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 2375 |
entityManufacturer_.getMap("hardwareDesignersMapUC2"); |
| 2376 |
// verify the key type is the Map key - not the managedType PK |
| 2377 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 2378 |
// UC 2: Generics KV set, @MapKey is present |
| 2379 |
//@OneToMany(cascade=ALL, mappedBy="mappedEmployerUC2") |
| 2380 |
//@MapKey(name="name") |
| 2381 |
//private Map<String, HardwareDesigner> hardwareDesignersMapUC2; |
| 2382 |
Type keyType = anAttribute.getKeyType(); |
| 2383 |
assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 2384 |
//assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 2385 |
assertNotNull(keyType); |
| 2386 |
assertTrue(keyType instanceof Type); |
| 2387 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 2388 |
} catch (IllegalArgumentException iae) { |
| 2389 |
iae.printStackTrace(); |
| 2390 |
expectedIAExceptionThrown = true; |
| 2391 |
} |
| 2392 |
assertFalse(expectedIAExceptionThrown); |
| 2393 |
|
2335 |
|
| 2394 |
expectedIAExceptionThrown = false; |
|
|
| 2395 |
try { |
| 2396 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 2397 |
entityManufacturer_.getMap("hardwareDesignersMapUC4"); |
| 2398 |
// verify the key type is the Map key - not the managedType PK |
| 2399 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 2400 |
// UC 4: No Generics KV set, @MapKey is present |
| 2401 |
//@OneToMany(targetEntity=HardwareDesigner.class, cascade=ALL, mappedBy="mappedEmployerUC4") |
| 2402 |
//@MapKey(name="name") |
| 2403 |
//private Map hardwareDesignersMapUC4; |
| 2404 |
Type keyType = anAttribute.getKeyType(); |
| 2405 |
assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 2406 |
//assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 2407 |
assertNotNull(keyType); |
| 2408 |
assertTrue(keyType instanceof Type); |
| 2409 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 2410 |
} catch (IllegalArgumentException iae) { |
| 2411 |
iae.printStackTrace(); |
| 2412 |
expectedIAExceptionThrown = true; |
| 2413 |
} |
| 2414 |
assertFalse(expectedIAExceptionThrown); |
| 2415 |
|
| 2416 |
expectedIAExceptionThrown = false; |
| 2417 |
try { |
| 2418 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 2419 |
entityManufacturer_.getMap("hardwareDesignersMapUC7"); |
| 2420 |
// verify the key type is the Map key - not the managedType PK |
| 2421 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 2422 |
// UC 7: Generics KV set, targetEntity is also set, @MapKey is *(set/unset) |
| 2423 |
//@OneToMany(targetEntity=HardwareDesigner.class, cascade=ALL, mappedBy="mappedEmployerUC7") |
| 2424 |
// Same as UC1a - that is missing the @MapKey |
| 2425 |
//private Map<String, HardwareDesigner> hardwareDesignersMapUC7; |
| 2426 |
Type keyType = anAttribute.getKeyType(); |
| 2427 |
//assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 2428 |
assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 2429 |
assertNotNull(keyType); |
| 2430 |
assertTrue(keyType instanceof Type); |
| 2431 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 2432 |
} catch (IllegalArgumentException iae) { |
| 2433 |
iae.printStackTrace(); |
| 2434 |
expectedIAExceptionThrown = true; |
| 2435 |
} |
| 2436 |
assertFalse(expectedIAExceptionThrown); |
| 2437 |
|
| 2438 |
expectedIAExceptionThrown = false; |
| 2439 |
try { |
| 2440 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 2441 |
entityManufacturer_.getMap("hardwareDesignersMapUC8"); |
| 2442 |
// verify the key type is the Map key - not the managedType PK |
| 2443 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 2444 |
// UC 8: Generics KV set, targetEntity not set, @MapKey is set but name attribute is defaulted |
| 2445 |
//@OneToMany(targetEntity=HardwareDesigner.class, cascade=ALL, mappedBy="mappedEmployerUC8") |
| 2446 |
// Same as UC1a - that is missing the @MapKey name attribute |
| 2447 |
//private Map<String, HardwareDesigner> hardwareDesignersMapUC8; |
| 2448 |
Type keyType = anAttribute.getKeyType(); |
| 2449 |
//assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 2450 |
assertEquals(Integer.class, keyJavaType); // When @MapKey is not present or missing name attribute - we default to the PK |
| 2451 |
assertNotNull(keyType); |
| 2452 |
assertTrue(keyType instanceof Type); |
| 2453 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 2454 |
} catch (IllegalArgumentException iae) { |
| 2455 |
iae.printStackTrace(); |
| 2456 |
expectedIAExceptionThrown = true; |
| 2457 |
} |
| 2458 |
assertFalse(expectedIAExceptionThrown); |
| 2459 |
|
| 2460 |
/** |
2336 |
/** |
| 2461 |
* Return the Collection-valued attribute declared by the |
2337 |
* Return the Collection-valued attribute declared by the |
| 2462 |
* managed type that corresponds to the specified name and Java |
2338 |
* managed type that corresponds to the specified name and Java |
|
Lines 2630-2648
Link Here
|
| 2630 |
} |
2506 |
} |
| 2631 |
assertTrue("Expected thrown IllegalArgumentException", expectedIAExceptionThrown); |
2507 |
assertTrue("Expected thrown IllegalArgumentException", expectedIAExceptionThrown); |
| 2632 |
|
2508 |
|
| 2633 |
/** |
|
|
| 2634 |
* Return the Map-valued attribute declared by the managed |
| 2635 |
* type that corresponds to the specified name and Java key |
| 2636 |
* and value types. |
| 2637 |
* @param name the name of the represented attribute |
| 2638 |
* @param keyType the key type of the represented attribute |
| 2639 |
* @param valueType the value type of the represented attribute |
| 2640 |
* @return declared MapAttribute of the given name and key |
| 2641 |
* and value types |
| 2642 |
* @throws IllegalArgumentException if attribute of the given |
| 2643 |
* name and type is not declared in the managed type |
| 2644 |
*/ |
| 2645 |
//<K, V> MapAttribute<X, K, V> getDeclaredMap(String name, Class<K> keyType, Class<V> valueType); |
| 2646 |
|
2509 |
|
| 2647 |
/** |
2510 |
/** |
| 2648 |
* Return all collection-valued attributes of the managed type. |
2511 |
* Return all collection-valued attributes of the managed type. |
|
Lines 2952-2959
Link Here
|
| 2952 |
//MapAttribute<X, ?, ?> getDeclaredMap(String name); |
2815 |
//MapAttribute<X, ?, ?> getDeclaredMap(String name); |
| 2953 |
|
2816 |
|
| 2954 |
|
2817 |
|
| 2955 |
} catch (Exception e) { |
2818 |
} catch (IllegalArgumentException iae) { |
| 2956 |
e.printStackTrace(); |
2819 |
iae.printStackTrace(); |
| 2957 |
expectedIAExceptionThrown = true; |
2820 |
expectedIAExceptionThrown = true; |
| 2958 |
} finally { |
2821 |
} finally { |
| 2959 |
cleanup(em); |
2822 |
cleanup(em); |
|
Lines 2962-2968
Link Here
|
| 2962 |
} |
2825 |
} |
| 2963 |
} |
2826 |
} |
| 2964 |
|
2827 |
|
| 2965 |
public void testManagedType_Interface_getDeclaredAttributes_Method() { |
2828 |
public void testManagedType_getDeclaredAttributes_Method() { |
| 2966 |
if(!this.isJPA10()) { |
2829 |
if(!this.isJPA10()) { |
| 2967 |
EntityManager em = null; |
2830 |
EntityManager em = null; |
| 2968 |
boolean expectedIAExceptionThrown = false; |
2831 |
boolean expectedIAExceptionThrown = false; |
|
Lines 2984-2991
Link Here
|
| 2984 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
2847 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 2985 |
assertNotNull(entityHardwareDesigner_); |
2848 |
assertNotNull(entityHardwareDesigner_); |
| 2986 |
|
2849 |
|
| 2987 |
} catch (Exception e) { |
2850 |
} catch (IllegalArgumentException iae) { |
| 2988 |
e.printStackTrace(); |
2851 |
iae.printStackTrace(); |
| 2989 |
expectedIAExceptionThrown = true; |
2852 |
expectedIAExceptionThrown = true; |
| 2990 |
} finally { |
2853 |
} finally { |
| 2991 |
cleanup(em); |
2854 |
cleanup(em); |
|
Lines 2994-3000
Link Here
|
| 2994 |
} |
2857 |
} |
| 2995 |
} |
2858 |
} |
| 2996 |
|
2859 |
|
| 2997 |
public void testManagedType_Interface_getSingularAttribute_Type_param_Method() { |
2860 |
public void testManagedType_getSingularAttribute_Type_param_Method() { |
| 2998 |
if(!this.isJPA10()) { |
2861 |
if(!this.isJPA10()) { |
| 2999 |
EntityManager em = null; |
2862 |
EntityManager em = null; |
| 3000 |
boolean expectedIAExceptionThrown = false; |
2863 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3016-3023
Link Here
|
| 3016 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
2879 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3017 |
assertNotNull(entityHardwareDesigner_); |
2880 |
assertNotNull(entityHardwareDesigner_); |
| 3018 |
|
2881 |
|
| 3019 |
} catch (Exception e) { |
2882 |
} catch (IllegalArgumentException iae) { |
| 3020 |
e.printStackTrace(); |
2883 |
iae.printStackTrace(); |
| 3021 |
expectedIAExceptionThrown = true; |
2884 |
expectedIAExceptionThrown = true; |
| 3022 |
} finally { |
2885 |
} finally { |
| 3023 |
cleanup(em); |
2886 |
cleanup(em); |
|
Lines 3026-3032
Link Here
|
| 3026 |
} |
2889 |
} |
| 3027 |
} |
2890 |
} |
| 3028 |
|
2891 |
|
| 3029 |
public void testManagedType_Interface_getDeclaredSingularAttribute_Type_param_Method() { |
2892 |
public void testManagedType_getDeclaredSingularAttribute_Type_param_Method() { |
| 3030 |
if(!this.isJPA10()) { |
2893 |
if(!this.isJPA10()) { |
| 3031 |
EntityManager em = null; |
2894 |
EntityManager em = null; |
| 3032 |
boolean expectedIAExceptionThrown = false; |
2895 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3048-3055
Link Here
|
| 3048 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
2911 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3049 |
assertNotNull(entityHardwareDesigner_); |
2912 |
assertNotNull(entityHardwareDesigner_); |
| 3050 |
|
2913 |
|
| 3051 |
} catch (Exception e) { |
2914 |
} catch (IllegalArgumentException iae) { |
| 3052 |
e.printStackTrace(); |
2915 |
iae.printStackTrace(); |
| 3053 |
expectedIAExceptionThrown = true; |
2916 |
expectedIAExceptionThrown = true; |
| 3054 |
} finally { |
2917 |
} finally { |
| 3055 |
cleanup(em); |
2918 |
cleanup(em); |
|
Lines 3058-3064
Link Here
|
| 3058 |
} |
2921 |
} |
| 3059 |
} |
2922 |
} |
| 3060 |
|
2923 |
|
| 3061 |
public void testManagedType_Interface_getSingularAttributes_Method() { |
2924 |
public void testManagedType_getSingularAttributes_Method() { |
| 3062 |
if(!this.isJPA10()) { |
2925 |
if(!this.isJPA10()) { |
| 3063 |
EntityManager em = null; |
2926 |
EntityManager em = null; |
| 3064 |
boolean expectedIAExceptionThrown = false; |
2927 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3080-3087
Link Here
|
| 3080 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
2943 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3081 |
assertNotNull(entityHardwareDesigner_); |
2944 |
assertNotNull(entityHardwareDesigner_); |
| 3082 |
|
2945 |
|
| 3083 |
} catch (Exception e) { |
2946 |
} catch (IllegalArgumentException iae) { |
| 3084 |
e.printStackTrace(); |
2947 |
iae.printStackTrace(); |
| 3085 |
expectedIAExceptionThrown = true; |
2948 |
expectedIAExceptionThrown = true; |
| 3086 |
} finally { |
2949 |
} finally { |
| 3087 |
cleanup(em); |
2950 |
cleanup(em); |
|
Lines 3090-3096
Link Here
|
| 3090 |
} |
2953 |
} |
| 3091 |
} |
2954 |
} |
| 3092 |
|
2955 |
|
| 3093 |
public void testManagedType_Interface_getDeclaredSingularAttributes_Method() { |
2956 |
public void testManagedType_getDeclaredSingularAttributes_Method() { |
| 3094 |
if(!this.isJPA10()) { |
2957 |
if(!this.isJPA10()) { |
| 3095 |
EntityManager em = null; |
2958 |
EntityManager em = null; |
| 3096 |
boolean expectedIAExceptionThrown = false; |
2959 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3112-3119
Link Here
|
| 3112 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
2975 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3113 |
assertNotNull(entityHardwareDesigner_); |
2976 |
assertNotNull(entityHardwareDesigner_); |
| 3114 |
|
2977 |
|
| 3115 |
} catch (Exception e) { |
2978 |
} catch (IllegalArgumentException iae) { |
| 3116 |
e.printStackTrace(); |
2979 |
iae.printStackTrace(); |
| 3117 |
expectedIAExceptionThrown = true; |
2980 |
expectedIAExceptionThrown = true; |
| 3118 |
} finally { |
2981 |
} finally { |
| 3119 |
cleanup(em); |
2982 |
cleanup(em); |
|
Lines 3122-3128
Link Here
|
| 3122 |
} |
2985 |
} |
| 3123 |
} |
2986 |
} |
| 3124 |
|
2987 |
|
| 3125 |
public void testManagedType_Interface_getCollection_Type_param_Method() { |
2988 |
public void testManagedType_getCollection_Type_param_Method() { |
| 3126 |
if(!this.isJPA10()) { |
2989 |
if(!this.isJPA10()) { |
| 3127 |
EntityManager em = null; |
2990 |
EntityManager em = null; |
| 3128 |
boolean expectedIAExceptionThrown = false; |
2991 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3144-3151
Link Here
|
| 3144 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3007 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3145 |
assertNotNull(entityHardwareDesigner_); |
3008 |
assertNotNull(entityHardwareDesigner_); |
| 3146 |
|
3009 |
|
| 3147 |
} catch (Exception e) { |
3010 |
} catch (IllegalArgumentException iae) { |
| 3148 |
e.printStackTrace(); |
3011 |
iae.printStackTrace(); |
| 3149 |
expectedIAExceptionThrown = true; |
3012 |
expectedIAExceptionThrown = true; |
| 3150 |
} finally { |
3013 |
} finally { |
| 3151 |
cleanup(em); |
3014 |
cleanup(em); |
|
Lines 3154-3160
Link Here
|
| 3154 |
} |
3017 |
} |
| 3155 |
} |
3018 |
} |
| 3156 |
|
3019 |
|
| 3157 |
public void testManagedType_Interface_getDeclaredCollection_Type_param_Method() { |
3020 |
public void testManagedType_getDeclaredCollection_Type_param_Method() { |
| 3158 |
if(!this.isJPA10()) { |
3021 |
if(!this.isJPA10()) { |
| 3159 |
EntityManager em = null; |
3022 |
EntityManager em = null; |
| 3160 |
boolean expectedIAExceptionThrown = false; |
3023 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3176-3183
Link Here
|
| 3176 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3039 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3177 |
assertNotNull(entityHardwareDesigner_); |
3040 |
assertNotNull(entityHardwareDesigner_); |
| 3178 |
|
3041 |
|
| 3179 |
} catch (Exception e) { |
3042 |
} catch (IllegalArgumentException iae) { |
| 3180 |
e.printStackTrace(); |
3043 |
iae.printStackTrace(); |
| 3181 |
expectedIAExceptionThrown = true; |
3044 |
expectedIAExceptionThrown = true; |
| 3182 |
} finally { |
3045 |
} finally { |
| 3183 |
cleanup(em); |
3046 |
cleanup(em); |
|
Lines 3186-3192
Link Here
|
| 3186 |
} |
3049 |
} |
| 3187 |
} |
3050 |
} |
| 3188 |
|
3051 |
|
| 3189 |
public void testManagedType_Interface_getSet_Type_param_Method() { |
3052 |
public void testManagedType_getSet_Type_param_Method() { |
| 3190 |
if(!this.isJPA10()) { |
3053 |
if(!this.isJPA10()) { |
| 3191 |
EntityManager em = null; |
3054 |
EntityManager em = null; |
| 3192 |
boolean expectedIAExceptionThrown = false; |
3055 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3208-3215
Link Here
|
| 3208 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3071 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3209 |
assertNotNull(entityHardwareDesigner_); |
3072 |
assertNotNull(entityHardwareDesigner_); |
| 3210 |
|
3073 |
|
| 3211 |
} catch (Exception e) { |
3074 |
} catch (IllegalArgumentException iae) { |
| 3212 |
e.printStackTrace(); |
3075 |
iae.printStackTrace(); |
| 3213 |
expectedIAExceptionThrown = true; |
3076 |
expectedIAExceptionThrown = true; |
| 3214 |
} finally { |
3077 |
} finally { |
| 3215 |
cleanup(em); |
3078 |
cleanup(em); |
|
Lines 3218-3224
Link Here
|
| 3218 |
} |
3081 |
} |
| 3219 |
} |
3082 |
} |
| 3220 |
|
3083 |
|
| 3221 |
public void testManagedType_Interface_getDeclaredSet_Type_param_Method() { |
3084 |
public void testManagedType_getDeclaredSet_Type_param_Method() { |
| 3222 |
if(!this.isJPA10()) { |
3085 |
if(!this.isJPA10()) { |
| 3223 |
EntityManager em = null; |
3086 |
EntityManager em = null; |
| 3224 |
boolean expectedIAExceptionThrown = false; |
3087 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3240-3247
Link Here
|
| 3240 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3103 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3241 |
assertNotNull(entityHardwareDesigner_); |
3104 |
assertNotNull(entityHardwareDesigner_); |
| 3242 |
|
3105 |
|
| 3243 |
} catch (Exception e) { |
3106 |
} catch (IllegalArgumentException iae) { |
| 3244 |
e.printStackTrace(); |
3107 |
iae.printStackTrace(); |
| 3245 |
expectedIAExceptionThrown = true; |
3108 |
expectedIAExceptionThrown = true; |
| 3246 |
} finally { |
3109 |
} finally { |
| 3247 |
cleanup(em); |
3110 |
cleanup(em); |
|
Lines 3250-3256
Link Here
|
| 3250 |
} |
3113 |
} |
| 3251 |
} |
3114 |
} |
| 3252 |
|
3115 |
|
| 3253 |
public void testManagedType_Interface_getList_Type_param_Method() { |
3116 |
public void testManagedType_getList_Type_param_Method() { |
| 3254 |
if(!this.isJPA10()) { |
3117 |
if(!this.isJPA10()) { |
| 3255 |
EntityManager em = null; |
3118 |
EntityManager em = null; |
| 3256 |
boolean expectedIAExceptionThrown = false; |
3119 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3272-3279
Link Here
|
| 3272 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3135 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3273 |
assertNotNull(entityHardwareDesigner_); |
3136 |
assertNotNull(entityHardwareDesigner_); |
| 3274 |
|
3137 |
|
| 3275 |
} catch (Exception e) { |
3138 |
} catch (IllegalArgumentException iae) { |
| 3276 |
e.printStackTrace(); |
3139 |
iae.printStackTrace(); |
| 3277 |
expectedIAExceptionThrown = true; |
3140 |
expectedIAExceptionThrown = true; |
| 3278 |
} finally { |
3141 |
} finally { |
| 3279 |
cleanup(em); |
3142 |
cleanup(em); |
|
Lines 3282-3288
Link Here
|
| 3282 |
} |
3145 |
} |
| 3283 |
} |
3146 |
} |
| 3284 |
|
3147 |
|
| 3285 |
public void testManagedType_Interface_getDeclaredList_Type_param_Method() { |
3148 |
public void testManagedType_getDeclaredList_Type_param_Method() { |
| 3286 |
if(!this.isJPA10()) { |
3149 |
if(!this.isJPA10()) { |
| 3287 |
EntityManager em = null; |
3150 |
EntityManager em = null; |
| 3288 |
boolean expectedIAExceptionThrown = false; |
3151 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3304-3311
Link Here
|
| 3304 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3167 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3305 |
assertNotNull(entityHardwareDesigner_); |
3168 |
assertNotNull(entityHardwareDesigner_); |
| 3306 |
|
3169 |
|
| 3307 |
} catch (Exception e) { |
3170 |
} catch (IllegalArgumentException iae) { |
| 3308 |
e.printStackTrace(); |
3171 |
iae.printStackTrace(); |
| 3309 |
expectedIAExceptionThrown = true; |
3172 |
expectedIAExceptionThrown = true; |
| 3310 |
} finally { |
3173 |
} finally { |
| 3311 |
cleanup(em); |
3174 |
cleanup(em); |
|
Lines 3314-3320
Link Here
|
| 3314 |
} |
3177 |
} |
| 3315 |
} |
3178 |
} |
| 3316 |
|
3179 |
|
| 3317 |
public void testManagedType_Interface_getMap_Type_param_Method() { |
3180 |
public void testManagedType_getMap_Type_param_Method() { |
| 3318 |
if(!this.isJPA10()) { |
3181 |
if(!this.isJPA10()) { |
| 3319 |
EntityManager em = null; |
3182 |
EntityManager em = null; |
| 3320 |
boolean expectedIAExceptionThrown = false; |
3183 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3336-3343
Link Here
|
| 3336 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3199 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3337 |
assertNotNull(entityHardwareDesigner_); |
3200 |
assertNotNull(entityHardwareDesigner_); |
| 3338 |
|
3201 |
|
| 3339 |
} catch (Exception e) { |
3202 |
/** |
| 3340 |
e.printStackTrace(); |
3203 |
* Return the Map-valued attribute of the managed type that |
|
|
3204 |
* corresponds to the specified name and Java key and value |
| 3205 |
* types. |
| 3206 |
* @param name the name of the represented attribute |
| 3207 |
* @param keyType the key type of the represented attribute |
| 3208 |
* @param valueType the value type of the represented attribute |
| 3209 |
* @return MapAttribute of the given name and key and value |
| 3210 |
* types |
| 3211 |
* @throws IllegalArgumentException if attribute of the given |
| 3212 |
* name and type is not present in the managed type |
| 3213 |
*/ |
| 3214 |
//<K, V> MapAttribute<? super X, K, V> getMap(String name, Class<K> keyType, Class<V> valueType); |
| 3215 |
expectedIAExceptionThrown = false; |
| 3216 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 3217 |
entityManufacturer_.getMap("hardwareDesignersMap", Integer.class, HardwareDesigner.class); |
| 3218 |
// verify the default key type is the not the Map key - rather that is is the managedType PK |
| 3219 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 3220 |
//@OneToMany(cascade=ALL, mappedBy="mappedEmployer") |
| 3221 |
//private Map<String, HardwareDesigner> hardwareDesignersMap;// = new HashMap<String, HardwareDesigner>(); |
| 3222 |
// http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_63:_20090824:_Add_Map_support_for_.40MapKey_to_MapAttribute |
| 3223 |
// Key is the primary key (PK) of the target entity - in this case HardwareDesigner which inherits its @Id from the Person @MappedSuperclass as '''Integer'''. |
| 3224 |
Type keyType = anAttribute.getKeyType(); |
| 3225 |
//assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 3226 |
assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 3227 |
assertNotNull(keyType); |
| 3228 |
assertTrue(keyType instanceof Type); |
| 3229 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 3230 |
} catch (IllegalArgumentException iae) { |
| 3231 |
iae.printStackTrace(); |
| 3341 |
expectedIAExceptionThrown = true; |
3232 |
expectedIAExceptionThrown = true; |
| 3342 |
} finally { |
3233 |
} finally { |
| 3343 |
cleanup(em); |
3234 |
cleanup(em); |
|
Lines 3346-3352
Link Here
|
| 3346 |
} |
3237 |
} |
| 3347 |
} |
3238 |
} |
| 3348 |
|
3239 |
|
| 3349 |
public void testManagedType_Interface_getDeclaredMap_Type_param_Method() { |
3240 |
public void testManagedType_getDeclaredMap_Type_param_declared_above_Method() { |
|
|
3241 |
|
| 3242 |
} |
| 3243 |
|
| 3244 |
public void testManagedType_getDeclaredMap_Type_param_not_found_iae_Method() { |
| 3245 |
|
| 3246 |
} |
| 3247 |
|
| 3248 |
public void testManagedType_getDeclaredMap_Type_param_Method() { |
| 3350 |
if(!this.isJPA10()) { |
3249 |
if(!this.isJPA10()) { |
| 3351 |
EntityManager em = null; |
3250 |
EntityManager em = null; |
| 3352 |
boolean expectedIAExceptionThrown = false; |
3251 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3368-3375
Link Here
|
| 3368 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3267 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3369 |
assertNotNull(entityHardwareDesigner_); |
3268 |
assertNotNull(entityHardwareDesigner_); |
| 3370 |
|
3269 |
|
| 3371 |
} catch (Exception e) { |
3270 |
/** |
| 3372 |
e.printStackTrace(); |
3271 |
* Return the Map-valued attribute declared by the managed |
|
|
3272 |
* type that corresponds to the specified name and Java key |
| 3273 |
* and value types. |
| 3274 |
* @param name the name of the represented attribute |
| 3275 |
* @param keyType the key type of the represented attribute |
| 3276 |
* @param valueType the value type of the represented attribute |
| 3277 |
* @return declared MapAttribute of the given name and key |
| 3278 |
* and value types |
| 3279 |
* @throws IllegalArgumentException if attribute of the given |
| 3280 |
* name and type is not declared in the managed type |
| 3281 |
*/ |
| 3282 |
//<K, V> MapAttribute<X, K, V> getDeclaredMap(String name, Class<K> keyType, Class<V> valueType); |
| 3283 |
expectedIAExceptionThrown = false; |
| 3284 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 3285 |
entityManufacturer_.getDeclaredMap("hardwareDesignersMap", Integer.class, HardwareDesigner.class); |
| 3286 |
// verify the default key type is the not the Map key - rather that is is the managedType PK |
| 3287 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 3288 |
//@OneToMany(cascade=ALL, mappedBy="mappedEmployer") |
| 3289 |
//private Map<String, HardwareDesigner> hardwareDesignersMap;// = new HashMap<String, HardwareDesigner>(); |
| 3290 |
// http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_63:_20090824:_Add_Map_support_for_.40MapKey_to_MapAttribute |
| 3291 |
// Key is the primary key (PK) of the target entity - in this case HardwareDesigner which inherits its @Id from the Person @MappedSuperclass as '''Integer'''. |
| 3292 |
Type keyType = anAttribute.getKeyType(); |
| 3293 |
//assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 3294 |
assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 3295 |
assertNotNull(keyType); |
| 3296 |
assertTrue(keyType instanceof Type); |
| 3297 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 3298 |
} catch (IllegalArgumentException iae) { |
| 3299 |
iae.printStackTrace(); |
| 3373 |
expectedIAExceptionThrown = true; |
3300 |
expectedIAExceptionThrown = true; |
| 3374 |
} finally { |
3301 |
} finally { |
| 3375 |
cleanup(em); |
3302 |
cleanup(em); |
|
Lines 3378-3384
Link Here
|
| 3378 |
} |
3305 |
} |
| 3379 |
} |
3306 |
} |
| 3380 |
|
3307 |
|
| 3381 |
public void testManagedType_Interface_getPluralAttributes_Method() { |
3308 |
public void testManagedType_getPluralAttributes_Method() { |
| 3382 |
if(!this.isJPA10()) { |
3309 |
if(!this.isJPA10()) { |
| 3383 |
EntityManager em = null; |
3310 |
EntityManager em = null; |
| 3384 |
boolean expectedIAExceptionThrown = false; |
3311 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3400-3407
Link Here
|
| 3400 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3327 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3401 |
assertNotNull(entityHardwareDesigner_); |
3328 |
assertNotNull(entityHardwareDesigner_); |
| 3402 |
|
3329 |
|
| 3403 |
} catch (Exception e) { |
3330 |
} catch (IllegalArgumentException iae) { |
| 3404 |
e.printStackTrace(); |
3331 |
iae.printStackTrace(); |
| 3405 |
expectedIAExceptionThrown = true; |
3332 |
expectedIAExceptionThrown = true; |
| 3406 |
} finally { |
3333 |
} finally { |
| 3407 |
cleanup(em); |
3334 |
cleanup(em); |
|
Lines 3410-3416
Link Here
|
| 3410 |
} |
3337 |
} |
| 3411 |
} |
3338 |
} |
| 3412 |
|
3339 |
|
| 3413 |
public void testManagedType_Interface_getDeclaredPluralAttributes_internal_entity_Method() { |
3340 |
public void testManagedType_getDeclaredPluralAttributes_internal_entity_Method() { |
| 3414 |
if(!this.isJPA10()) { |
3341 |
if(!this.isJPA10()) { |
| 3415 |
EntityManager em = null; |
3342 |
EntityManager em = null; |
| 3416 |
boolean expectedIAExceptionThrown = false; |
3343 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3445-3452
Link Here
|
| 3445 |
} |
3372 |
} |
| 3446 |
assertFalse(expectedIAExceptionThrown); |
3373 |
assertFalse(expectedIAExceptionThrown); |
| 3447 |
|
3374 |
|
| 3448 |
} catch (Exception e) { |
3375 |
} catch (IllegalArgumentException iae) { |
| 3449 |
e.printStackTrace(); |
3376 |
iae.printStackTrace(); |
| 3450 |
expectedIAExceptionThrown = true; |
3377 |
expectedIAExceptionThrown = true; |
| 3451 |
} finally { |
3378 |
} finally { |
| 3452 |
cleanup(em); |
3379 |
cleanup(em); |
|
Lines 3455-3461
Link Here
|
| 3455 |
} |
3382 |
} |
| 3456 |
} |
3383 |
} |
| 3457 |
|
3384 |
|
| 3458 |
public void testManagedType_Interface_getDeclaredPluralAttributes_root_entity_Method() { |
3385 |
public void testManagedType_getDeclaredPluralAttributes_root_entity_Method() { |
| 3459 |
if(!this.isJPA10()) { |
3386 |
if(!this.isJPA10()) { |
| 3460 |
EntityManager em = null; |
3387 |
EntityManager em = null; |
| 3461 |
boolean expectedIAExceptionThrown = false; |
3388 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3468-3486
Link Here
|
| 3468 |
assertNotNull(entityComputer_); |
3395 |
assertNotNull(entityComputer_); |
| 3469 |
// This also tests getCollections() |
3396 |
// This also tests getCollections() |
| 3470 |
expectedIAExceptionThrown = false; |
3397 |
expectedIAExceptionThrown = false; |
| 3471 |
try { |
3398 |
Set<PluralAttribute<Computer, ?, ?>> collections = |
| 3472 |
Set<PluralAttribute<Computer, ?, ?>> collections = |
3399 |
entityComputer_.getDeclaredPluralAttributes(); |
| 3473 |
entityComputer_.getDeclaredPluralAttributes(); |
3400 |
assertNotNull(collections); |
| 3474 |
assertNotNull(collections); |
3401 |
} catch (IllegalArgumentException iae) { |
| 3475 |
|
3402 |
iae.printStackTrace(); |
| 3476 |
} catch (IllegalArgumentException iae) { |
|
|
| 3477 |
iae.printStackTrace(); |
| 3478 |
expectedIAExceptionThrown = true; |
| 3479 |
} |
| 3480 |
assertFalse(expectedIAExceptionThrown); |
| 3481 |
|
| 3482 |
} catch (Exception e) { |
| 3483 |
e.printStackTrace(); |
| 3484 |
expectedIAExceptionThrown = true; |
3403 |
expectedIAExceptionThrown = true; |
| 3485 |
} finally { |
3404 |
} finally { |
| 3486 |
cleanup(em); |
3405 |
cleanup(em); |
|
Lines 3490-3496
Link Here
|
| 3490 |
} |
3409 |
} |
| 3491 |
|
3410 |
|
| 3492 |
// Requires test model expansion before enabling test |
3411 |
// Requires test model expansion before enabling test |
| 3493 |
public void testManagedType_Interface_getDeclaredPluralAttributes_root_mappedSuperclass_Method() { |
3412 |
public void testManagedType_getDeclaredPluralAttributes_root_mappedSuperclass_Method() { |
| 3494 |
if(!this.isJPA10()) { |
3413 |
if(!this.isJPA10()) { |
| 3495 |
EntityManager em = null; |
3414 |
EntityManager em = null; |
| 3496 |
boolean expectedIAExceptionThrown = false; |
3415 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3509-3516
Link Here
|
| 3509 |
// historicalComputers is defined as a plural declared attribute on a root mappedSuperclass |
3428 |
// historicalComputers is defined as a plural declared attribute on a root mappedSuperclass |
| 3510 |
Set<PluralAttribute<Person, ?, ?>> collections = |
3429 |
Set<PluralAttribute<Person, ?, ?>> collections = |
| 3511 |
msPerson_.getDeclaredPluralAttributes(); |
3430 |
msPerson_.getDeclaredPluralAttributes(); |
| 3512 |
} catch (Exception e) { |
3431 |
} catch (IllegalArgumentException iae) { |
| 3513 |
e.printStackTrace(); |
3432 |
iae.printStackTrace(); |
| 3514 |
expectedIAExceptionThrown = true; |
3433 |
expectedIAExceptionThrown = true; |
| 3515 |
} finally { |
3434 |
} finally { |
| 3516 |
cleanup(em); |
3435 |
cleanup(em); |
|
Lines 3519-3525
Link Here
|
| 3519 |
} |
3438 |
} |
| 3520 |
} |
3439 |
} |
| 3521 |
|
3440 |
|
| 3522 |
public void testManagedType_Interface_getAttribute_on_Entity_Method() { |
3441 |
public void testManagedType_getAttribute_on_Entity_Method() { |
| 3523 |
if(!this.isJPA10()) { |
3442 |
if(!this.isJPA10()) { |
| 3524 |
EntityManager em = null; |
3443 |
EntityManager em = null; |
| 3525 |
boolean expectedIAExceptionThrown = false; |
3444 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3543-3550
Link Here
|
| 3543 |
assertEquals(CollectionType.MAP, ((MapAttribute)anAttribute).getCollectionType()); |
3462 |
assertEquals(CollectionType.MAP, ((MapAttribute)anAttribute).getCollectionType()); |
| 3544 |
assertEquals(String.class, ((MapAttribute)anAttribute).getKeyJavaType()); |
3463 |
assertEquals(String.class, ((MapAttribute)anAttribute).getKeyJavaType()); |
| 3545 |
assertEquals(HardwareDesigner.class, anAttribute.getJavaType()); |
3464 |
assertEquals(HardwareDesigner.class, anAttribute.getJavaType()); |
| 3546 |
} catch (Exception e) { |
3465 |
} catch (IllegalArgumentException iae) { |
| 3547 |
e.printStackTrace(); |
3466 |
iae.printStackTrace(); |
| 3548 |
expectedIAExceptionThrown = true; |
3467 |
expectedIAExceptionThrown = true; |
| 3549 |
} finally { |
3468 |
} finally { |
| 3550 |
cleanup(em); |
3469 |
cleanup(em); |
|
Lines 3553-3559
Link Here
|
| 3553 |
} |
3472 |
} |
| 3554 |
} |
3473 |
} |
| 3555 |
|
3474 |
|
| 3556 |
public void testManagedType_Interface_getAttribute_on_MappedSuperclass_Method() { |
3475 |
public void testManagedType_getAttribute_on_MappedSuperclass_Method() { |
| 3557 |
if(!this.isJPA10()) { |
3476 |
if(!this.isJPA10()) { |
| 3558 |
EntityManager em = null; |
3477 |
EntityManager em = null; |
| 3559 |
boolean expectedIAExceptionThrown = false; |
3478 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3578-3585
Link Here
|
| 3578 |
assertEquals(entityComputer_, ((CollectionAttribute)anAttribute).getElementType()); |
3497 |
assertEquals(entityComputer_, ((CollectionAttribute)anAttribute).getElementType()); |
| 3579 |
assertEquals(CollectionType.COLLECTION, ((CollectionAttribute)anAttribute).getCollectionType()); |
3498 |
assertEquals(CollectionType.COLLECTION, ((CollectionAttribute)anAttribute).getCollectionType()); |
| 3580 |
assertEquals(Computer.class, anAttribute.getJavaType()); |
3499 |
assertEquals(Computer.class, anAttribute.getJavaType()); |
| 3581 |
} catch (Exception e) { |
3500 |
} catch (IllegalArgumentException iae) { |
| 3582 |
e.printStackTrace(); |
3501 |
iae.printStackTrace(); |
| 3583 |
expectedIAExceptionThrown = true; |
3502 |
expectedIAExceptionThrown = true; |
| 3584 |
} finally { |
3503 |
} finally { |
| 3585 |
cleanup(em); |
3504 |
cleanup(em); |
|
Lines 3588-3594
Link Here
|
| 3588 |
} |
3507 |
} |
| 3589 |
} |
3508 |
} |
| 3590 |
|
3509 |
|
| 3591 |
public void testManagedType_Interface_getAttribute_doesNotExist_on_Entity_Method() { |
3510 |
public void testManagedType_getAttribute_doesNotExist_on_Entity_Method() { |
| 3592 |
if(!this.isJPA10()) { |
3511 |
if(!this.isJPA10()) { |
| 3593 |
EntityManager em = null; |
3512 |
EntityManager em = null; |
| 3594 |
boolean expectedIAExceptionThrown = false; |
3513 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3605-3613
Link Here
|
| 3605 |
|
3524 |
|
| 3606 |
// Test case |
3525 |
// Test case |
| 3607 |
anAttribute = entityManufacturer_.getAttribute("does_not_exist"); |
3526 |
anAttribute = entityManufacturer_.getAttribute("does_not_exist"); |
| 3608 |
} catch (Exception e) { |
3527 |
} catch (IllegalArgumentException iae) { |
| 3609 |
// We expect and exception |
3528 |
// We expect an exception |
| 3610 |
//e.printStackTrace(); |
3529 |
//iae.printStackTrace(); |
| 3611 |
expectedIAExceptionThrown = true; |
3530 |
expectedIAExceptionThrown = true; |
| 3612 |
} finally { |
3531 |
} finally { |
| 3613 |
cleanup(em); |
3532 |
cleanup(em); |
|
Lines 3617-3623
Link Here
|
| 3617 |
} |
3536 |
} |
| 3618 |
} |
3537 |
} |
| 3619 |
|
3538 |
|
| 3620 |
public void testManagedType_Interface_getAttribute_doesNotExist_on_MappedSuperclass_Method() { |
3539 |
public void testManagedType_getAttribute_doesNotExist_on_MappedSuperclass_Method() { |
| 3621 |
if(!this.isJPA10()) { |
3540 |
if(!this.isJPA10()) { |
| 3622 |
EntityManager em = null; |
3541 |
EntityManager em = null; |
| 3623 |
boolean expectedIAExceptionThrown = false; |
3542 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3632-3640
Link Here
|
| 3632 |
|
3551 |
|
| 3633 |
// Test case |
3552 |
// Test case |
| 3634 |
anAttribute = msCorporation_.getAttribute("does_not_exist"); |
3553 |
anAttribute = msCorporation_.getAttribute("does_not_exist"); |
| 3635 |
} catch (Exception e) { |
3554 |
} catch (IllegalArgumentException iae) { |
| 3636 |
// We expect and exception |
3555 |
// We expect and exception |
| 3637 |
//e.printStackTrace(); |
3556 |
//iae.printStackTrace(); |
| 3638 |
expectedIAExceptionThrown = true; |
3557 |
expectedIAExceptionThrown = true; |
| 3639 |
} finally { |
3558 |
} finally { |
| 3640 |
cleanup(em); |
3559 |
cleanup(em); |
|
Lines 3644-3650
Link Here
|
| 3644 |
} |
3563 |
} |
| 3645 |
} |
3564 |
} |
| 3646 |
|
3565 |
|
| 3647 |
public void testManagedType_Interface_getDeclaredAttribute_Method() { |
3566 |
public void testManagedType_getDeclaredAttribute_Method() { |
| 3648 |
if(!this.isJPA10()) { |
3567 |
if(!this.isJPA10()) { |
| 3649 |
EntityManager em = null; |
3568 |
EntityManager em = null; |
| 3650 |
boolean expectedIAExceptionThrown = false; |
3569 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3668-3675
Link Here
|
| 3668 |
assertEquals(CollectionType.MAP, ((MapAttribute)anAttribute).getCollectionType()); |
3587 |
assertEquals(CollectionType.MAP, ((MapAttribute)anAttribute).getCollectionType()); |
| 3669 |
assertEquals(String.class, ((MapAttribute)anAttribute).getKeyJavaType()); |
3588 |
assertEquals(String.class, ((MapAttribute)anAttribute).getKeyJavaType()); |
| 3670 |
assertEquals(HardwareDesigner.class, anAttribute.getJavaType()); |
3589 |
assertEquals(HardwareDesigner.class, anAttribute.getJavaType()); |
| 3671 |
} catch (Exception e) { |
3590 |
} catch (IllegalArgumentException iae) { |
| 3672 |
e.printStackTrace(); |
3591 |
iae.printStackTrace(); |
| 3673 |
expectedIAExceptionThrown = true; |
3592 |
expectedIAExceptionThrown = true; |
| 3674 |
} finally { |
3593 |
} finally { |
| 3675 |
cleanup(em); |
3594 |
cleanup(em); |
|
Lines 3678-3684
Link Here
|
| 3678 |
} |
3597 |
} |
| 3679 |
} |
3598 |
} |
| 3680 |
|
3599 |
|
| 3681 |
public void testManagedType_Interface_getDeclaredAttribute_above_throws_iae_Method() { |
3600 |
public void testManagedType_getDeclaredAttribute_above_throws_iae_Method() { |
| 3682 |
if(!this.isJPA10()) { |
3601 |
if(!this.isJPA10()) { |
| 3683 |
EntityManager em = null; |
3602 |
EntityManager em = null; |
| 3684 |
boolean expectedIAExceptionThrown = false; |
3603 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3695-3703
Link Here
|
| 3695 |
// attribute is declared on a mappedsuperclass |
3614 |
// attribute is declared on a mappedsuperclass |
| 3696 |
// Note: internally EclipseLink treats a ONE_TO_MANY as a MANY_TO_MANY for the case of a unidirectional mapping on a MappedSuperclass |
3615 |
// Note: internally EclipseLink treats a ONE_TO_MANY as a MANY_TO_MANY for the case of a unidirectional mapping on a MappedSuperclass |
| 3697 |
anAttribute = entityManufacturer_.getDeclaredAttribute("corporateComputers "); |
3616 |
anAttribute = entityManufacturer_.getDeclaredAttribute("corporateComputers "); |
| 3698 |
} catch (Exception e) { |
3617 |
} catch (IllegalArgumentException iae) { |
| 3699 |
// We expect and exception |
3618 |
// We expect and exception |
| 3700 |
//e.printStackTrace(); |
3619 |
//iae.printStackTrace(); |
| 3701 |
expectedIAExceptionThrown = true; |
3620 |
expectedIAExceptionThrown = true; |
| 3702 |
} finally { |
3621 |
} finally { |
| 3703 |
cleanup(em); |
3622 |
cleanup(em); |
|
Lines 3707-3713
Link Here
|
| 3707 |
} |
3626 |
} |
| 3708 |
} |
3627 |
} |
| 3709 |
|
3628 |
|
| 3710 |
public void testManagedType_Interface_getDeclaredAttribute_doesNotExist_Method() { |
3629 |
public void testManagedType_getDeclaredAttribute_doesNotExist_Method() { |
| 3711 |
if(!this.isJPA10()) { |
3630 |
if(!this.isJPA10()) { |
| 3712 |
EntityManager em = null; |
3631 |
EntityManager em = null; |
| 3713 |
boolean expectedIAExceptionThrown = false; |
3632 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3722-3730
Link Here
|
| 3722 |
|
3641 |
|
| 3723 |
// Test case |
3642 |
// Test case |
| 3724 |
anAttribute = entityManufacturer_.getDeclaredAttribute("does_not_exist"); |
3643 |
anAttribute = entityManufacturer_.getDeclaredAttribute("does_not_exist"); |
| 3725 |
} catch (Exception e) { |
3644 |
} catch (IllegalArgumentException iae) { |
| 3726 |
// We expect and exception |
3645 |
// We expect and exception |
| 3727 |
//e.printStackTrace(); |
3646 |
//iae.printStackTrace(); |
| 3728 |
expectedIAExceptionThrown = true; |
3647 |
expectedIAExceptionThrown = true; |
| 3729 |
} finally { |
3648 |
} finally { |
| 3730 |
cleanup(em); |
3649 |
cleanup(em); |
|
Lines 3735-3741
Link Here
|
| 3735 |
} |
3654 |
} |
| 3736 |
|
3655 |
|
| 3737 |
|
3656 |
|
| 3738 |
public void testManagedType_Interface_getSingularAttribute_BASIC_Method() { |
3657 |
public void testManagedType_getSingularAttribute_BASIC_Method() { |
| 3739 |
if(!this.isJPA10()) { |
3658 |
if(!this.isJPA10()) { |
| 3740 |
EntityManager em = null; |
3659 |
EntityManager em = null; |
| 3741 |
boolean expectedIAExceptionThrown = false; |
3660 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3756-3763
Link Here
|
| 3756 |
assertFalse(((AttributeImpl)anAttribute).isPlural()); |
3675 |
assertFalse(((AttributeImpl)anAttribute).isPlural()); |
| 3757 |
assertTrue(anAttribute instanceof SingularAttribute); |
3676 |
assertTrue(anAttribute instanceof SingularAttribute); |
| 3758 |
assertEquals(int.class, anAttribute.getJavaType()); |
3677 |
assertEquals(int.class, anAttribute.getJavaType()); |
| 3759 |
} catch (Exception e) { |
3678 |
} catch (IllegalArgumentException iae) { |
| 3760 |
e.printStackTrace(); |
3679 |
iae.printStackTrace(); |
| 3761 |
expectedIAExceptionThrown = true; |
3680 |
expectedIAExceptionThrown = true; |
| 3762 |
} finally { |
3681 |
} finally { |
| 3763 |
cleanup(em); |
3682 |
cleanup(em); |
|
Lines 3766-3772
Link Here
|
| 3766 |
} |
3685 |
} |
| 3767 |
} |
3686 |
} |
| 3768 |
|
3687 |
|
| 3769 |
public void testManagedType_Interface_getSingularAttribute_EMBEDDED_Method() { |
3688 |
public void testManagedType_getSingularAttribute_EMBEDDED_Method() { |
| 3770 |
if(!this.isJPA10()) { |
3689 |
if(!this.isJPA10()) { |
| 3771 |
EntityManager em = null; |
3690 |
EntityManager em = null; |
| 3772 |
boolean expectedIAExceptionThrown = false; |
3691 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3781-3788
Link Here
|
| 3781 |
assertNotNull(entityComputer_); |
3700 |
assertNotNull(entityComputer_); |
| 3782 |
|
3701 |
|
| 3783 |
// not implemented |
3702 |
// not implemented |
| 3784 |
} catch (Exception e) { |
3703 |
} catch (IllegalArgumentException iae) { |
| 3785 |
e.printStackTrace(); |
3704 |
iae.printStackTrace(); |
| 3786 |
expectedIAExceptionThrown = true; |
3705 |
expectedIAExceptionThrown = true; |
| 3787 |
} finally { |
3706 |
} finally { |
| 3788 |
cleanup(em); |
3707 |
cleanup(em); |
|
Lines 3791-3797
Link Here
|
| 3791 |
} |
3710 |
} |
| 3792 |
} |
3711 |
} |
| 3793 |
|
3712 |
|
| 3794 |
public void testManagedType_Interface_getDeclaredSingularAttribute_on_Entity_Method() { |
3713 |
public void testManagedType_getDeclaredSingularAttribute_on_Entity_Method() { |
| 3795 |
if(!this.isJPA10()) { |
3714 |
if(!this.isJPA10()) { |
| 3796 |
EntityManager em = null; |
3715 |
EntityManager em = null; |
| 3797 |
boolean expectedIAExceptionThrown = false; |
3716 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3810-3817
Link Here
|
| 3810 |
assertEquals(PersistentAttributeType.ONE_TO_ONE, anAttribute.getPersistentAttributeType()); |
3729 |
assertEquals(PersistentAttributeType.ONE_TO_ONE, anAttribute.getPersistentAttributeType()); |
| 3811 |
assertFalse(((AttributeImpl)anAttribute).isPlural()); |
3730 |
assertFalse(((AttributeImpl)anAttribute).isPlural()); |
| 3812 |
assertTrue(anAttribute instanceof SingularAttribute); |
3731 |
assertTrue(anAttribute instanceof SingularAttribute); |
| 3813 |
} catch (Exception e) { |
3732 |
} catch (IllegalArgumentException iae) { |
| 3814 |
e.printStackTrace(); |
3733 |
iae.printStackTrace(); |
| 3815 |
expectedIAExceptionThrown = true; |
3734 |
expectedIAExceptionThrown = true; |
| 3816 |
} finally { |
3735 |
} finally { |
| 3817 |
cleanup(em); |
3736 |
cleanup(em); |
|
Lines 3820-3826
Link Here
|
| 3820 |
} |
3739 |
} |
| 3821 |
} |
3740 |
} |
| 3822 |
|
3741 |
|
| 3823 |
public void testManagedType_Interface_getDeclaredSingularAttribute_on_MappedSuperclass_Method() { |
3742 |
public void testManagedType_getDeclaredSingularAttribute_on_MappedSuperclass_Method() { |
| 3824 |
if(!this.isJPA10()) { |
3743 |
if(!this.isJPA10()) { |
| 3825 |
EntityManager em = null; |
3744 |
EntityManager em = null; |
| 3826 |
boolean expectedIAExceptionThrown = false; |
3745 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3839-3846
Link Here
|
| 3839 |
assertFalse(((AttributeImpl)anAttribute).isPlural()); |
3758 |
assertFalse(((AttributeImpl)anAttribute).isPlural()); |
| 3840 |
assertTrue(anAttribute instanceof SingularAttribute); |
3759 |
assertTrue(anAttribute instanceof SingularAttribute); |
| 3841 |
assertEquals(String.class, anAttribute.getJavaType()); |
3760 |
assertEquals(String.class, anAttribute.getJavaType()); |
| 3842 |
} catch (Exception e) { |
3761 |
} catch (IllegalArgumentException iae) { |
| 3843 |
e.printStackTrace(); |
3762 |
iae.printStackTrace(); |
| 3844 |
expectedIAExceptionThrown = true; |
3763 |
expectedIAExceptionThrown = true; |
| 3845 |
} finally { |
3764 |
} finally { |
| 3846 |
cleanup(em); |
3765 |
cleanup(em); |
|
Lines 3849-3855
Link Here
|
| 3849 |
} |
3768 |
} |
| 3850 |
} |
3769 |
} |
| 3851 |
|
3770 |
|
| 3852 |
public void testManagedType_Interface_getCollection_Method() { |
3771 |
public void testManagedType_getCollection_Method() { |
| 3853 |
if(!this.isJPA10()) { |
3772 |
if(!this.isJPA10()) { |
| 3854 |
EntityManager em = null; |
3773 |
EntityManager em = null; |
| 3855 |
boolean expectedIAExceptionThrown = false; |
3774 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3871-3878
Link Here
|
| 3871 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3790 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3872 |
assertNotNull(entityHardwareDesigner_); |
3791 |
assertNotNull(entityHardwareDesigner_); |
| 3873 |
|
3792 |
|
| 3874 |
} catch (Exception e) { |
3793 |
} catch (IllegalArgumentException iae) { |
| 3875 |
e.printStackTrace(); |
3794 |
iae.printStackTrace(); |
| 3876 |
expectedIAExceptionThrown = true; |
3795 |
expectedIAExceptionThrown = true; |
| 3877 |
} finally { |
3796 |
} finally { |
| 3878 |
cleanup(em); |
3797 |
cleanup(em); |
|
Lines 3881-3887
Link Here
|
| 3881 |
} |
3800 |
} |
| 3882 |
} |
3801 |
} |
| 3883 |
|
3802 |
|
| 3884 |
public void testManagedType_Interface_getDeclaredCollection_Method() { |
3803 |
public void testManagedType_getDeclaredCollection_Method() { |
| 3885 |
if(!this.isJPA10()) { |
3804 |
if(!this.isJPA10()) { |
| 3886 |
EntityManager em = null; |
3805 |
EntityManager em = null; |
| 3887 |
boolean expectedIAExceptionThrown = false; |
3806 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3903-3910
Link Here
|
| 3903 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3822 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3904 |
assertNotNull(entityHardwareDesigner_); |
3823 |
assertNotNull(entityHardwareDesigner_); |
| 3905 |
|
3824 |
|
| 3906 |
} catch (Exception e) { |
3825 |
} catch (IllegalArgumentException iae) { |
| 3907 |
e.printStackTrace(); |
3826 |
iae.printStackTrace(); |
| 3908 |
expectedIAExceptionThrown = true; |
3827 |
expectedIAExceptionThrown = true; |
| 3909 |
} finally { |
3828 |
} finally { |
| 3910 |
cleanup(em); |
3829 |
cleanup(em); |
|
Lines 3913-3919
Link Here
|
| 3913 |
} |
3832 |
} |
| 3914 |
} |
3833 |
} |
| 3915 |
|
3834 |
|
| 3916 |
public void testManagedType_Interface_getSet_Method() { |
3835 |
public void testManagedType_getSet_Method() { |
| 3917 |
if(!this.isJPA10()) { |
3836 |
if(!this.isJPA10()) { |
| 3918 |
EntityManager em = null; |
3837 |
EntityManager em = null; |
| 3919 |
boolean expectedIAExceptionThrown = false; |
3838 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3938-3945
Link Here
|
| 3938 |
entityManufacturer_.getSet("computers", Computer.class); |
3857 |
entityManufacturer_.getSet("computers", Computer.class); |
| 3939 |
assertNotNull("computers SetAttribute should not be null in Manufacturer_", computersAttribute); |
3858 |
assertNotNull("computers SetAttribute should not be null in Manufacturer_", computersAttribute); |
| 3940 |
|
3859 |
|
| 3941 |
} catch (Exception e) { |
3860 |
} catch (IllegalArgumentException iae) { |
| 3942 |
e.printStackTrace(); |
3861 |
iae.printStackTrace(); |
| 3943 |
expectedIAExceptionThrown = true; |
3862 |
expectedIAExceptionThrown = true; |
| 3944 |
} finally { |
3863 |
} finally { |
| 3945 |
cleanup(em); |
3864 |
cleanup(em); |
|
Lines 3948-3954
Link Here
|
| 3948 |
} |
3867 |
} |
| 3949 |
} |
3868 |
} |
| 3950 |
|
3869 |
|
| 3951 |
public void testManagedType_Interface_getDeclaredSet_Method() { |
3870 |
public void testManagedType_getDeclaredSet_Method() { |
| 3952 |
if(!this.isJPA10()) { |
3871 |
if(!this.isJPA10()) { |
| 3953 |
EntityManager em = null; |
3872 |
EntityManager em = null; |
| 3954 |
boolean expectedIAExceptionThrown = false; |
3873 |
boolean expectedIAExceptionThrown = false; |
|
Lines 3970-3977
Link Here
|
| 3970 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3889 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 3971 |
assertNotNull(entityHardwareDesigner_); |
3890 |
assertNotNull(entityHardwareDesigner_); |
| 3972 |
|
3891 |
|
| 3973 |
} catch (Exception e) { |
3892 |
} catch (IllegalArgumentException iae) { |
| 3974 |
e.printStackTrace(); |
3893 |
iae.printStackTrace(); |
| 3975 |
expectedIAExceptionThrown = true; |
3894 |
expectedIAExceptionThrown = true; |
| 3976 |
} finally { |
3895 |
} finally { |
| 3977 |
cleanup(em); |
3896 |
cleanup(em); |
|
Lines 3980-3986
Link Here
|
| 3980 |
} |
3899 |
} |
| 3981 |
} |
3900 |
} |
| 3982 |
|
3901 |
|
| 3983 |
public void testManagedType_Interface_getList_Method() { |
3902 |
public void testManagedType_getList_Method() { |
| 3984 |
if(!this.isJPA10()) { |
3903 |
if(!this.isJPA10()) { |
| 3985 |
EntityManager em = null; |
3904 |
EntityManager em = null; |
| 3986 |
boolean expectedIAExceptionThrown = false; |
3905 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4002-4009
Link Here
|
| 4002 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3921 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 4003 |
assertNotNull(entityHardwareDesigner_); |
3922 |
assertNotNull(entityHardwareDesigner_); |
| 4004 |
|
3923 |
|
| 4005 |
} catch (Exception e) { |
3924 |
} catch (IllegalArgumentException iae) { |
| 4006 |
e.printStackTrace(); |
3925 |
iae.printStackTrace(); |
| 4007 |
expectedIAExceptionThrown = true; |
3926 |
expectedIAExceptionThrown = true; |
| 4008 |
} finally { |
3927 |
} finally { |
| 4009 |
cleanup(em); |
3928 |
cleanup(em); |
|
Lines 4012-4018
Link Here
|
| 4012 |
} |
3931 |
} |
| 4013 |
} |
3932 |
} |
| 4014 |
|
3933 |
|
| 4015 |
public void testManagedType_Interface_getDeclaredList_Method() { |
3934 |
public void testManagedType_getDeclaredList_Method() { |
| 4016 |
if(!this.isJPA10()) { |
3935 |
if(!this.isJPA10()) { |
| 4017 |
EntityManager em = null; |
3936 |
EntityManager em = null; |
| 4018 |
boolean expectedIAExceptionThrown = false; |
3937 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4034-4041
Link Here
|
| 4034 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3953 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 4035 |
assertNotNull(entityHardwareDesigner_); |
3954 |
assertNotNull(entityHardwareDesigner_); |
| 4036 |
|
3955 |
|
| 4037 |
} catch (Exception e) { |
3956 |
} catch (IllegalArgumentException iae) { |
| 4038 |
e.printStackTrace(); |
3957 |
iae.printStackTrace(); |
| 4039 |
expectedIAExceptionThrown = true; |
3958 |
expectedIAExceptionThrown = true; |
| 4040 |
} finally { |
3959 |
} finally { |
| 4041 |
cleanup(em); |
3960 |
cleanup(em); |
|
Lines 4044-4050
Link Here
|
| 4044 |
} |
3963 |
} |
| 4045 |
} |
3964 |
} |
| 4046 |
|
3965 |
|
| 4047 |
public void testManagedType_Interface_getMap_Method() { |
3966 |
public void testManagedType_getMap_Method() { |
| 4048 |
if(!this.isJPA10()) { |
3967 |
if(!this.isJPA10()) { |
| 4049 |
EntityManager em = null; |
3968 |
EntityManager em = null; |
| 4050 |
boolean expectedIAExceptionThrown = false; |
3969 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4066-4073
Link Here
|
| 4066 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
3985 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 4067 |
assertNotNull(entityHardwareDesigner_); |
3986 |
assertNotNull(entityHardwareDesigner_); |
| 4068 |
|
3987 |
|
| 4069 |
} catch (Exception e) { |
3988 |
} catch (IllegalArgumentException iae) { |
| 4070 |
e.printStackTrace(); |
3989 |
iae.printStackTrace(); |
| 4071 |
expectedIAExceptionThrown = true; |
3990 |
expectedIAExceptionThrown = true; |
| 4072 |
} finally { |
3991 |
} finally { |
| 4073 |
cleanup(em); |
3992 |
cleanup(em); |
|
Lines 4076-4082
Link Here
|
| 4076 |
} |
3995 |
} |
| 4077 |
} |
3996 |
} |
| 4078 |
|
3997 |
|
| 4079 |
public void testManagedType_Interface_getDeclaredMap_Method() { |
3998 |
public void testManagedType_getDeclaredMap_Method() { |
| 4080 |
if(!this.isJPA10()) { |
3999 |
if(!this.isJPA10()) { |
| 4081 |
EntityManager em = null; |
4000 |
EntityManager em = null; |
| 4082 |
boolean expectedIAExceptionThrown = false; |
4001 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4098-4105
Link Here
|
| 4098 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
4017 |
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl)metamodel.entity(HardwareDesigner.class); |
| 4099 |
assertNotNull(entityHardwareDesigner_); |
4018 |
assertNotNull(entityHardwareDesigner_); |
| 4100 |
|
4019 |
|
| 4101 |
} catch (Exception e) { |
4020 |
} catch (IllegalArgumentException iae) { |
| 4102 |
e.printStackTrace(); |
4021 |
iae.printStackTrace(); |
| 4103 |
expectedIAExceptionThrown = true; |
4022 |
expectedIAExceptionThrown = true; |
| 4104 |
} finally { |
4023 |
} finally { |
| 4105 |
cleanup(em); |
4024 |
cleanup(em); |
|
Lines 4108-4114
Link Here
|
| 4108 |
} |
4027 |
} |
| 4109 |
} |
4028 |
} |
| 4110 |
|
4029 |
|
| 4111 |
public void testManagedType_Interface_variantCases() { |
4030 |
public void testManagedType_variantCases() { |
| 4112 |
if(!this.isJPA10()) { |
4031 |
if(!this.isJPA10()) { |
| 4113 |
EntityManager em = null; |
4032 |
EntityManager em = null; |
| 4114 |
boolean expectedIAExceptionThrown = false; |
4033 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4210-4217
Link Here
|
| 4210 |
} |
4129 |
} |
| 4211 |
assertTrue(count > 0); |
4130 |
assertTrue(count > 0); |
| 4212 |
|
4131 |
|
| 4213 |
} catch (Exception e) { |
4132 |
} catch (IllegalArgumentException iae) { |
| 4214 |
e.printStackTrace(); |
4133 |
iae.printStackTrace(); |
| 4215 |
expectedIAExceptionThrown = true; |
4134 |
expectedIAExceptionThrown = true; |
| 4216 |
} finally { |
4135 |
} finally { |
| 4217 |
assertFalse("An IAE exception should not occur here.", expectedIAExceptionThrown); |
4136 |
assertFalse("An IAE exception should not occur here.", expectedIAExceptionThrown); |
|
Lines 4222-4229
Link Here
|
| 4222 |
} |
4141 |
} |
| 4223 |
} |
4142 |
} |
| 4224 |
|
4143 |
|
| 4225 |
public void testMapAttribute_Interface_getKeyJavaType_Method() { |
4144 |
/** |
|
|
4145 |
* This test will verify that MapAttribute instance have their elementType set correctly. |
| 4146 |
* The elementType corresponds to the 3rd V parameter on the class definition - which is the Map value. |
| 4147 |
* MapAttributeImpl<X, K, V> |
| 4148 |
*/ |
| 4149 |
public void testMapAtributeElementTypeWhenMapKeySetButNameAttributeIsDefaulted() { |
| 4226 |
if(!this.isJPA10()) { |
4150 |
if(!this.isJPA10()) { |
|
|
4151 |
boolean exceptionThrown = false; |
| 4152 |
EntityManager em = null; |
| 4153 |
try { |
| 4154 |
em = privateTestSetup(); |
| 4155 |
assertNotNull(em); |
| 4156 |
Metamodel metamodel = em.getMetamodel(); |
| 4157 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4158 |
|
| 4159 |
EntityType<Manufacturer> entityManufacturer = metamodel.entity(Manufacturer.class); |
| 4160 |
assertNotNull(entityManufacturer); |
| 4161 |
Attribute hardwareDesignersMap = entityManufacturer.getAttribute("hardwareDesignersMapUC8"); |
| 4162 |
assertNotNull(hardwareDesignersMap); |
| 4163 |
assertTrue(hardwareDesignersMap.isCollection()); |
| 4164 |
assertTrue(hardwareDesignersMap instanceof MapAttributeImpl); |
| 4165 |
MapAttribute<? super Manufacturer, ?, ?> manufactuerHardwareDesignersMap = entityManufacturer.getMap("hardwareDesignersMapUC8"); |
| 4166 |
// Verify owning type |
| 4167 |
assertNotNull(manufactuerHardwareDesignersMap); |
| 4168 |
assertEquals(entityManufacturer, manufactuerHardwareDesignersMap.getDeclaringType()); |
| 4169 |
// Verify Map Key - should be PK of owning type |
| 4170 |
assertEquals(Integer.class, manufactuerHardwareDesignersMap.getKeyJavaType()); |
| 4171 |
// Verify Map Value |
| 4172 |
assertEquals(HardwareDesigner.class, manufactuerHardwareDesignersMap.getElementType().getJavaType()); |
| 4173 |
} catch (IllegalArgumentException iae) { |
| 4174 |
iae.printStackTrace(); |
| 4175 |
exceptionThrown = true; |
| 4176 |
} finally { |
| 4177 |
cleanup(em); |
| 4178 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4179 |
} |
| 4180 |
} |
| 4181 |
} |
| 4182 |
|
| 4183 |
public void testMapAtributeElementTypeWhenMapKeySetAndNameAttributeSet() { |
| 4184 |
if(!this.isJPA10()) { |
| 4227 |
EntityManager em = null; |
4185 |
EntityManager em = null; |
| 4228 |
boolean exceptionThrown = false; |
4186 |
boolean exceptionThrown = false; |
| 4229 |
try { |
4187 |
try { |
|
Lines 4231-4236
Link Here
|
| 4231 |
assertNotNull(em); |
4189 |
assertNotNull(em); |
| 4232 |
Metamodel metamodel = em.getMetamodel(); |
4190 |
Metamodel metamodel = em.getMetamodel(); |
| 4233 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
4191 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
|
|
4192 |
|
| 4193 |
EntityType<Manufacturer> entityManufacturer = metamodel.entity(Manufacturer.class); |
| 4194 |
assertNotNull(entityManufacturer); |
| 4195 |
Attribute hardwareDesignersMap = entityManufacturer.getAttribute("hardwareDesignersMapUC4"); |
| 4196 |
assertNotNull(hardwareDesignersMap); |
| 4197 |
assertTrue(hardwareDesignersMap.isCollection()); |
| 4198 |
assertTrue(hardwareDesignersMap instanceof MapAttributeImpl); |
| 4199 |
MapAttribute<? super Manufacturer, ?, ?> manufactuerHardwareDesignersMap = entityManufacturer.getMap("hardwareDesignersMapUC4"); |
| 4200 |
// Verify owning type |
| 4201 |
assertNotNull(manufactuerHardwareDesignersMap); |
| 4202 |
assertEquals(entityManufacturer, manufactuerHardwareDesignersMap.getDeclaringType()); |
| 4203 |
// Verify Map Key - should not be PK of owning type |
| 4204 |
assertEquals(String.class, manufactuerHardwareDesignersMap.getKeyJavaType()); |
| 4205 |
// Verify Map Value |
| 4206 |
assertEquals(HardwareDesigner.class, manufactuerHardwareDesignersMap.getElementType().getJavaType()); |
| 4207 |
} catch (IllegalArgumentException iae) { |
| 4208 |
iae.printStackTrace(); |
| 4209 |
exceptionThrown = true; |
| 4210 |
} finally { |
| 4211 |
cleanup(em); |
| 4212 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4213 |
} |
| 4214 |
} |
| 4215 |
} |
| 4216 |
|
| 4217 |
public void testMapAttribute_getKeyJavaType_UC0_Method() { |
| 4218 |
if(!this.isJPA10()) { |
| 4219 |
EntityManager em = null; |
| 4220 |
boolean exceptionThrown = false; |
| 4221 |
try { |
| 4222 |
em = privateTestSetup(); |
| 4223 |
assertNotNull(em); |
| 4224 |
Metamodel metamodel = em.getMetamodel(); |
| 4225 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4226 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4227 |
assertNotNull(entityManufacturer_); |
| 4234 |
|
4228 |
|
| 4235 |
// Actual Test Case |
4229 |
// Actual Test Case |
| 4236 |
/** |
4230 |
/** |
|
Lines 4238-4246
Link Here
|
| 4238 |
* @return Java key type |
4232 |
* @return Java key type |
| 4239 |
*/ |
4233 |
*/ |
| 4240 |
//Class<K> getKeyJavaType(); |
4234 |
//Class<K> getKeyJavaType(); |
|
|
4235 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 4236 |
entityManufacturer_.getMap("hardwareDesignersMap"); |
| 4237 |
// verify the default key type is the not the Map key - rather that is is the managedType PK |
| 4238 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 4239 |
//@OneToMany(cascade=ALL, mappedBy="mappedEmployer") |
| 4240 |
//private Map<String, HardwareDesigner> hardwareDesignersMap;// = new HashMap<String, HardwareDesigner>(); |
| 4241 |
// http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_63:_20090824:_Add_Map_support_for_.40MapKey_to_MapAttribute |
| 4242 |
// Key is the primary key (PK) of the target entity - in this case HardwareDesigner which inherits its @Id from the Person @MappedSuperclass as '''Integer'''. |
| 4243 |
Type keyType = anAttribute.getKeyType(); |
| 4244 |
//assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 4245 |
assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 4246 |
assertNotNull(keyType); |
| 4247 |
assertTrue(keyType instanceof Type); |
| 4248 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 4241 |
|
4249 |
|
| 4242 |
} catch (Exception e) { |
4250 |
} catch (IllegalArgumentException iae) { |
| 4243 |
//e.printStackTrace(); |
4251 |
//iae.printStackTrace(); |
| 4244 |
exceptionThrown = true; |
4252 |
exceptionThrown = true; |
| 4245 |
} finally { |
4253 |
} finally { |
| 4246 |
cleanup(em); |
4254 |
cleanup(em); |
|
Lines 4249-4255
Link Here
|
| 4249 |
} |
4257 |
} |
| 4250 |
} |
4258 |
} |
| 4251 |
|
4259 |
|
| 4252 |
public void testMapAttribute_Interface_getKeyType_Method() { |
4260 |
public void testMapAttribute_getKeyJavaType_UC1a_Method() { |
| 4253 |
if(!this.isJPA10()) { |
4261 |
if(!this.isJPA10()) { |
| 4254 |
EntityManager em = null; |
4262 |
EntityManager em = null; |
| 4255 |
boolean exceptionThrown = false; |
4263 |
boolean exceptionThrown = false; |
|
Lines 4258-4274
Link Here
|
| 4258 |
assertNotNull(em); |
4266 |
assertNotNull(em); |
| 4259 |
Metamodel metamodel = em.getMetamodel(); |
4267 |
Metamodel metamodel = em.getMetamodel(); |
| 4260 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
4268 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
|
|
4269 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4270 |
assertNotNull(entityManufacturer_); |
| 4261 |
|
4271 |
|
| 4262 |
// Actual Test Case |
4272 |
// Actual Test Case |
| 4263 |
/** |
4273 |
/** |
|
|
4274 |
* Return the Java type of the map key. |
| 4275 |
* @return Java key type |
| 4276 |
*/ |
| 4277 |
//Class<K> getKeyJavaType(); |
| 4278 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 4279 |
entityManufacturer_.getMap("hardwareDesignersMapUC1a"); |
| 4280 |
// verify the key type is the Map key - not the managedType PK |
| 4281 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 4282 |
// UC 1a: Generics KV set, no @MapKey present, PK is singular field |
| 4283 |
//@OneToMany(cascade=ALL, mappedBy="mappedEmployerUC1a") |
| 4284 |
//private Map<String, HardwareDesigner> hardwareDesignersMapUC1a; |
| 4285 |
Type keyType = anAttribute.getKeyType(); |
| 4286 |
//assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 4287 |
assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 4288 |
assertNotNull(keyType); |
| 4289 |
assertTrue(keyType instanceof Type); |
| 4290 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 4291 |
|
| 4292 |
} catch (IllegalArgumentException iae) { |
| 4293 |
//iae.printStackTrace(); |
| 4294 |
exceptionThrown = true; |
| 4295 |
} finally { |
| 4296 |
cleanup(em); |
| 4297 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4298 |
} |
| 4299 |
} |
| 4300 |
} |
| 4301 |
|
| 4302 |
public void testMapAttribute_getKeyJavaType_UC2_Method() { |
| 4303 |
if(!this.isJPA10()) { |
| 4304 |
EntityManager em = null; |
| 4305 |
boolean exceptionThrown = false; |
| 4306 |
try { |
| 4307 |
em = privateTestSetup(); |
| 4308 |
assertNotNull(em); |
| 4309 |
Metamodel metamodel = em.getMetamodel(); |
| 4310 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4311 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4312 |
assertNotNull(entityManufacturer_); |
| 4313 |
|
| 4314 |
// Actual Test Case |
| 4315 |
/** |
| 4316 |
* Return the Java type of the map key. |
| 4317 |
* @return Java key type |
| 4318 |
*/ |
| 4319 |
//Class<K> getKeyJavaType(); |
| 4320 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 4321 |
entityManufacturer_.getMap("hardwareDesignersMapUC2"); |
| 4322 |
// verify the key type is the Map key - not the managedType PK |
| 4323 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 4324 |
// UC 2: Generics KV set, @MapKey is present |
| 4325 |
//@OneToMany(cascade=ALL, mappedBy="mappedEmployerUC2") |
| 4326 |
//@MapKey(name="name") |
| 4327 |
//private Map<String, HardwareDesigner> hardwareDesignersMapUC2; |
| 4328 |
Type keyType = anAttribute.getKeyType(); |
| 4329 |
assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 4330 |
//assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 4331 |
assertNotNull(keyType); |
| 4332 |
assertTrue(keyType instanceof Type); |
| 4333 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 4334 |
|
| 4335 |
} catch (IllegalArgumentException iae) { |
| 4336 |
//iae.printStackTrace(); |
| 4337 |
exceptionThrown = true; |
| 4338 |
} finally { |
| 4339 |
cleanup(em); |
| 4340 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4341 |
} |
| 4342 |
} |
| 4343 |
} |
| 4344 |
|
| 4345 |
public void testMapAttribute_getKeyJavaType_UC4_Method() { |
| 4346 |
if(!this.isJPA10()) { |
| 4347 |
EntityManager em = null; |
| 4348 |
boolean exceptionThrown = false; |
| 4349 |
try { |
| 4350 |
em = privateTestSetup(); |
| 4351 |
assertNotNull(em); |
| 4352 |
Metamodel metamodel = em.getMetamodel(); |
| 4353 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4354 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4355 |
assertNotNull(entityManufacturer_); |
| 4356 |
|
| 4357 |
// Actual Test Case |
| 4358 |
/** |
| 4359 |
* Return the Java type of the map key. |
| 4360 |
* @return Java key type |
| 4361 |
*/ |
| 4362 |
//Class<K> getKeyJavaType(); |
| 4363 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 4364 |
entityManufacturer_.getMap("hardwareDesignersMapUC4"); |
| 4365 |
// verify the key type is the Map key - not the managedType PK |
| 4366 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 4367 |
// UC 4: No Generics KV set, @MapKey is present |
| 4368 |
//@OneToMany(targetEntity=HardwareDesigner.class, cascade=ALL, mappedBy="mappedEmployerUC4") |
| 4369 |
//@MapKey(name="name") |
| 4370 |
//private Map hardwareDesignersMapUC4; |
| 4371 |
Type keyType = anAttribute.getKeyType(); |
| 4372 |
assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 4373 |
//assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 4374 |
assertNotNull(keyType); |
| 4375 |
assertTrue(keyType instanceof Type); |
| 4376 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 4377 |
|
| 4378 |
} catch (IllegalArgumentException iae) { |
| 4379 |
//iae.printStackTrace(); |
| 4380 |
exceptionThrown = true; |
| 4381 |
} finally { |
| 4382 |
cleanup(em); |
| 4383 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4384 |
} |
| 4385 |
} |
| 4386 |
} |
| 4387 |
|
| 4388 |
public void testMapAttribute_getKeyJavaType_UC7_Method() { |
| 4389 |
if(!this.isJPA10()) { |
| 4390 |
EntityManager em = null; |
| 4391 |
boolean exceptionThrown = false; |
| 4392 |
try { |
| 4393 |
em = privateTestSetup(); |
| 4394 |
assertNotNull(em); |
| 4395 |
Metamodel metamodel = em.getMetamodel(); |
| 4396 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4397 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4398 |
assertNotNull(entityManufacturer_); |
| 4399 |
|
| 4400 |
// Actual Test Case |
| 4401 |
/** |
| 4402 |
* Return the Java type of the map key. |
| 4403 |
* @return Java key type |
| 4404 |
*/ |
| 4405 |
//Class<K> getKeyJavaType(); |
| 4406 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 4407 |
entityManufacturer_.getMap("hardwareDesignersMapUC7"); |
| 4408 |
// verify the key type is the Map key - not the managedType PK |
| 4409 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 4410 |
// UC 7: Generics KV set, targetEntity is also set, @MapKey is *(set/unset) |
| 4411 |
//@OneToMany(targetEntity=HardwareDesigner.class, cascade=ALL, mappedBy="mappedEmployerUC7") |
| 4412 |
// Same as UC1a - that is missing the @MapKey |
| 4413 |
//private Map<String, HardwareDesigner> hardwareDesignersMapUC7; |
| 4414 |
Type keyType = anAttribute.getKeyType(); |
| 4415 |
//assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 4416 |
assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 4417 |
assertNotNull(keyType); |
| 4418 |
assertTrue(keyType instanceof Type); |
| 4419 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 4420 |
|
| 4421 |
} catch (IllegalArgumentException iae) { |
| 4422 |
//iae.printStackTrace(); |
| 4423 |
exceptionThrown = true; |
| 4424 |
} finally { |
| 4425 |
cleanup(em); |
| 4426 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4427 |
} |
| 4428 |
} |
| 4429 |
} |
| 4430 |
|
| 4431 |
public void testMapAttribute_getKeyJavaType_UC8_Method() { |
| 4432 |
if(!this.isJPA10()) { |
| 4433 |
EntityManager em = null; |
| 4434 |
boolean exceptionThrown = false; |
| 4435 |
try { |
| 4436 |
em = privateTestSetup(); |
| 4437 |
assertNotNull(em); |
| 4438 |
Metamodel metamodel = em.getMetamodel(); |
| 4439 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4440 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4441 |
assertNotNull(entityManufacturer_); |
| 4442 |
|
| 4443 |
// Actual Test Case |
| 4444 |
/** |
| 4445 |
* Return the Java type of the map key. |
| 4446 |
* @return Java key type |
| 4447 |
*/ |
| 4448 |
//Class<K> getKeyJavaType(); |
| 4449 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 4450 |
entityManufacturer_.getMap("hardwareDesignersMapUC8"); |
| 4451 |
// verify the key type is the Map key - not the managedType PK |
| 4452 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 4453 |
// UC 8: Generics KV set, targetEntity not set, @MapKey is set but name attribute is defaulted |
| 4454 |
//@OneToMany(targetEntity=HardwareDesigner.class, cascade=ALL, mappedBy="mappedEmployerUC8") |
| 4455 |
// Same as UC1a - that is missing the @MapKey name attribute |
| 4456 |
//private Map<String, HardwareDesigner> hardwareDesignersMapUC8; |
| 4457 |
Type keyType = anAttribute.getKeyType(); |
| 4458 |
//assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 4459 |
assertEquals(Integer.class, keyJavaType); // When @MapKey is not present or missing name attribute - we default to the PK |
| 4460 |
assertNotNull(keyType); |
| 4461 |
assertTrue(keyType instanceof Type); |
| 4462 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 4463 |
|
| 4464 |
} catch (IllegalArgumentException iae) { |
| 4465 |
//iae.printStackTrace(); |
| 4466 |
exceptionThrown = true; |
| 4467 |
} finally { |
| 4468 |
cleanup(em); |
| 4469 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4470 |
} |
| 4471 |
} |
| 4472 |
} |
| 4473 |
|
| 4474 |
// See |
| 4475 |
// http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_86:_20090921:_Handle_Embeddable_Type_keyType_in_MapAttributeImpl_constructor |
| 4476 |
public void testMapAttribute_getKeyJavaType_UC9_DI86_Embeddable_IdClass_keyType_Method() { |
| 4477 |
if(!this.isJPA10()) { |
| 4478 |
EntityManager em = null; |
| 4479 |
boolean exceptionThrown = false; |
| 4480 |
try { |
| 4481 |
em = privateTestSetup(); |
| 4482 |
assertNotNull(em); |
| 4483 |
Metamodel metamodel = em.getMetamodel(); |
| 4484 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4485 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4486 |
assertNotNull(entityManufacturer_); |
| 4487 |
|
| 4488 |
// Actual Test Case |
| 4489 |
/** |
| 4490 |
* Return the Java type of the map key. |
| 4491 |
* @return Java key type |
| 4492 |
*/ |
| 4493 |
//Class<K> getKeyJavaType(); |
| 4494 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 4495 |
entityManufacturer_.getMap("enclosureByBoardMapUC9"); |
| 4496 |
// verify the key type is the Map key - not the managedType PK |
| 4497 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 4498 |
// UC9: no targetEntity, no MapKey, but generics are set (MapKey has an IdClass with an Embeddable) |
| 4499 |
//@OneToMany(cascade=CascadeType.ALL, mappedBy="mappedManufacturerUC9") |
| 4500 |
//private Map<Board, Enclosure> enclosureByBoardMapUC9; |
| 4501 |
Type keyType = anAttribute.getKeyType(); |
| 4502 |
assertEquals(Board.class, keyJavaType); // When @MapKey(name="name") is present or we use generics |
| 4503 |
//assertEquals(Integer.class, keyJavaType); // When @MapKey is not present or missing name attribute - we default to the PK |
| 4504 |
assertNotNull(keyType); |
| 4505 |
assertTrue(keyType instanceof Type); |
| 4506 |
assertEquals(Type.PersistenceType.ENTITY, keyType.getPersistenceType()); |
| 4507 |
|
| 4508 |
} catch (IllegalArgumentException iae) { |
| 4509 |
//iae.printStackTrace(); |
| 4510 |
exceptionThrown = true; |
| 4511 |
} finally { |
| 4512 |
cleanup(em); |
| 4513 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4514 |
} |
| 4515 |
} |
| 4516 |
} |
| 4517 |
|
| 4518 |
public void testMapAttribute_getKeyType_UC0_Method() { |
| 4519 |
if(!this.isJPA10()) { |
| 4520 |
EntityManager em = null; |
| 4521 |
boolean exceptionThrown = false; |
| 4522 |
try { |
| 4523 |
em = privateTestSetup(); |
| 4524 |
assertNotNull(em); |
| 4525 |
Metamodel metamodel = em.getMetamodel(); |
| 4526 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4527 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4528 |
assertNotNull(entityManufacturer_); |
| 4529 |
|
| 4530 |
// Actual Test Case |
| 4531 |
/** |
| 4264 |
* Return the type representing the key type of the map. |
4532 |
* Return the type representing the key type of the map. |
| 4265 |
* @return type representing key type |
4533 |
* @return type representing key type |
| 4266 |
*/ |
4534 |
*/ |
| 4267 |
//Type<K> getKeyType(); |
4535 |
//Type<K> getKeyType(); |
|
|
4536 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 4537 |
entityManufacturer_.getMap("hardwareDesignersMap"); |
| 4538 |
// verify the default key type is the not the Map key - rather that is is the managedType PK |
| 4539 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 4540 |
//@OneToMany(cascade=ALL, mappedBy="mappedEmployer") |
| 4541 |
//private Map<String, HardwareDesigner> hardwareDesignersMap;// = new HashMap<String, HardwareDesigner>(); |
| 4542 |
// http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_63:_20090824:_Add_Map_support_for_.40MapKey_to_MapAttribute |
| 4543 |
// Key is the primary key (PK) of the target entity - in this case HardwareDesigner which inherits its @Id from the Person @MappedSuperclass as '''Integer'''. |
| 4544 |
Type keyType = anAttribute.getKeyType(); |
| 4545 |
//assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 4546 |
assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 4547 |
assertNotNull(keyType); |
| 4548 |
assertTrue(keyType instanceof Type); |
| 4549 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 4268 |
|
4550 |
|
| 4269 |
|
4551 |
|
| 4270 |
} catch (Exception e) { |
4552 |
} catch (IllegalArgumentException iae) { |
| 4271 |
//e.printStackTrace(); |
4553 |
//iae.printStackTrace(); |
| 4272 |
exceptionThrown = true; |
4554 |
exceptionThrown = true; |
| 4273 |
} finally { |
4555 |
} finally { |
| 4274 |
cleanup(em); |
4556 |
cleanup(em); |
|
Lines 4276-4283
Link Here
|
| 4276 |
} |
4558 |
} |
| 4277 |
} |
4559 |
} |
| 4278 |
} |
4560 |
} |
|
|
4561 |
|
| 4562 |
public void testMapAttribute_getKeyType_UC1a_Method() { |
| 4563 |
if(!this.isJPA10()) { |
| 4564 |
EntityManager em = null; |
| 4565 |
boolean exceptionThrown = false; |
| 4566 |
try { |
| 4567 |
em = privateTestSetup(); |
| 4568 |
assertNotNull(em); |
| 4569 |
Metamodel metamodel = em.getMetamodel(); |
| 4570 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4571 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4572 |
assertNotNull(entityManufacturer_); |
| 4573 |
|
| 4574 |
// Actual Test Case |
| 4575 |
/** |
| 4576 |
* Return the type representing the key type of the map. |
| 4577 |
* @return type representing key type |
| 4578 |
*/ |
| 4579 |
//Type<K> getKeyType(); |
| 4580 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 4581 |
entityManufacturer_.getMap("hardwareDesignersMapUC1a"); |
| 4582 |
// verify the key type is the Map key - not the managedType PK |
| 4583 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 4584 |
// UC 1a: Generics KV set, no @MapKey present, PK is singular field |
| 4585 |
//@OneToMany(cascade=ALL, mappedBy="mappedEmployerUC1a") |
| 4586 |
//private Map<String, HardwareDesigner> hardwareDesignersMapUC1a; |
| 4587 |
Type keyType = anAttribute.getKeyType(); |
| 4588 |
//assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 4589 |
assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 4590 |
assertNotNull(keyType); |
| 4591 |
assertTrue(keyType instanceof Type); |
| 4592 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 4593 |
} catch (IllegalArgumentException iae) { |
| 4594 |
//iae.printStackTrace(); |
| 4595 |
exceptionThrown = true; |
| 4596 |
} finally { |
| 4597 |
cleanup(em); |
| 4598 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4599 |
} |
| 4600 |
} |
| 4601 |
} |
| 4279 |
|
4602 |
|
| 4280 |
public void testMappedSuperclassType_Interface() { |
4603 |
public void testMapAttribute_getKeyType_UC2_Method() { |
| 4281 |
if(!this.isJPA10()) { |
4604 |
if(!this.isJPA10()) { |
| 4282 |
EntityManager em = null; |
4605 |
EntityManager em = null; |
| 4283 |
boolean exceptionThrown = false; |
4606 |
boolean exceptionThrown = false; |
|
Lines 4286-4297
Link Here
|
| 4286 |
assertNotNull(em); |
4609 |
assertNotNull(em); |
| 4287 |
Metamodel metamodel = em.getMetamodel(); |
4610 |
Metamodel metamodel = em.getMetamodel(); |
| 4288 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
4611 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
|
|
4612 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4613 |
assertNotNull(entityManufacturer_); |
| 4289 |
|
4614 |
|
| 4290 |
// Actual Test Case |
4615 |
// Actual Test Case |
|
|
4616 |
/** |
| 4617 |
* Return the type representing the key type of the map. |
| 4618 |
* @return type representing key type |
| 4619 |
*/ |
| 4620 |
//Type<K> getKeyType(); |
| 4621 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 4622 |
entityManufacturer_.getMap("hardwareDesignersMapUC2"); |
| 4623 |
// verify the key type is the Map key - not the managedType PK |
| 4624 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 4625 |
// UC 2: Generics KV set, @MapKey is present |
| 4626 |
//@OneToMany(cascade=ALL, mappedBy="mappedEmployerUC2") |
| 4627 |
//@MapKey(name="name") |
| 4628 |
//private Map<String, HardwareDesigner> hardwareDesignersMapUC2; |
| 4629 |
Type keyType = anAttribute.getKeyType(); |
| 4630 |
assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 4631 |
//assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 4632 |
assertNotNull(keyType); |
| 4633 |
assertTrue(keyType instanceof Type); |
| 4634 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 4635 |
} catch (IllegalArgumentException iae) { |
| 4636 |
//iae.printStackTrace(); |
| 4637 |
exceptionThrown = true; |
| 4638 |
} finally { |
| 4639 |
cleanup(em); |
| 4640 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4641 |
} |
| 4642 |
} |
| 4643 |
} |
| 4644 |
|
| 4645 |
public void testMapAttribute_getKeyType_UC4_Method() { |
| 4646 |
if(!this.isJPA10()) { |
| 4647 |
EntityManager em = null; |
| 4648 |
boolean exceptionThrown = false; |
| 4649 |
try { |
| 4650 |
em = privateTestSetup(); |
| 4651 |
assertNotNull(em); |
| 4652 |
Metamodel metamodel = em.getMetamodel(); |
| 4653 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4654 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4655 |
assertNotNull(entityManufacturer_); |
| 4656 |
|
| 4657 |
// Actual Test Case |
| 4658 |
/** |
| 4659 |
* Return the type representing the key type of the map. |
| 4660 |
* @return type representing key type |
| 4661 |
*/ |
| 4662 |
//Type<K> getKeyType(); |
| 4663 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 4664 |
entityManufacturer_.getMap("hardwareDesignersMapUC4"); |
| 4665 |
// verify the key type is the Map key - not the managedType PK |
| 4666 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 4667 |
// UC 4: No Generics KV set, @MapKey is present |
| 4668 |
//@OneToMany(targetEntity=HardwareDesigner.class, cascade=ALL, mappedBy="mappedEmployerUC4") |
| 4669 |
//@MapKey(name="name") |
| 4670 |
//private Map hardwareDesignersMapUC4; |
| 4671 |
Type keyType = anAttribute.getKeyType(); |
| 4672 |
assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 4673 |
//assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 4674 |
assertNotNull(keyType); |
| 4675 |
assertTrue(keyType instanceof Type); |
| 4676 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 4677 |
|
| 4678 |
|
| 4679 |
} catch (IllegalArgumentException iae) { |
| 4680 |
//iae.printStackTrace(); |
| 4681 |
exceptionThrown = true; |
| 4682 |
} finally { |
| 4683 |
cleanup(em); |
| 4684 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4685 |
} |
| 4686 |
} |
| 4687 |
} |
| 4688 |
|
| 4689 |
public void testMapAttribute_getKeyType_UC7_Method() { |
| 4690 |
if(!this.isJPA10()) { |
| 4691 |
EntityManager em = null; |
| 4692 |
boolean exceptionThrown = false; |
| 4693 |
try { |
| 4694 |
em = privateTestSetup(); |
| 4695 |
assertNotNull(em); |
| 4696 |
Metamodel metamodel = em.getMetamodel(); |
| 4697 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4698 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4699 |
assertNotNull(entityManufacturer_); |
| 4700 |
|
| 4701 |
// Actual Test Case |
| 4702 |
/** |
| 4703 |
* Return the type representing the key type of the map. |
| 4704 |
* @return type representing key type |
| 4705 |
*/ |
| 4706 |
//Type<K> getKeyType(); |
| 4707 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 4708 |
entityManufacturer_.getMap("hardwareDesignersMapUC7"); |
| 4709 |
// verify the key type is the Map key - not the managedType PK |
| 4710 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 4711 |
// UC 7: Generics KV set, targetEntity is also set, @MapKey is *(set/unset) |
| 4712 |
//@OneToMany(targetEntity=HardwareDesigner.class, cascade=ALL, mappedBy="mappedEmployerUC7") |
| 4713 |
// Same as UC1a - that is missing the @MapKey |
| 4714 |
//private Map<String, HardwareDesigner> hardwareDesignersMapUC7; |
| 4715 |
Type keyType = anAttribute.getKeyType(); |
| 4716 |
//assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 4717 |
assertEquals(Integer.class, keyJavaType); // When @MapKey is not present - we default to the PK |
| 4718 |
assertNotNull(keyType); |
| 4719 |
assertTrue(keyType instanceof Type); |
| 4720 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 4721 |
|
| 4722 |
|
| 4723 |
} catch (IllegalArgumentException iae) { |
| 4724 |
//iae.printStackTrace(); |
| 4725 |
exceptionThrown = true; |
| 4726 |
} finally { |
| 4727 |
cleanup(em); |
| 4728 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4729 |
} |
| 4730 |
} |
| 4731 |
} |
| 4732 |
|
| 4733 |
public void testMapAttribute_getKeyType_UC8_Method() { |
| 4734 |
if(!this.isJPA10()) { |
| 4735 |
EntityManager em = null; |
| 4736 |
boolean exceptionThrown = false; |
| 4737 |
try { |
| 4738 |
em = privateTestSetup(); |
| 4739 |
assertNotNull(em); |
| 4740 |
Metamodel metamodel = em.getMetamodel(); |
| 4741 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4742 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4743 |
assertNotNull(entityManufacturer_); |
| 4744 |
|
| 4745 |
// Actual Test Case |
| 4746 |
/** |
| 4747 |
* Return the type representing the key type of the map. |
| 4748 |
* @return type representing key type |
| 4749 |
*/ |
| 4750 |
//Type<K> getKeyType(); |
| 4751 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 4752 |
entityManufacturer_.getMap("hardwareDesignersMapUC8"); |
| 4753 |
// verify the key type is the Map key - not the managedType PK |
| 4754 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 4755 |
// UC 8: Generics KV set, targetEntity not set, @MapKey is set but name attribute is defaulted |
| 4756 |
//@OneToMany(targetEntity=HardwareDesigner.class, cascade=ALL, mappedBy="mappedEmployerUC8") |
| 4757 |
// Same as UC1a - that is missing the @MapKey name attribute |
| 4758 |
//private Map<String, HardwareDesigner> hardwareDesignersMapUC8; |
| 4759 |
Type keyType = anAttribute.getKeyType(); |
| 4760 |
//assertEquals(String.class, keyJavaType); // When @MapKey(name="name") is present |
| 4761 |
assertEquals(Integer.class, keyJavaType); // When @MapKey is not present or missing name attribute - we default to the PK |
| 4762 |
assertNotNull(keyType); |
| 4763 |
assertTrue(keyType instanceof Type); |
| 4764 |
assertEquals(Type.PersistenceType.BASIC, keyType.getPersistenceType()); |
| 4765 |
|
| 4766 |
|
| 4767 |
} catch (IllegalArgumentException iae) { |
| 4768 |
//iae.printStackTrace(); |
| 4769 |
exceptionThrown = true; |
| 4770 |
} finally { |
| 4771 |
cleanup(em); |
| 4772 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4773 |
} |
| 4774 |
} |
| 4775 |
} |
| 4776 |
|
| 4777 |
// see |
| 4778 |
// http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_86:_20090921:_Handle_Embeddable_Type_keyType_in_MapAttributeImpl_constructor |
| 4779 |
public void testMapAttribute_getKeyType_UC9_DI86_Embeddable_IdClass_keyType_Method() { |
| 4780 |
if(!this.isJPA10()) { |
| 4781 |
EntityManager em = null; |
| 4782 |
boolean exceptionThrown = false; |
| 4783 |
try { |
| 4784 |
em = privateTestSetup(); |
| 4785 |
assertNotNull(em); |
| 4786 |
Metamodel metamodel = em.getMetamodel(); |
| 4787 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4788 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4789 |
assertNotNull(entityManufacturer_); |
| 4790 |
|
| 4791 |
// Actual Test Case |
| 4792 |
/** |
| 4793 |
* Return the type representing the key type of the map. |
| 4794 |
* @return type representing key type |
| 4795 |
*/ |
| 4796 |
//Type<K> getKeyType(); |
| 4797 |
MapAttribute<? super Manufacturer, ?, ?> anAttribute = |
| 4798 |
entityManufacturer_.getMap("enclosureByBoardMapUC9"); |
| 4799 |
// verify the key type is the Map key - not the managedType PK |
| 4800 |
Class keyJavaType = anAttribute.getKeyJavaType(); |
| 4801 |
// UC9: no targetEntity, no MapKey, but generics are set (MapKey has an IdClass with an Embeddable) |
| 4802 |
//@OneToMany(cascade=CascadeType.ALL, mappedBy="mappedManufacturerUC9") |
| 4803 |
//private Map<Board, Enclosure> enclosureByBoardMapUC9; |
| 4804 |
Type keyType = anAttribute.getKeyType(); |
| 4805 |
assertEquals(Board.class, keyJavaType); // When @MapKey(name="name") is present or we use generics |
| 4806 |
//assertEquals(Integer.class, keyJavaType); // When @MapKey is not present or missing name attribute - we default to the PK |
| 4807 |
assertNotNull(keyType); |
| 4808 |
assertTrue(keyType instanceof Type); |
| 4809 |
assertEquals(Type.PersistenceType.ENTITY, keyType.getPersistenceType()); |
| 4810 |
} catch (IllegalArgumentException iae) { |
| 4811 |
//iae.printStackTrace(); |
| 4812 |
exceptionThrown = true; |
| 4813 |
} finally { |
| 4814 |
cleanup(em); |
| 4815 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4816 |
} |
| 4817 |
} |
| 4818 |
} |
| 4819 |
|
| 4820 |
public void testMapAttribute_getKeyType_UC9_Method() { |
| 4821 |
if(!this.isJPA10()) { |
| 4822 |
EntityManager em = null; |
| 4823 |
boolean exceptionThrown = false; |
| 4824 |
try { |
| 4825 |
em = privateTestSetup(); |
| 4826 |
assertNotNull(em); |
| 4827 |
Metamodel metamodel = em.getMetamodel(); |
| 4828 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4829 |
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); |
| 4830 |
assertNotNull(entityManufacturer_); |
| 4831 |
|
| 4832 |
// Actual Test Case |
| 4833 |
/** |
| 4834 |
* Return the type representing the key type of the map. |
| 4835 |
* @return type representing key type |
| 4836 |
*/ |
| 4837 |
//Type<K> getKeyType(); |
| 4838 |
|
| 4839 |
|
| 4840 |
} catch (IllegalArgumentException iae) { |
| 4841 |
//iae.printStackTrace(); |
| 4842 |
exceptionThrown = true; |
| 4843 |
} finally { |
| 4844 |
cleanup(em); |
| 4845 |
assertFalse("An IAE exception should not occur here.", exceptionThrown); |
| 4846 |
} |
| 4847 |
} |
| 4848 |
} |
| 4849 |
|
| 4850 |
public void testMappedSuperclassType() { |
| 4851 |
if(!this.isJPA10()) { |
| 4852 |
EntityManager em = null; |
| 4853 |
boolean exceptionThrown = false; |
| 4854 |
try { |
| 4855 |
em = privateTestSetup(); |
| 4856 |
assertNotNull(em); |
| 4857 |
Metamodel metamodel = em.getMetamodel(); |
| 4858 |
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel); |
| 4859 |
|
| 4860 |
// Actual Test Case |
| 4291 |
// Interface is empty - however we will test native functionality |
4861 |
// Interface is empty - however we will test native functionality |
| 4292 |
|
4862 |
|
| 4293 |
} catch (Exception e) { |
4863 |
} catch (IllegalArgumentException iae) { |
| 4294 |
//e.printStackTrace(); |
4864 |
//iae.printStackTrace(); |
| 4295 |
exceptionThrown = true; |
4865 |
exceptionThrown = true; |
| 4296 |
} finally { |
4866 |
} finally { |
| 4297 |
cleanup(em); |
4867 |
cleanup(em); |
|
Lines 4300-4306
Link Here
|
| 4300 |
} |
4870 |
} |
| 4301 |
} |
4871 |
} |
| 4302 |
|
4872 |
|
| 4303 |
public void testMetamodel_Interface_managedType_Method() { |
4873 |
public void testMetamodel_managedType_Method() { |
| 4304 |
if(!this.isJPA10()) { |
4874 |
if(!this.isJPA10()) { |
| 4305 |
EntityManager em = null; |
4875 |
EntityManager em = null; |
| 4306 |
boolean expectedIAExceptionThrown = false; |
4876 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4435-4442
Link Here
|
| 4435 |
//name=Attribute[org.eclipse.persistence.mappings.DirectToFieldMapping[name-->CMP3_MM_MANUF.NAME]], |
5005 |
//name=Attribute[org.eclipse.persistence.mappings.DirectToFieldMapping[name-->CMP3_MM_MANUF.NAME]], |
| 4436 |
//id=Attribute[org.eclipse.persistence.mappings.DirectToFieldMapping[id-->CMP3_MM_MANUF.PERSON_ID]] |
5006 |
//id=Attribute[org.eclipse.persistence.mappings.DirectToFieldMapping[id-->CMP3_MM_MANUF.PERSON_ID]] |
| 4437 |
|
5007 |
|
| 4438 |
} catch (Exception e) { |
5008 |
} catch (IllegalArgumentException iae) { |
| 4439 |
//e.printStackTrace(); |
5009 |
//iae.printStackTrace(); |
| 4440 |
expectedIAExceptionThrown = true; |
5010 |
expectedIAExceptionThrown = true; |
| 4441 |
} finally { |
5011 |
} finally { |
| 4442 |
cleanup(em); |
5012 |
cleanup(em); |
|
Lines 4445-4451
Link Here
|
| 4445 |
} |
5015 |
} |
| 4446 |
} |
5016 |
} |
| 4447 |
|
5017 |
|
| 4448 |
public void testMetamodel_Interface_getEmbeddables_Method() { |
5018 |
public void testMetamodel_getEmbeddables_Method() { |
| 4449 |
if(!this.isJPA10()) { |
5019 |
if(!this.isJPA10()) { |
| 4450 |
EntityManager em = null; |
5020 |
EntityManager em = null; |
| 4451 |
boolean expectedIAExceptionThrown = false; |
5021 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4463-4470
Link Here
|
| 4463 |
* @return the metamodel embeddable types |
5033 |
* @return the metamodel embeddable types |
| 4464 |
*/ |
5034 |
*/ |
| 4465 |
//java.util.Set<EmbeddableType<?>> getEmbeddables(); |
5035 |
//java.util.Set<EmbeddableType<?>> getEmbeddables(); |
| 4466 |
} catch (Exception e) { |
5036 |
} catch (IllegalArgumentException iae) { |
| 4467 |
//e.printStackTrace(); |
5037 |
//iae.printStackTrace(); |
| 4468 |
expectedIAExceptionThrown = true; |
5038 |
expectedIAExceptionThrown = true; |
| 4469 |
} finally { |
5039 |
} finally { |
| 4470 |
cleanup(em); |
5040 |
cleanup(em); |
|
Lines 4473-4479
Link Here
|
| 4473 |
} |
5043 |
} |
| 4474 |
} |
5044 |
} |
| 4475 |
|
5045 |
|
| 4476 |
public void testMetamodel_Interface_getEntities_Method() { |
5046 |
public void testMetamodel_getEntities_Method() { |
| 4477 |
if(!this.isJPA10()) { |
5047 |
if(!this.isJPA10()) { |
| 4478 |
EntityManager em = null; |
5048 |
EntityManager em = null; |
| 4479 |
boolean expectedIAExceptionThrown = false; |
5049 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4493-4500
Link Here
|
| 4493 |
//java.util.Set<EntityType<?>> getEntities(); |
5063 |
//java.util.Set<EntityType<?>> getEntities(); |
| 4494 |
|
5064 |
|
| 4495 |
|
5065 |
|
| 4496 |
} catch (Exception e) { |
5066 |
} catch (IllegalArgumentException iae) { |
| 4497 |
//e.printStackTrace(); |
5067 |
//iae.printStackTrace(); |
| 4498 |
expectedIAExceptionThrown = true; |
5068 |
expectedIAExceptionThrown = true; |
| 4499 |
} finally { |
5069 |
} finally { |
| 4500 |
cleanup(em); |
5070 |
cleanup(em); |
|
Lines 4503-4509
Link Here
|
| 4503 |
} |
5073 |
} |
| 4504 |
} |
5074 |
} |
| 4505 |
|
5075 |
|
| 4506 |
public void testMetamodel_Interface_getManagedTypes_Method() { |
5076 |
public void testMetamodel_getManagedTypes_Method() { |
| 4507 |
if(!this.isJPA10()) { |
5077 |
if(!this.isJPA10()) { |
| 4508 |
EntityManager em = null; |
5078 |
EntityManager em = null; |
| 4509 |
boolean expectedIAExceptionThrown = false; |
5079 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4523-4530
Link Here
|
| 4523 |
*/ |
5093 |
*/ |
| 4524 |
//java.util.Set<ManagedType<?>> getManagedTypes(); |
5094 |
//java.util.Set<ManagedType<?>> getManagedTypes(); |
| 4525 |
|
5095 |
|
| 4526 |
} catch (Exception e) { |
5096 |
} catch (IllegalArgumentException iae) { |
| 4527 |
//e.printStackTrace(); |
5097 |
//iae.printStackTrace(); |
| 4528 |
expectedIAExceptionThrown = true; |
5098 |
expectedIAExceptionThrown = true; |
| 4529 |
} finally { |
5099 |
} finally { |
| 4530 |
cleanup(em); |
5100 |
cleanup(em); |
|
Lines 4533-4539
Link Here
|
| 4533 |
} |
5103 |
} |
| 4534 |
} |
5104 |
} |
| 4535 |
|
5105 |
|
| 4536 |
public void testMetamodel_Interface_embeddable_Method() { |
5106 |
public void testMetamodel_embeddable_Method() { |
| 4537 |
if(!this.isJPA10()) { |
5107 |
if(!this.isJPA10()) { |
| 4538 |
EntityManager em = null; |
5108 |
EntityManager em = null; |
| 4539 |
boolean expectedIAExceptionThrown = false; |
5109 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4595-4602
Link Here
|
| 4595 |
assertTrue("Expected thrown IllegalArgumentException", expectedIAExceptionThrown); |
5165 |
assertTrue("Expected thrown IllegalArgumentException", expectedIAExceptionThrown); |
| 4596 |
// reset state |
5166 |
// reset state |
| 4597 |
expectedIAExceptionThrown = false; |
5167 |
expectedIAExceptionThrown = false; |
| 4598 |
} catch (Exception e) { |
5168 |
} catch (IllegalArgumentException iae) { |
| 4599 |
//e.printStackTrace(); |
5169 |
//iae.printStackTrace(); |
| 4600 |
expectedIAExceptionThrown = true; |
5170 |
expectedIAExceptionThrown = true; |
| 4601 |
} finally { |
5171 |
} finally { |
| 4602 |
cleanup(em); |
5172 |
cleanup(em); |
|
Lines 4606-4612
Link Here
|
| 4606 |
} |
5176 |
} |
| 4607 |
|
5177 |
|
| 4608 |
|
5178 |
|
| 4609 |
public void testMetamodel_Interface_entity_Method() { |
5179 |
public void testMetamodel_entity_Method() { |
| 4610 |
if(!this.isJPA10()) { |
5180 |
if(!this.isJPA10()) { |
| 4611 |
EntityManager em = null; |
5181 |
EntityManager em = null; |
| 4612 |
boolean expectedIAExceptionThrown = false; |
5182 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4657-4664
Link Here
|
| 4657 |
assertTrue("Expected thrown IllegalArgumentException", expectedIAExceptionThrown); |
5227 |
assertTrue("Expected thrown IllegalArgumentException", expectedIAExceptionThrown); |
| 4658 |
// reset exception flag |
5228 |
// reset exception flag |
| 4659 |
expectedIAExceptionThrown = false; |
5229 |
expectedIAExceptionThrown = false; |
| 4660 |
} catch (Exception e) { |
5230 |
} catch (IllegalArgumentException iae) { |
| 4661 |
//e.printStackTrace(); |
5231 |
//iae.printStackTrace(); |
| 4662 |
expectedIAExceptionThrown = true; |
5232 |
expectedIAExceptionThrown = true; |
| 4663 |
} finally { |
5233 |
} finally { |
| 4664 |
cleanup(em); |
5234 |
cleanup(em); |
|
Lines 4667-4673
Link Here
|
| 4667 |
} |
5237 |
} |
| 4668 |
} |
5238 |
} |
| 4669 |
|
5239 |
|
| 4670 |
public void testPluralAttribute_Interface_CollectionType_enum() { |
5240 |
public void testPluralAttribute_CollectionType_enum() { |
| 4671 |
if(!this.isJPA10()) { |
5241 |
if(!this.isJPA10()) { |
| 4672 |
EntityManager em = null; |
5242 |
EntityManager em = null; |
| 4673 |
boolean exceptionThrown = false; |
5243 |
boolean exceptionThrown = false; |
|
Lines 4679-4686
Link Here
|
| 4679 |
|
5249 |
|
| 4680 |
// Actual Test Case |
5250 |
// Actual Test Case |
| 4681 |
//public static enum CollectionType {COLLECTION, SET, LIST, MAP} |
5251 |
//public static enum CollectionType {COLLECTION, SET, LIST, MAP} |
| 4682 |
} catch (Exception e) { |
5252 |
} catch (IllegalArgumentException iae) { |
| 4683 |
//e.printStackTrace(); |
5253 |
//iae.printStackTrace(); |
| 4684 |
exceptionThrown = true; |
5254 |
exceptionThrown = true; |
| 4685 |
} finally { |
5255 |
} finally { |
| 4686 |
cleanup(em); |
5256 |
cleanup(em); |
|
Lines 4689-4695
Link Here
|
| 4689 |
} |
5259 |
} |
| 4690 |
} |
5260 |
} |
| 4691 |
|
5261 |
|
| 4692 |
public void testPluralAttribute_Interface_getCollectionType_Method() { |
5262 |
public void testPluralAttribute_getCollectionType_Method() { |
| 4693 |
if(!this.isJPA10()) { |
5263 |
if(!this.isJPA10()) { |
| 4694 |
EntityManager em = null; |
5264 |
EntityManager em = null; |
| 4695 |
boolean exceptionThrown = false; |
5265 |
boolean exceptionThrown = false; |
|
Lines 4707-4714
Link Here
|
| 4707 |
* @return collection type |
5277 |
* @return collection type |
| 4708 |
*/ |
5278 |
*/ |
| 4709 |
//CollectionType getCollectionType(); |
5279 |
//CollectionType getCollectionType(); |
| 4710 |
} catch (Exception e) { |
5280 |
} catch (IllegalArgumentException iae) { |
| 4711 |
//e.printStackTrace(); |
5281 |
//iae.printStackTrace(); |
| 4712 |
exceptionThrown = true; |
5282 |
exceptionThrown = true; |
| 4713 |
} finally { |
5283 |
} finally { |
| 4714 |
cleanup(em); |
5284 |
cleanup(em); |
|
Lines 4717-4723
Link Here
|
| 4717 |
} |
5287 |
} |
| 4718 |
} |
5288 |
} |
| 4719 |
|
5289 |
|
| 4720 |
public void testPluralAttribute_Interface_getElementType_Method() { |
5290 |
public void testPluralAttribute_getElementType_Method() { |
| 4721 |
if(!this.isJPA10()) { |
5291 |
if(!this.isJPA10()) { |
| 4722 |
EntityManager em = null; |
5292 |
EntityManager em = null; |
| 4723 |
boolean exceptionThrown = false; |
5293 |
boolean exceptionThrown = false; |
|
Lines 4735-4742
Link Here
|
| 4735 |
*/ |
5305 |
*/ |
| 4736 |
//Type<E> getElementType(); |
5306 |
//Type<E> getElementType(); |
| 4737 |
|
5307 |
|
| 4738 |
} catch (Exception e) { |
5308 |
} catch (IllegalArgumentException iae) { |
| 4739 |
//e.printStackTrace(); |
5309 |
//iae.printStackTrace(); |
| 4740 |
exceptionThrown = true; |
5310 |
exceptionThrown = true; |
| 4741 |
} finally { |
5311 |
} finally { |
| 4742 |
cleanup(em); |
5312 |
cleanup(em); |
|
Lines 4745-4751
Link Here
|
| 4745 |
} |
5315 |
} |
| 4746 |
} |
5316 |
} |
| 4747 |
|
5317 |
|
| 4748 |
public void testSetAttribute_Interface() { |
5318 |
public void testSetAttribute() { |
| 4749 |
if(!this.isJPA10()) { |
5319 |
if(!this.isJPA10()) { |
| 4750 |
EntityManager em = null; |
5320 |
EntityManager em = null; |
| 4751 |
boolean exceptionThrown = false; |
5321 |
boolean exceptionThrown = false; |
|
Lines 4758-4765
Link Here
|
| 4758 |
// Actual Test Case |
5328 |
// Actual Test Case |
| 4759 |
// The interface is empty - we will test native functionality |
5329 |
// The interface is empty - we will test native functionality |
| 4760 |
|
5330 |
|
| 4761 |
} catch (Exception e) { |
5331 |
} catch (IllegalArgumentException iae) { |
| 4762 |
//e.printStackTrace(); |
5332 |
//iae.printStackTrace(); |
| 4763 |
exceptionThrown = true; |
5333 |
exceptionThrown = true; |
| 4764 |
} finally { |
5334 |
} finally { |
| 4765 |
cleanup(em); |
5335 |
cleanup(em); |
|
Lines 4768-4774
Link Here
|
| 4768 |
} |
5338 |
} |
| 4769 |
} |
5339 |
} |
| 4770 |
|
5340 |
|
| 4771 |
public void testSingularAttribute_Interface_isOptional_Method() { |
5341 |
public void testSingularAttribute_isOptional_Method() { |
| 4772 |
if(!this.isJPA10()) { |
5342 |
if(!this.isJPA10()) { |
| 4773 |
EntityManager em = null; |
5343 |
EntityManager em = null; |
| 4774 |
boolean expectedIAExceptionThrown = false; |
5344 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4794-4801
Link Here
|
| 4794 |
//boolean isOptional(); |
5364 |
//boolean isOptional(); |
| 4795 |
assertFalse(((AttributeImpl)nameAttribute).isPlural()); |
5365 |
assertFalse(((AttributeImpl)nameAttribute).isPlural()); |
| 4796 |
assertFalse(((SingularAttributeImpl)nameAttribute).isVersion()); |
5366 |
assertFalse(((SingularAttributeImpl)nameAttribute).isVersion()); |
| 4797 |
} catch (Exception e) { |
5367 |
} catch (IllegalArgumentException iae) { |
| 4798 |
//e.printStackTrace(); |
5368 |
//iae.printStackTrace(); |
| 4799 |
expectedIAExceptionThrown = true; |
5369 |
expectedIAExceptionThrown = true; |
| 4800 |
} finally { |
5370 |
} finally { |
| 4801 |
cleanup(em); |
5371 |
cleanup(em); |
|
Lines 4804-4810
Link Here
|
| 4804 |
} |
5374 |
} |
| 4805 |
} |
5375 |
} |
| 4806 |
|
5376 |
|
| 4807 |
public void testSingularAttribute_Interface_isId_Method() { |
5377 |
public void testSingularAttribute_isId_Method() { |
| 4808 |
if(!this.isJPA10()) { |
5378 |
if(!this.isJPA10()) { |
| 4809 |
EntityManager em = null; |
5379 |
EntityManager em = null; |
| 4810 |
boolean expectedIAExceptionThrown = false; |
5380 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4831-4838
Link Here
|
| 4831 |
//boolean isId(); |
5401 |
//boolean isId(); |
| 4832 |
assertFalse(((AttributeImpl)nameAttribute).isPlural()); |
5402 |
assertFalse(((AttributeImpl)nameAttribute).isPlural()); |
| 4833 |
assertFalse(((SingularAttributeImpl)nameAttribute).isVersion()); |
5403 |
assertFalse(((SingularAttributeImpl)nameAttribute).isVersion()); |
| 4834 |
} catch (Exception e) { |
5404 |
} catch (IllegalArgumentException iae) { |
| 4835 |
//e.printStackTrace(); |
5405 |
//iae.printStackTrace(); |
| 4836 |
expectedIAExceptionThrown = true; |
5406 |
expectedIAExceptionThrown = true; |
| 4837 |
} finally { |
5407 |
} finally { |
| 4838 |
cleanup(em); |
5408 |
cleanup(em); |
|
Lines 4841-4847
Link Here
|
| 4841 |
} |
5411 |
} |
| 4842 |
} |
5412 |
} |
| 4843 |
|
5413 |
|
| 4844 |
public void testSingularAttribute_Interface_isVersion_Method() { |
5414 |
public void testSingularAttribute_isVersion_Method() { |
| 4845 |
if(!this.isJPA10()) { |
5415 |
if(!this.isJPA10()) { |
| 4846 |
EntityManager em = null; |
5416 |
EntityManager em = null; |
| 4847 |
boolean expectedIAExceptionThrown = false; |
5417 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4867-4874
Link Here
|
| 4867 |
//public boolean isVersion() { |
5437 |
//public boolean isVersion() { |
| 4868 |
assertFalse(((AttributeImpl)nameAttribute).isPlural()); |
5438 |
assertFalse(((AttributeImpl)nameAttribute).isPlural()); |
| 4869 |
assertFalse(((SingularAttributeImpl)nameAttribute).isVersion()); |
5439 |
assertFalse(((SingularAttributeImpl)nameAttribute).isVersion()); |
| 4870 |
} catch (Exception e) { |
5440 |
} catch (IllegalArgumentException iae) { |
| 4871 |
//e.printStackTrace(); |
5441 |
//iae.printStackTrace(); |
| 4872 |
expectedIAExceptionThrown = true; |
5442 |
expectedIAExceptionThrown = true; |
| 4873 |
} finally { |
5443 |
} finally { |
| 4874 |
cleanup(em); |
5444 |
cleanup(em); |
|
Lines 4877-4883
Link Here
|
| 4877 |
} |
5447 |
} |
| 4878 |
} |
5448 |
} |
| 4879 |
|
5449 |
|
| 4880 |
public void testSingularAttribute_Interface_getBindableType_Method() { |
5450 |
public void testSingularAttribute_getBindableType_Method() { |
| 4881 |
if(!this.isJPA10()) { |
5451 |
if(!this.isJPA10()) { |
| 4882 |
EntityManager em = null; |
5452 |
EntityManager em = null; |
| 4883 |
boolean expectedIAExceptionThrown = false; |
5453 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4893-4900
Link Here
|
| 4893 |
* @return bindable type |
5463 |
* @return bindable type |
| 4894 |
*/ |
5464 |
*/ |
| 4895 |
//BindableType getBindableType(); |
5465 |
//BindableType getBindableType(); |
| 4896 |
} catch (Exception e) { |
5466 |
} catch (IllegalArgumentException iae) { |
| 4897 |
e.printStackTrace(); |
5467 |
iae.printStackTrace(); |
| 4898 |
expectedIAExceptionThrown = true; |
5468 |
expectedIAExceptionThrown = true; |
| 4899 |
} finally { |
5469 |
} finally { |
| 4900 |
cleanup(em); |
5470 |
cleanup(em); |
|
Lines 4903-4909
Link Here
|
| 4903 |
} |
5473 |
} |
| 4904 |
} |
5474 |
} |
| 4905 |
|
5475 |
|
| 4906 |
public void testSingularAttribute_Interface_getBindableJavaType_Method() { |
5476 |
public void testSingularAttribute_getBindableJavaType_Method() { |
| 4907 |
if(!this.isJPA10()) { |
5477 |
if(!this.isJPA10()) { |
| 4908 |
EntityManager em = null; |
5478 |
EntityManager em = null; |
| 4909 |
boolean expectedIAExceptionThrown = false; |
5479 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4923-4930
Link Here
|
| 4923 |
*/ |
5493 |
*/ |
| 4924 |
//Class<T> getBindableJavaType(); |
5494 |
//Class<T> getBindableJavaType(); |
| 4925 |
|
5495 |
|
| 4926 |
} catch (Exception e) { |
5496 |
} catch (IllegalArgumentException iae) { |
| 4927 |
//e.printStackTrace(); |
5497 |
//iae.printStackTrace(); |
| 4928 |
expectedIAExceptionThrown = true; |
5498 |
expectedIAExceptionThrown = true; |
| 4929 |
} finally { |
5499 |
} finally { |
| 4930 |
cleanup(em); |
5500 |
cleanup(em); |
|
Lines 4933-4939
Link Here
|
| 4933 |
} |
5503 |
} |
| 4934 |
} |
5504 |
} |
| 4935 |
|
5505 |
|
| 4936 |
public void testSingularAttribute_Interface_getJavaType_Method() { |
5506 |
public void testSingularAttribute_getJavaType_Method() { |
| 4937 |
if(!this.isJPA10()) { |
5507 |
if(!this.isJPA10()) { |
| 4938 |
EntityManager em = null; |
5508 |
EntityManager em = null; |
| 4939 |
boolean expectedIAExceptionThrown = false; |
5509 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4947-4954
Link Here
|
| 4947 |
* @return Java type |
5517 |
* @return Java type |
| 4948 |
*/ |
5518 |
*/ |
| 4949 |
//public Class<T> getJavaType() { |
5519 |
//public Class<T> getJavaType() { |
| 4950 |
} catch (Exception e) { |
5520 |
} catch (IllegalArgumentException iae) { |
| 4951 |
//e.printStackTrace(); |
5521 |
//iae.printStackTrace(); |
| 4952 |
expectedIAExceptionThrown = true; |
5522 |
expectedIAExceptionThrown = true; |
| 4953 |
} finally { |
5523 |
} finally { |
| 4954 |
cleanup(em); |
5524 |
cleanup(em); |
|
Lines 4957-4963
Link Here
|
| 4957 |
} |
5527 |
} |
| 4958 |
} |
5528 |
} |
| 4959 |
|
5529 |
|
| 4960 |
public void testSingularAttribute_Interface_getType_Method() { |
5530 |
public void testSingularAttribute_getType_Method() { |
| 4961 |
if(!this.isJPA10()) { |
5531 |
if(!this.isJPA10()) { |
| 4962 |
EntityManager em = null; |
5532 |
EntityManager em = null; |
| 4963 |
boolean expectedIAExceptionThrown = false; |
5533 |
boolean expectedIAExceptionThrown = false; |
|
Lines 4978-4985
Link Here
|
| 4978 |
*/ |
5548 |
*/ |
| 4979 |
//public String toString() { |
5549 |
//public String toString() { |
| 4980 |
|
5550 |
|
| 4981 |
} catch (Exception e) { |
5551 |
} catch (IllegalArgumentException iae) { |
| 4982 |
//e.printStackTrace(); |
5552 |
//iae.printStackTrace(); |
| 4983 |
expectedIAExceptionThrown = true; |
5553 |
expectedIAExceptionThrown = true; |
| 4984 |
} finally { |
5554 |
} finally { |
| 4985 |
cleanup(em); |
5555 |
cleanup(em); |
|
Lines 4988-4994
Link Here
|
| 4988 |
} |
5558 |
} |
| 4989 |
} |
5559 |
} |
| 4990 |
|
5560 |
|
| 4991 |
public void testType_Interface_PersistenceType_enum() { |
5561 |
public void testType_PersistenceType_enum() { |
| 4992 |
if(!this.isJPA10()) { |
5562 |
if(!this.isJPA10()) { |
| 4993 |
EntityManager em = null; |
5563 |
EntityManager em = null; |
| 4994 |
boolean exceptionThrown = false; |
5564 |
boolean exceptionThrown = false; |
|
Lines 5007-5014
Link Here
|
| 5007 |
*/ |
5577 |
*/ |
| 5008 |
//PersistenceType getPersistenceType(); |
5578 |
//PersistenceType getPersistenceType(); |
| 5009 |
|
5579 |
|
| 5010 |
} catch (Exception e) { |
5580 |
} catch (IllegalArgumentException iae) { |
| 5011 |
//e.printStackTrace(); |
5581 |
//iae.printStackTrace(); |
| 5012 |
exceptionThrown = true; |
5582 |
exceptionThrown = true; |
| 5013 |
} finally { |
5583 |
} finally { |
| 5014 |
cleanup(em); |
5584 |
cleanup(em); |
|
Lines 5017-5023
Link Here
|
| 5017 |
} |
5587 |
} |
| 5018 |
} |
5588 |
} |
| 5019 |
|
5589 |
|
| 5020 |
public void testType_Interface_getPersistenceType_Method() { |
5590 |
public void testType_getPersistenceType_Method() { |
| 5021 |
if(!this.isJPA10()) { |
5591 |
if(!this.isJPA10()) { |
| 5022 |
EntityManager em = null; |
5592 |
EntityManager em = null; |
| 5023 |
boolean exceptionThrown = false; |
5593 |
boolean exceptionThrown = false; |
|
Lines 5041-5048
Link Here
|
| 5041 |
* @return Java type |
5611 |
* @return Java type |
| 5042 |
*/ |
5612 |
*/ |
| 5043 |
//Class<X> getJavaType(); |
5613 |
//Class<X> getJavaType(); |
| 5044 |
} catch (Exception e) { |
5614 |
} catch (IllegalArgumentException iae) { |
| 5045 |
//e.printStackTrace(); |
5615 |
//iae.printStackTrace(); |
| 5046 |
exceptionThrown = true; |
5616 |
exceptionThrown = true; |
| 5047 |
} finally { |
5617 |
} finally { |
| 5048 |
cleanup(em); |
5618 |
cleanup(em); |
|
Lines 5051-5057
Link Here
|
| 5051 |
} |
5621 |
} |
| 5052 |
} |
5622 |
} |
| 5053 |
|
5623 |
|
| 5054 |
public void testType_Interface_getJavaType_Method() { |
5624 |
public void testType_getJavaType_Method() { |
| 5055 |
if(!this.isJPA10()) { |
5625 |
if(!this.isJPA10()) { |
| 5056 |
EntityManager em = null; |
5626 |
EntityManager em = null; |
| 5057 |
boolean exceptionThrown = false; |
5627 |
boolean exceptionThrown = false; |
|
Lines 5068-5075
Link Here
|
| 5068 |
* @return Java type |
5638 |
* @return Java type |
| 5069 |
*/ |
5639 |
*/ |
| 5070 |
//Class<X> getJavaType(); |
5640 |
//Class<X> getJavaType(); |
| 5071 |
} catch (Exception e) { |
5641 |
} catch (IllegalArgumentException iae) { |
| 5072 |
//e.printStackTrace(); |
5642 |
//iae.printStackTrace(); |
| 5073 |
exceptionThrown = true; |
5643 |
exceptionThrown = true; |
| 5074 |
} finally { |
5644 |
} finally { |
| 5075 |
cleanup(em); |
5645 |
cleanup(em); |
|
Lines 5170-5177
Link Here
|
| 5170 |
|
5740 |
|
| 5171 |
Set<Attribute<Processor, ?>> entityProcessorDeclaredAttributes = entityProcessor_.getDeclaredAttributes(); |
5741 |
Set<Attribute<Processor, ?>> entityProcessorDeclaredAttributes = entityProcessor_.getDeclaredAttributes(); |
| 5172 |
assertEquals(3, entityProcessorDeclaredAttributes.size()); |
5742 |
assertEquals(3, entityProcessorDeclaredAttributes.size()); |
| 5173 |
} catch (Exception e) { |
5743 |
} catch (IllegalArgumentException iae) { |
| 5174 |
//e.printStackTrace(); |
5744 |
//iae.printStackTrace(); |
| 5175 |
exceptionThrown = true; |
5745 |
exceptionThrown = true; |
| 5176 |
} finally { |
5746 |
} finally { |
| 5177 |
cleanup(em); |
5747 |
cleanup(em); |
|
Lines 5201-5208
Link Here
|
| 5201 |
assertNotNull(entityManufacturer_.getList("hardwareDesigners").toString()); |
5771 |
assertNotNull(entityManufacturer_.getList("hardwareDesigners").toString()); |
| 5202 |
assertNotNull(entityManufacturer_.getMap("hardwareDesignersMap").toString()); |
5772 |
assertNotNull(entityManufacturer_.getMap("hardwareDesignersMap").toString()); |
| 5203 |
assertNotNull(entityManufacturer_.getSet("computers").toString()); |
5773 |
assertNotNull(entityManufacturer_.getSet("computers").toString()); |
| 5204 |
} catch (Exception e) { |
5774 |
} catch (IllegalArgumentException iae) { |
| 5205 |
//e.printStackTrace(); |
5775 |
//iae.printStackTrace(); |
| 5206 |
exceptionThrown = true; |
5776 |
exceptionThrown = true; |
| 5207 |
} finally { |
5777 |
} finally { |
| 5208 |
cleanup(em); |
5778 |
cleanup(em); |