public void testFetchPlanSubclassFetchModeHint() {
String hintName = "openjpa.FetchPlan.SubclassFetchMode";
EntityManager em = emf.createEntityManager();
OpenJPAEntityManager oem = (OpenJPAEntityManager)em.getDelegate();
JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
((EntityManagerImpl) oem).getBroker().getFetchConfiguration();
subclassFetchModeHintTest(fPlan, fConfig, hintName, "none",
FetchMode.NONE, EagerFetchModes.EAGER_NONE);
subclassFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.NONE
.name(), FetchMode.NONE, EagerFetchModes.EAGER_NONE);
subclassFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.NONE,
FetchMode.NONE, EagerFetchModes.EAGER_NONE);
subclassFetchModeHintTest(fPlan, fConfig, hintName, "parallel",
FetchMode.PARALLEL, EagerFetchModes.EAGER_PARALLEL);
subclassFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.PARALLEL
.name(), FetchMode.PARALLEL, EagerFetchModes.EAGER_PARALLEL);
subclassFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.PARALLEL,
FetchMode.PARALLEL, EagerFetchModes.EAGER_PARALLEL);
subclassFetchModeHintTest(fPlan, fConfig, hintName, "join",
FetchMode.JOIN, EagerFetchModes.EAGER_JOIN);
subclassFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.JOIN
.name(), FetchMode.JOIN, EagerFetchModes.EAGER_JOIN);
subclassFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.JOIN,
FetchMode.JOIN, EagerFetchModes.EAGER_JOIN);
try {
fPlan.setHint(hintName, "xxxxx");
fPlan.setHint(hintName, "yyyyy");
fail("Expecting a a IllegalArgumentException.");
} catch (Exception e) {
assertTrue("Caught expected exception",
IllegalArgumentException.class.isAssignableFrom(e.getClass()));
}
try {
fPlan.setHint(hintName, "12345");
fPlan.setHint(hintName, "67890");
fail("Expecting a a IllegalArgumentException.");
} catch (Exception e) {
assertTrue("Caught expected exception",
IllegalArgumentException.class.isAssignableFrom(e.getClass()));
}
try {
fPlan.setHint(hintName, -1);
fPlan.setHint(hintName, -2);
fail("Expecting a a IllegalArgumentException.");
} catch (Exception e) {
assertTrue("Caught expected exception",
IllegalArgumentException.class.isAssignableFrom(e.getClass()));
}