use of org.jboss.tools.hibernate.orm.test.utils.project.SimpleTestProject in project jbosstools-hibernate by jbosstools.
the class RefactoringTest method setUp.
@Before
public void setUp() throws Exception {
oldPathStr = oldPathElements[0];
String notChangedPathStr = oldPathElements[0] + 1;
for (int i = 1; i < oldPathElements.length; i++) {
// $NON-NLS-1$
oldPathStr += "/" + oldPathElements[i];
// $NON-NLS-1$
notChangedPathStr += "/" + oldPathElements[i] + 1;
}
Map<String, Object> testStrAttr = new HashMap<String, Object>();
Map<String, Object> testStrListAttr = new HashMap<String, Object>();
Map<String, Object> testNotChangedAttr = new HashMap<String, Object>();
Map<String, Object> testCodeGenerationAttr = new HashMap<String, Object>();
Map<String, Object> testNotChangedCodeGenerationAttr = new HashMap<String, Object>();
testStrAttr.put(IConsoleConfigurationLaunchConstants.CFG_XML_FILE, oldPathStr);
testStrListAttr.put(IConsoleConfigurationLaunchConstants.FILE_MAPPINGS, Arrays.asList(new String[] { oldPathStr }));
testNotChangedAttr.put(IConsoleConfigurationLaunchConstants.CFG_XML_FILE, notChangedPathStr);
testNotChangedAttr.put(IConsoleConfigurationLaunchConstants.FILE_MAPPINGS, Arrays.asList(new String[] { notChangedPathStr }));
testCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_TEMPLATE_DIR, generateOldPathForSegment(2).toString());
testCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_OUTPUT_DIR, generateOldPathForSegment(2).toString());
testCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER_SETTINGS, oldPathStr.toString());
testCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_EXPORTERS, Collections.singletonList(HBMTEMPLATE0));
Map<String, String> expProps = new HashMap<String, String>();
expProps.put(OUTDIR, generateOldPathForSegment(2).toString());
testCodeGenerationAttr.put(HBMTEMPLATE0_PROPERTIES, expProps);
testNotChangedCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_TEMPLATE_DIR, notChangedPathStr.toString());
testNotChangedCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_OUTPUT_DIR, notChangedPathStr.toString());
testNotChangedCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER_SETTINGS, notChangedPathStr.toString());
testCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_EXPORTERS, Collections.singletonList(HBMTEMPLATE0));
Map<String, String> expProps2 = new HashMap<String, String>();
expProps2.put(OUTDIR, generateOldPathForSegment(2).toString());
testNotChangedCodeGenerationAttr.put(HBMTEMPLATE0_PROPERTIES, expProps2);
testStrConfig = new TestLaunchConfig(testStrAttr);
testStrListConfig = new TestLaunchConfig(testStrListAttr);
testNotChangedConfig = new TestLaunchConfig(testNotChangedAttr);
testCodeGenerationConfig = new TestLaunchConfig(testCodeGenerationAttr);
testNotChangedCodeGenerationConfig = new TestLaunchConfig(testNotChangedCodeGenerationAttr);
project = new SimpleTestProject(oldPathElements[0]);
IJavaProject proj = project.getIJavaProject();
{
// initialize IRuntimeClassPathEntry[] and affectSegmentsCount for it
runtimeClasspathEntries = new IRuntimeClasspathEntry[5];
affectSegmentsCount = new int[runtimeClasspathEntries.length];
affectSegmentsCount[0] = 0;
affectSegmentsCount[1] = 0;
affectSegmentsCount[2] = 1;
affectSegmentsCount[3] = 2;
// all changes
affectSegmentsCount[4] = oldPathElements.length - 1;
// project
runtimeClasspathEntries[0] = new DefaultProjectClasspathEntry(proj);
runtimeClasspathEntries[1] = new RuntimeClasspathEntry(JavaCore.newProjectEntry(generateOldPathForSegment(affectSegmentsCount[1]).makeAbsolute()));
runtimeClasspathEntries[2] = new RuntimeClasspathEntry(JavaCore.newVariableEntry(generateOldPathForSegment(affectSegmentsCount[2]).makeAbsolute(), null, null));
runtimeClasspathEntries[3] = new RuntimeClasspathEntry(JavaCore.newVariableEntry(generateOldPathForSegment(affectSegmentsCount[3]).makeAbsolute(), null, null));
runtimeClasspathEntries[4] = new RuntimeClasspathEntry(JavaCore.newLibraryEntry(generateOldPathForSegment(affectSegmentsCount[4]).makeAbsolute(), null, null));
}
}
use of org.jboss.tools.hibernate.orm.test.utils.project.SimpleTestProject in project jbosstools-hibernate by jbosstools.
the class HibernateConsoleTestHelper method setUp.
public void setUp() throws Exception {
this.project = new SimpleTestProject();
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().setPerspective(PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(HibernateConsolePerspectiveFactory.ID_CONSOLE_PERSPECTIVE));
IPackagesViewPart packageExplorer = null;
try {
packageExplorer = (IPackagesViewPart) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(JavaUI.ID_PACKAGES);
} catch (PartInitException e) {
throw new RuntimeException(e);
}
IType type = this.project.getTestClassType();
packageExplorer.selectAndReveal(type);
FileEditorInput input = new FileEditorInput((IFile) type.getCompilationUnit().getCorrespondingResource());
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input, JavaUI.ID_CU_EDITOR);
}
Aggregations