use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.
the class OverrideRepositoryFacadeTest method testGetReverseEngineeringStrategy.
@Test
public void testGetReverseEngineeringStrategy() throws Exception {
ReverseEngineeringStrategy res = new DefaultReverseEngineeringStrategy();
IReverseEngineeringStrategy resFacade = FACADE_FACTORY.createReverseEngineeringStrategy(res);
IReverseEngineeringStrategy result = overrideRepositoryFacade.getReverseEngineeringStrategy(resFacade);
DelegatingReverseEngineeringStrategy resultTarget = (DelegatingReverseEngineeringStrategy) ((IFacade) result).getTarget();
Field delegateField = DelegatingReverseEngineeringStrategy.class.getDeclaredField("delegate");
delegateField.setAccessible(true);
Assert.assertSame(res, delegateField.get(resultTarget));
}
use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.
the class ServiceImpl method newReverseEngineeringStrategy.
@SuppressWarnings("unchecked")
private ReverseEngineeringStrategy newReverseEngineeringStrategy(final String className, ReverseEngineeringStrategy delegate) {
try {
Class<ReverseEngineeringStrategy> clazz = (Class<ReverseEngineeringStrategy>) ReflectHelper.classForName(className);
Constructor<ReverseEngineeringStrategy> constructor = clazz.getConstructor(new Class[] { ReverseEngineeringStrategy.class });
return constructor.newInstance(new Object[] { delegate });
} catch (NoSuchMethodException e) {
try {
Class<?> clazz = ReflectHelper.classForName(className);
ReverseEngineeringStrategy rev = (ReverseEngineeringStrategy) clazz.newInstance();
return rev;
} catch (Exception eq) {
throw new HibernateConsoleRuntimeException(eq);
}
} catch (Exception e) {
throw new HibernateConsoleRuntimeException(e);
}
}
use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.
the class ServiceImpl method newReverseEngineeringStrategy.
@SuppressWarnings("unchecked")
private ReverseEngineeringStrategy newReverseEngineeringStrategy(final String className, ReverseEngineeringStrategy delegate) {
try {
Class<ReverseEngineeringStrategy> clazz = (Class<ReverseEngineeringStrategy>) ReflectHelper.classForName(className);
Constructor<ReverseEngineeringStrategy> constructor = clazz.getConstructor(new Class[] { ReverseEngineeringStrategy.class });
return constructor.newInstance(new Object[] { delegate });
} catch (NoSuchMethodException e) {
try {
Class<?> clazz = ReflectHelper.classForName(className);
ReverseEngineeringStrategy rev = (ReverseEngineeringStrategy) clazz.newInstance();
return rev;
} catch (Exception eq) {
throw new HibernateConsoleRuntimeException(eq);
}
} catch (Exception e) {
throw new HibernateConsoleRuntimeException(e);
}
}
use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.
the class ServiceImpl method newReverseEngineeringStrategy.
@Override
public IReverseEngineeringStrategy newReverseEngineeringStrategy(String strategyName, IReverseEngineeringStrategy delegate) {
assert delegate instanceof IFacade;
ReverseEngineeringStrategy delegateTarget = (ReverseEngineeringStrategy) ((IFacade) delegate).getTarget();
Object target = newReverseEngineeringStrategy(strategyName, delegateTarget);
return facadeFactory.createReverseEngineeringStrategy(target);
}
use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.
the class ConfigurationFacadeTest method testSetReverseEngineeringStrategy.
@Test
public void testSetReverseEngineeringStrategy() {
JDBCMetaDataConfiguration configuration = new JDBCMetaDataConfiguration();
configurationFacade = FACADE_FACTORY.createConfiguration(configuration);
ReverseEngineeringStrategy reverseEngineeringStrategy = new DefaultReverseEngineeringStrategy();
IReverseEngineeringStrategy strategyFacade = FACADE_FACTORY.createReverseEngineeringStrategy(reverseEngineeringStrategy);
Assert.assertNotSame(reverseEngineeringStrategy, configuration.getReverseEngineeringStrategy());
configurationFacade.setReverseEngineeringStrategy(strategyFacade);
Assert.assertSame(reverseEngineeringStrategy, configuration.getReverseEngineeringStrategy());
}
Aggregations