Author: vyemialyanchyk
Date: 2008-06-06 12:51:10 -0400 (Fri, 06 Jun 2008)
New Revision: 8613
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleTestMessages.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleTestMessages.properties
Removed:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/Messages.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Messages.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/messages.properties
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/messages.properties
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/BeanShellIntegrationTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/HibernateConsoleTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/PerspectiveTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/RefactoringTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestProject.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenJavaEditors.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/ProjectUtil.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSetAfterSetup.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSetBeforeTearDown.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/UpdateConfigurationTest.java
Log:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-500
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/BeanShellIntegrationTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/BeanShellIntegrationTest.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/BeanShellIntegrationTest.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -9,16 +9,16 @@
public static class CallBack {
public void line(int number) {
System.out.println(number + ":"); //$NON-NLS-1$
- }
+ }
}
-
+
public void testBsh() {
-
+
Interpreter bsh = new Interpreter();
-
+
try {
bsh.set("callback", new CallBack()); //$NON-NLS-1$
-
+
StringBuffer buf = new StringBuffer();
buf.append( "int i = 25;\r\n" ); //$NON-NLS-1$
buf.append( "callback.line(1);\r\n" ); //$NON-NLS-1$
@@ -27,13 +27,13 @@
buf.append( "i+j;" ); //$NON-NLS-1$
buf.append( "callback.line(3);" ); //$NON-NLS-1$
Object object = bsh.eval( buf.toString() );
-
- System.out.println(Messages.BEANSHELLINTEGRATIONTEST_RESULT + object);
-
+
+ System.out.println(ConsoleTestMessages.BeanShellIntegrationTest_result + object);
+
}
catch (EvalError e) {
e.printStackTrace();
}
-
+
}
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -25,37 +25,37 @@
public ConsoleConfigurationTest(String name) {
super( name );
}
-
+
protected void setUp() throws Exception {
super.setUp();
-
+
TestConsoleConfigurationPreferences cfgprefs = new
TestConsoleConfigurationPreferences();
consoleCfg = new ConsoleConfiguration(cfgprefs);
KnownConfigurations.getInstance().addConfiguration(consoleCfg, true);
}
-
+
protected void tearDown() throws Exception {
KnownConfigurations.getInstance().removeAllConfigurations();
}
-
+
static class TestConsoleConfigurationPreferences implements
ConsoleConfigurationPreferences {
-
- public void setName(String name) {
+
+ public void setName(String name) {
fail();
}
-
+
public void readStateFrom(Element element) {
- fail();
+ fail();
}
-
+
public void writeStateTo(Element node) {
- fail();
+ fail();
}
-
+
public File getPropertyFile() {
return null;
}
-
+
public File getConfigXMLFile() {
File xmlConfig = null;
Bundle bundle = HibernateConsoleTestPlugin.getDefault().getBundle();
@@ -67,28 +67,28 @@
}
return xmlConfig;
}
-
+
public Properties getProperties() {
Properties p = new Properties();
p.setProperty("hibernate.dialect",
"org.hibernate.dialect.HSQLDialect"); //$NON-NLS-1$ //$NON-NLS-2$
return p;
}
-
+
public File[] getMappingFiles() {
return new File[0];
}
-
+
public URL[] getCustomClassPathURLS() {
return new URL[0];
}
-
+
public String getName() {
- return Messages.CONSOLECONFIGTEST_FAKE_PREFS;
+ return ConsoleTestMessages.ConsoleConfigurationTest_fake_prefs;
}
-
-
- public String getEntityResolverName() {
+
+
+ public String getEntityResolverName() {
return ""; //$NON-NLS-1$
}
@@ -105,74 +105,74 @@
// TODO Auto-generated method stub
return null;
}
-
+
}
-
-
+
+
static class MockCCListener implements ConsoleConfigurationListener {
int factoryBuilt = 0;
int factoryClosing = 0;
public int queryCreated;
-
+
public void sessionFactoryClosing(ConsoleConfiguration configuration,
SessionFactory aboutToCloseFactory) {
- factoryClosing++;
+ factoryClosing++;
}
-
+
public void sessionFactoryBuilt(ConsoleConfiguration ccfg,
SessionFactory builtSessionFactory) {
- factoryBuilt++;
+ factoryBuilt++;
}
public void queryPageCreated(QueryPage qp) {
queryCreated++;
}
-
-
-
+
+
+
}
-
+
public void testBuildConfiguration() {
-
+
MockCCListener listener = new MockCCListener();
assertTrue(consoleCfg.getConsoleConfigurationListeners().length==1);
consoleCfg.addConsoleConfigurationListener(listener);
-
+
consoleCfg.build();
-
+
assertEquals(0, listener.factoryBuilt);
consoleCfg.buildSessionFactory();
assertEquals(1, listener.factoryBuilt);
-
+
try {
consoleCfg.buildSessionFactory();
- fail(Messages.CONSOLECONFIGTEST_FACTORY_ALREADY_EXISTS);
+ fail(ConsoleTestMessages.ConsoleConfigurationTest_factory_already_exists);
} catch (HibernateConsoleRuntimeException hcre) {
-
+
}
-
+
QueryPage qp = consoleCfg.executeHQLQuery("from java.lang.Object");
//$NON-NLS-1$
assertEquals(1, listener.queryCreated);
-
- consoleCfg.closeSessionFactory();
+
+ consoleCfg.closeSessionFactory();
assertEquals(1, listener.factoryClosing);
-
-
+
+
}
-
+
/*public void testCleanup() throws InterruptedException {
-
+
for(int cnt=0;cnt<10000;cnt++) {
if(cnt%2==0) {
-
+
System.out.println("Cnt " + cnt + " " +
Runtime.getRuntime().freeMemory()/1000);
Thread.sleep( 2000 );
}
-
+
consoleCfg.build();
consoleCfg.buildSessionFactory();
consoleCfg.reset();
}
-
+
}*/
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -11,26 +11,26 @@
public static Test suite() throws IOException {
TestSuite suite = new TestSuite(
- Messages.CONSOLEPLUGINALLTESTS_TEST_FOR );
-
+ ConsoleTestMessages.ConsolePluginAllTests_test_for );
+
suite.addTestSuite( KnownConfigurationsTest.class );
suite.addTestSuite( QueryParametersTest.class );
suite.addTestSuite( PerspectiveTest.class );
suite.addTestSuite( ConsoleConfigurationTest.class );
suite.addTestSuite( JavaFormattingTest.class );
suite.addTestSuite( RefactoringTest.class );
-
+
suite.addTestSuite( HibernateAllMappingTests.class );
// core tests
//Properties properties = new Properties();
//properties.load(ConsolePluginAllTests.class.getResourceAsStream("plugintest-hibernate.properties"));
-
+
//System.getProperties().putAll(properties);
-
+
//suite.addTest(org.hibernate.tool.ToolAllTests.suite() );
-
+
return suite;
}
Copied:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleTestMessages.java
(from rev 8490,
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/Messages.java)
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleTestMessages.java
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleTestMessages.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -0,0 +1,55 @@
+package org.hibernate.eclipse.console.test;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ConsoleTestMessages extends NLS {
+ private static final String BUNDLE_NAME =
"org.hibernate.eclipse.console.test.ConsoleTestMessages"; //$NON-NLS-1$
+ public static String BeanShellIntegrationTest_result;
+ public static String ConsoleConfigurationTest_factory_already_exists;
+ public static String ConsoleConfigurationTest_fake_prefs;
+ public static String ConsolePluginAllTests_test_for;
+ public static String HibernateConsoleTest_long_running_task_detected;
+ public static String KnownConfigurationsTest_fake_prefs;
+ public static String KnownConfigurationsTest_new_test;
+ public static String KnownConfigurationsTest_no_sf_should_be_build;
+ public static String KnownConfigurationsTest_no_sf_should_be_closed;
+ public static String KnownConfigurationsTest_trying_remove_non_existing_console;
+ public static String PerspectiveTest_hibernate;
+ public static String RefactoringTest_category;
+ public static String RefactoringTest_coreexception_occurred_work_with_memento;
+ public static String RefactoringTest_exception_while_filenamechange_refactor;
+ public static String
RefactoringTest_exception_while_findchange_launch_config_processing;
+ public static String RefactoringTest_exception_while_packnamechange_refactor;
+ public static String RefactoringTest_exception_while_projnamechange_refactor;
+ public static String RefactoringTest_exception_while_srcnamechange_refactor;
+ public static String RefactoringTest_method_not_tested;
+ public static String RefactoringTest_segmentnum_too_match;
+ public static String RefactoringTest_test_launch_config;
+ public static String HibernateAllMappingTests_errors;
+ public static String HibernateAllMappingTests_fails;
+ public static String HibernateAllMappingTests_packages_tested;
+ public static String HibernateAllMappingTests_seconds;
+ public static String MappingTestProject_folder_not_found;
+ public static String OpenJavaEditors_error_openning_compilationunit;
+ public static String
OpenMappingDiagramTest_mapping_diagrams_for_package_cannot_be_opened;
+ public static String OpenMappingDiagramTest_mapping_diagram_for_not_opened;
+ public static String OpenMappingFileTest_highlighted_region_for_is_empty_package;
+ public static String
OpenMappingFileTest_highlighted_region_for_property_is_empty_package;
+ public static String OpenMappingFileTest_mapping_file_for_property_not_opened_package;
+ public static String OpenMappingFileTest_mapping_files_for_package_cannot_be_opened;
+ public static String OpenMappingFileTest_mapping_file_for_not_opened_package;
+ public static String OpenSourceFileTest_highlighted_region_for_is_empty;
+ public static String OpenSourceFileTest_mapping_file_for_not_opened;
+ public static String OpenSourceFileTest_source_files_for_package_cannot_be_opened;
+ public static String ProjectUtil_cannot_get_error_field_from_erroreditorpart;
+ public static String ProjectUtil_cannot_get_exception_from_erroreditorpart;
+ public static String TestSet_test_for_mappingtestproject;
+ public static String UpdateConfigurationTest_error_customising_file_for_package;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, ConsoleTestMessages.class);
+ }
+
+ private ConsoleTestMessages() {
+ }
+}
Copied:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleTestMessages.properties
(from rev 8490,
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/messages.properties)
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleTestMessages.properties
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleTestMessages.properties 2008-06-06
16:51:10 UTC (rev 8613)
@@ -0,0 +1,41 @@
+BeanShellIntegrationTest_result=Result:
+ConsoleConfigurationTest_factory_already_exists=Should throw an exception because a
factory already exists\!
+ConsoleConfigurationTest_fake_prefs=fake prefs
+ConsolePluginAllTests_test_for=Test for org.hibernate.eclipse.console.test
+HibernateConsoleTest_long_running_task_detected=A long running task detected
+KnownConfigurationsTest_fake_prefs=fake prefs
+KnownConfigurationsTest_new_test=new test
+KnownConfigurationsTest_no_sf_should_be_build=no sf should be built\!
+KnownConfigurationsTest_no_sf_should_be_closed=no sf should be closed\!
+KnownConfigurationsTest_trying_remove_non_existing_console=trying to remove a non
existing console
+PerspectiveTest_hibernate=Hibernate
+RefactoringTest_category=Category
+RefactoringTest_coreexception_occurred_work_with_memento=CoreException occurred when try
to work with memento.
+RefactoringTest_exception_while_filenamechange_refactor=Exception while FileNameChange
refactor processing\!
+RefactoringTest_exception_while_findchange_launch_config_processing=Exception while
FindChanged launch configurations processing\!
+RefactoringTest_exception_while_packnamechange_refactor=Exception while PackNameChange
refactor processing\!
+RefactoringTest_exception_while_projnamechange_refactor=Exception while ProjectNameChange
refactor processing\!
+RefactoringTest_exception_while_srcnamechange_refactor=Exception while SrcNameChange
refactor processing\!
+RefactoringTest_method_not_tested=Method doesn't tested
+RefactoringTest_segmentnum_too_match=SegmentNum is too match.
+RefactoringTest_test_launch_config=Test Launch Config
+HibernateAllMappingTests_errors=\ errors.
+HibernateAllMappingTests_fails=\ fails.
+HibernateAllMappingTests_packages_tested=\ packages tested.
+HibernateAllMappingTests_seconds=\ sec.
+MappingTestProject_folder_not_found=Folder {0} not found\!
+OpenJavaEditors_error_openning_compilationunit=Error opening CompilationUnit:
+OpenMappingDiagramTest_mapping_diagrams_for_package_cannot_be_opened=Mapping Diagrams for
package {0} can't be opened:\n{1}
+OpenMappingDiagramTest_mapping_diagram_for_not_opened=Mapping Diagram for {0} not
opened:\n{1}
+OpenMappingFileTest_highlighted_region_for_property_is_empty_package=Highlighted region
for property {0} is empty. (package {1})
+OpenMappingFileTest_highlighted_region_for_is_empty_package=Highlighted region for {0} is
empty. (package {1})
+OpenMappingFileTest_mapping_file_for_property_not_opened_package=Mapping file for
property {0} not opened: (package {1}) :\n{2}
+OpenMappingFileTest_mapping_files_for_package_cannot_be_opened=Mapping Files for package
{0} can't be opened:\n{1}
+OpenMappingFileTest_mapping_file_for_not_opened_package=Mapping file for {0} not opened:
(package {1}) :\n{2}
+OpenSourceFileTest_highlighted_region_for_is_empty=Highlighted region for {0} is empty.
+OpenSourceFileTest_mapping_file_for_not_opened=Mapping file for {0} not opened:\n{1}
+OpenSourceFileTest_source_files_for_package_cannot_be_opened=Source files for package {0}
can't be opened:\n{1}
+ProjectUtil_cannot_get_error_field_from_erroreditorpart=Can't get error field from
ErrorEditorPart.
+ProjectUtil_cannot_get_exception_from_erroreditorpart=Can't get exception from
ErrorEditorPart.
+TestSet_test_for_mappingtestproject=Test for MappingTestProject
+UpdateConfigurationTest_error_customising_file_for_package=Error customizing {0} file for
package {1}.\n{2}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/HibernateConsoleTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/HibernateConsoleTest.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/HibernateConsoleTest.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -21,7 +21,7 @@
public abstract class HibernateConsoleTest extends TestCase {
private static final long MAX_IDLE = 5*60*1000L;
-
+
private SimpleTestProject project;
public HibernateConsoleTest(String name) {
@@ -32,13 +32,13 @@
super.setUp();
this.project = createTestProject();
-
+
waitForJobs();
PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().setPerspective(
PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(HibernateConsolePerspectiveFactory.ID_CONSOLE_PERSPECTIVE));
-
+
IPackagesViewPart packageExplorer = null;
try {
packageExplorer = (IPackagesViewPart) PlatformUI.getWorkbench()
@@ -46,22 +46,22 @@
} 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 );
-
+
delay(2000);
}
protected SimpleTestProject createTestProject() {
return new SimpleTestProject();
}
-
+
protected void tearDown() throws Exception {
waitForJobs();
@@ -76,11 +76,11 @@
super.tearDown();
}
-
+
/**
* Process UI input but do not return for the specified time interval.
- *
+ *
* @param waitTimeMillis
* the number of milliseconds
*/
@@ -115,17 +115,17 @@
while (Platform.getJobManager().currentJob() != null)
delay(2000);
}*/
-
+
public void waitForJobs() {
long start = System.currentTimeMillis();
while (!Job.getJobManager().isIdle()) {
delay(500);
- if ( (System.currentTimeMillis()-start) > MAX_IDLE )
- throw new
RuntimeException(Messages.HIBERNATECONSOLETEST_LONG_RUNNING_TASK_DETECTED);
+ if ( (System.currentTimeMillis()-start) > MAX_IDLE )
+ throw new
RuntimeException(ConsoleTestMessages.HibernateConsoleTest_long_running_task_detected);
}
delay(1000);
}
-
+
public boolean noMoreJobs() {
Job[] queuedJobs= Job.getJobManager().find(null);
for (int i= 0; i < queuedJobs.length; i++) {
@@ -136,10 +136,9 @@
}
return true;
}
-
+
protected SimpleTestProject getProject() {
return this.project;
}
-
+
}
-
\ No newline at end of file
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -20,90 +20,90 @@
public KnownConfigurationsTest(String name) {
super( name );
}
-
+
static class CCListener implements KnownConfigurationsListener {
List added = new ArrayList();
-
+
public void configurationAdded(ConsoleConfiguration root) {
added.add(root);
}
public void sessionFactoryBuilt(ConsoleConfiguration ccfg, SessionFactory builtFactory)
{
- fail(Messages.KNOWNCONFIGURATIONSTEST_NO_SF_SHOULD_BE_BUILD);
+ fail(ConsoleTestMessages.KnownConfigurationsTest_no_sf_should_be_build);
}
public void sessionFactoryClosing(ConsoleConfiguration configuration, SessionFactory
closingFactory) {
- fail(Messages.KNOWNCONFIGURATIONSTEST_NO_SF_SHOULD_BE_CLOSED);
+ fail(ConsoleTestMessages.KnownConfigurationsTest_no_sf_should_be_closed);
}
public void configurationRemoved(ConsoleConfiguration root, boolean forUpdate) {
if(!added.remove(root)) {
- fail(Messages.KNOWNCONFIGURATIONSTEST_TRYING_REMOVE_NON_EXISTING_CONSOLE);
+ fail(ConsoleTestMessages.KnownConfigurationsTest_trying_remove_non_existing_console);
}
}
}
-
+
public void testKnownConfigurations() {
-
+
KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
ConsoleConfiguration[] configurations = knownConfigurations.getConfigurations();
-
+
assertEquals(0, configurations.length);
-
-
+
+
CCListener listener = new CCListener();
try {
knownConfigurations.addConsoleConfigurationListener(listener);
-
+
assertEquals(0, listener.added.size());
-
+
ConsoleConfigurationPreferences preferences = new ConsoleConfigurationPreferences() {
-
+
public void setName(String name) {
// TODO Auto-generated method stub
-
+
}
-
+
public void readStateFrom(Element element) {
// TODO Auto-generated method stub
-
+
}
-
+
public void writeStateTo(Element node) {
// TODO Auto-generated method stub
-
+
}
-
+
public File getPropertyFile() {
// TODO Auto-generated method stub
return null;
}
-
+
public File getConfigXMLFile() {
// TODO Auto-generated method stub
return null;
}
-
+
public Properties getProperties() {
// TODO Auto-generated method stub
return null;
}
-
+
public File[] getMappingFiles() {
// TODO Auto-generated method stub
return null;
}
-
+
public URL[] getCustomClassPathURLS() {
// TODO Auto-generated method stub
return null;
}
-
+
public String getName() {
- return Messages.KNOWNCONFIGURATIONSTEST_FAKE_PREFS;
+ return ConsoleTestMessages.KnownConfigurationsTest_fake_prefs;
}
-
+
public boolean useAnnotations() {
// TODO Auto-generated method stub
return false;
@@ -128,56 +128,56 @@
// TODO Auto-generated method stub
return null;
}
-
+
};
-
+
ConsoleConfigurationPreferences preferences2 = new ConsoleConfigurationPreferences() {
-
- String name = Messages.KNOWNCONFIGURATIONSTEST_NEW_TEST;
-
+
+ String name = ConsoleTestMessages.KnownConfigurationsTest_new_test;
+
public void setName(String name) {
this.name = name;
}
-
+
public void readStateFrom(Element element) {
// TODO Auto-generated method stub
-
+
}
-
+
public void writeStateTo(Element node) {
// TODO Auto-generated method stub
-
+
}
-
+
public File getPropertyFile() {
// TODO Auto-generated method stub
return null;
}
-
+
public File getConfigXMLFile() {
// TODO Auto-generated method stub
return null;
}
-
+
public Properties getProperties() {
// TODO Auto-generated method stub
return null;
}
-
+
public File[] getMappingFiles() {
// TODO Auto-generated method stub
return null;
}
-
+
public URL[] getCustomClassPathURLS() {
// TODO Auto-generated method stub
return null;
}
-
+
public String getName() {
return name;
}
-
+
public boolean useAnnotations() {
// TODO Auto-generated method stub
return false;
@@ -202,29 +202,29 @@
// TODO Auto-generated method stub
return null;
}
-
+
};
ConsoleConfiguration configuration = new ConsoleConfiguration(preferences);
ConsoleConfiguration configuration2 = new ConsoleConfiguration(preferences2);
-
+
knownConfigurations.addConfiguration(configuration, false);
knownConfigurations.addConfiguration(configuration2, false);
-
+
configurations = knownConfigurations.getConfigurations();
assertEquals(2,configurations.length);
assertEquals(listener.added.size(), 0);
-
+
knownConfigurations.addConfiguration(configuration, true);
knownConfigurations.addConfiguration(configuration2, true);
-
+
configurations = knownConfigurations.getConfigurations();
- assertEquals(2,configurations.length);
+ assertEquals(2,configurations.length);
assertEquals(listener.added.size(), 2);
-
+
knownConfigurations.removeConfiguration(configuration, false);
knownConfigurations.removeConfiguration(configuration2, false);
-
+
configurations = knownConfigurations.getConfigurations();
assertEquals(0,configurations.length);
assertEquals(listener.added.size(), 0);
@@ -232,5 +232,5 @@
KnownConfigurations.getInstance().removeConfigurationListener(listener);
}
}
-
+
}
Deleted:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/Messages.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/Messages.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/Messages.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -1,35 +0,0 @@
-package org.hibernate.eclipse.console.test;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME =
"org.hibernate.eclipse.console.test.messages"; //$NON-NLS-1$
- public static String BEANSHELLINTEGRATIONTEST_RESULT;
- public static String CONSOLECONFIGTEST_FACTORY_ALREADY_EXISTS;
- public static String CONSOLECONFIGTEST_FAKE_PREFS;
- public static String CONSOLEPLUGINALLTESTS_TEST_FOR;
- public static String HIBERNATECONSOLETEST_LONG_RUNNING_TASK_DETECTED;
- public static String KNOWNCONFIGURATIONSTEST_FAKE_PREFS;
- public static String KNOWNCONFIGURATIONSTEST_NEW_TEST;
- public static String KNOWNCONFIGURATIONSTEST_NO_SF_SHOULD_BE_BUILD;
- public static String KNOWNCONFIGURATIONSTEST_NO_SF_SHOULD_BE_CLOSED;
- public static String KNOWNCONFIGURATIONSTEST_TRYING_REMOVE_NON_EXISTING_CONSOLE;
- public static String PERSPECTIVETEST_HIBERNATE;
- public static String REFACTORINGTEST_CATEGORY;
- public static String REFACTORINGTEST_COREEXCEPTION_OCCURED_WORK_WITH_MEMENTO;
- public static String REFACTORINGTEST_EXCEPTION_WHILE_FILENAMECHANGE_REFACTOR;
- public static String
REFACTORINGTEST_EXCEPTION_WHILE_FINDCHANGE_LAUNCH_CONFIG_PROCESSING;
- public static String REFACTORINGTEST_EXCEPTION_WHILE_PACKNAMECHANGE_REFACTOR;
- public static String REFACTORINGTEST_EXCEPTION_WHILE_PROJNAMECHANGE_REFACTOR;
- public static String REFACTORINGTEST_EXCEPTION_WHILE_SRCNAMECHANGE_REFACTOR;
- public static String REFACTORINGTEST_METHOD_NOT_TESTED;
- public static String REFACTORINGTEST_SEGMENTNUM_TOO_MATCH;
- public static String REFACTORINGTEST_TEST_LAUNCH_CONFIG;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/PerspectiveTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/PerspectiveTest.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/PerspectiveTest.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -8,13 +8,13 @@
public PerspectiveTest(String name) {
super( name );
}
-
+
public void testEnableHibernateProject() {
IPerspectiveDescriptor perspective = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().getPerspective();
- assertEquals(perspective.getLabel(), Messages.PERSPECTIVETEST_HIBERNATE);
+ assertEquals(perspective.getLabel(), ConsoleTestMessages.PerspectiveTest_hibernate);
}
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/RefactoringTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/RefactoringTest.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/RefactoringTest.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -44,22 +44,22 @@
*
*/
public class RefactoringTest extends TestCase {
-
+
private final String[] oldPathElements = new
String[]{"oldPrj","oldSrc", "oldPack",
"oldHibernate.cfg.xml"}; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
//$NON-NLS-4$
private final String[] newPathElements = new
String[]{"newPrj","newSrc", "newPack",
"newHibernate.cfg.xml"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
//$NON-NLS-4$
-
+
SimpleTestProject project = null;
-
+
private TestLaunchConfig testStrConfig = null;
private TestLaunchConfig testStrListConfig = null;
private TestLaunchConfig testNotChangedConfig = null;
-
-
+
+
private IRuntimeClasspathEntry[] runtimeClasspathEntries = null;
private int[] affectSegmentsCount = null; // shows how much segments should affect path
-
+
private String oldPathStr = null;
-
+
@Override
protected void setUp() throws Exception {
oldPathStr = oldPathElements[0];
@@ -71,20 +71,20 @@
Map<String, Object> testStrAttr = new HashMap<String, Object>();
Map<String, Object> testStrListAttr = new HashMap<String, Object>();
Map<String, Object> testNotChangedAttr = 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}));
-
+
testStrConfig = new TestLaunchConfig(testStrAttr);
testStrListConfig = new TestLaunchConfig(testStrListAttr);
testNotChangedConfig = new TestLaunchConfig(testNotChangedAttr);
project = new SimpleTestProject(oldPathElements[0]);
IJavaProject proj = project.getIJavaProject();
-
+
{ //initialize IRuntimeClassPathEntry[] and affectSegmentsCount for it
runtimeClasspathEntries = new IRuntimeClasspathEntry[5];
affectSegmentsCount = new int[runtimeClasspathEntries.length];
@@ -93,7 +93,7 @@
affectSegmentsCount[2] = 1;
affectSegmentsCount[3] = 2;
affectSegmentsCount[4] = oldPathElements.length - 1; //all changes
-
+
runtimeClasspathEntries[0] = new DefaultProjectClasspathEntry(proj);//project
runtimeClasspathEntries[1] = new RuntimeClasspathEntry(
JavaCore.newProjectEntry(generateOldPathForSegment(affectSegmentsCount[1]).makeAbsolute()));
runtimeClasspathEntries[2] = new RuntimeClasspathEntry(
JavaCore.newVariableEntry(generateOldPathForSegment(affectSegmentsCount[2]).makeAbsolute(),
null, null));
@@ -101,7 +101,7 @@
runtimeClasspathEntries[4] = new RuntimeClasspathEntry(
JavaCore.newLibraryEntry(generateOldPathForSegment(affectSegmentsCount[4]).makeAbsolute(),
null, null));
}
}
-
+
public void testFindChanged(){
for (int i = 0; i < oldPathElements.length - 1; i++) {
IPath oldPathPart = generateOldPathForSegment(i);
@@ -110,11 +110,11 @@
assertTrue(HibernateRefactoringUtil.isConfigurationAffected(testStrListConfig,
oldPathPart));
assertFalse(HibernateRefactoringUtil.isConfigurationAffected(testNotChangedConfig,
oldPathPart));
} catch (CoreException e) {
- fail(Messages.REFACTORINGTEST_EXCEPTION_WHILE_FINDCHANGE_LAUNCH_CONFIG_PROCESSING +
e.getMessage());
- }
+ fail(ConsoleTestMessages.RefactoringTest_exception_while_findchange_launch_config_processing
+ e.getMessage());
+ }
}
}
-
+
public void testClassPathChanges(){
for (int i = 0; i < oldPathElements.length - 1; i++) {
IPath oldPathPart = generateOldPathForSegment(i);
@@ -132,55 +132,55 @@
String newMemento = newMementos.get(0);
checkMementoChanged(oldMemento, newMemento, oldPathPart, newPath);
} catch (CoreException e) {
- fail(Messages.REFACTORINGTEST_COREEXCEPTION_OCCURED_WORK_WITH_MEMENTO +
e.getMessage());
+ fail(ConsoleTestMessages.RefactoringTest_coreexception_occurred_work_with_memento +
e.getMessage());
}
} else {
assertFalse(HibernateRefactoringUtil.isRuntimeClassPathEntriesAffected(new
IRuntimeClasspathEntry[]{runtimeClasspathEntries[j]}, oldPathPart));
}
}
- }
+ }
}
-
+
public void testProjectNameChange(){
int segmentNum = 0;
try {
updatePaths(generateOldPathForSegment(segmentNum),
generateNewPathForSegment(segmentNum));
checkPaths(generateTruePathForSegment(segmentNum));
} catch (CoreException e) {
- fail(Messages.REFACTORINGTEST_EXCEPTION_WHILE_PROJNAMECHANGE_REFACTOR);
+ fail(ConsoleTestMessages.RefactoringTest_exception_while_projnamechange_refactor);
}
}
-
+
public void testSrcNameChange(){
int segmentNum = 1;
try {
updatePaths(generateOldPathForSegment(segmentNum),
generateNewPathForSegment(segmentNum));
checkPaths(generateTruePathForSegment(segmentNum));
} catch (CoreException e) {
- fail(Messages.REFACTORINGTEST_EXCEPTION_WHILE_SRCNAMECHANGE_REFACTOR);
+ fail(ConsoleTestMessages.RefactoringTest_exception_while_srcnamechange_refactor);
}
}
-
+
public void testPackNameChange(){
int segmentNum = 2;
try {
updatePaths(generateOldPathForSegment(segmentNum),
generateNewPathForSegment(segmentNum));
checkPaths(generateTruePathForSegment(segmentNum));
} catch (CoreException e) {
- fail(Messages.REFACTORINGTEST_EXCEPTION_WHILE_PACKNAMECHANGE_REFACTOR);
+ fail(ConsoleTestMessages.RefactoringTest_exception_while_packnamechange_refactor);
}
}
-
+
public void testFileNameChange(){
int segmentNum = 3;
try {
updatePaths(generateOldPathForSegment(segmentNum),
generateNewPathForSegment(segmentNum));
checkPaths(generateTruePathForSegment(segmentNum));
} catch (CoreException e) {
- fail(Messages.REFACTORINGTEST_EXCEPTION_WHILE_FILENAMECHANGE_REFACTOR);
+ fail(ConsoleTestMessages.RefactoringTest_exception_while_filenamechange_refactor);
}
}
-
+
/* (non-Javadoc)
* @see junit.framework.TestCase#tearDown()
*/
@@ -188,12 +188,12 @@
protected void tearDown() throws Exception {
project.deleteIProject();
}
-
+
private void updatePaths(Path oldPath, Path newPath) throws CoreException{
HibernateRefactoringUtil.updateLaunchConfig(testStrConfig, oldPath, newPath);
HibernateRefactoringUtil.updateLaunchConfig(testStrListConfig, oldPath, newPath);
}
-
+
private void checkMementoChanged(String oldMemento, String newMemento, IPath
oldPathPart, IPath newPath){
/*
* /myProj/mySrc, \myProj\mySrc, myProj/mySrc, myProj\mySrc, myProj/mySrc/,
myProj\mySrc\
@@ -207,7 +207,7 @@
if (newPathStr.charAt(newPathStr.length() - 1) == '/') newPathStr =
newPathStr.substring(0 , newPathStr.length() - 1);
oldPathStr = oldPathStr.replaceAll("/", "[\\\\,/]?"); //$NON-NLS-1$
//$NON-NLS-2$
newPathStr = newPathStr.replaceAll("/", "[\\\\,/]?");
//$NON-NLS-1$//$NON-NLS-2$
-
+
int count_old = 0;
int count_new = 0;
int last_index = 0;
@@ -228,16 +228,16 @@
}
assertTrue(count_new == count_old);
}
-
+
private void checkPaths(Path truePath) throws CoreException{
String newPath = (String)
testStrConfig.getNewAttribute(IConsoleConfigurationLaunchConstants.CFG_XML_FILE);
assertEquals(truePath.makeAbsolute(), new Path(newPath).makeAbsolute());
newPath = (String) ((List)
testStrListConfig.getNewAttribute(IConsoleConfigurationLaunchConstants.FILE_MAPPINGS)).get(0);
assertEquals(truePath.makeAbsolute(), new Path(newPath).makeAbsolute());
}
-
+
private Path generateNewPathForSegment(int segmentNum){
- assertTrue(Messages.REFACTORINGTEST_SEGMENTNUM_TOO_MATCH, segmentNum <
oldPathElements.length);
+ assertTrue(ConsoleTestMessages.RefactoringTest_segmentnum_too_match, segmentNum <
oldPathElements.length);
String newPath = ""; //$NON-NLS-1$
for (int i = 0; i < segmentNum; i++) {
newPath += oldPathElements[i] + "/"; //$NON-NLS-1$
@@ -245,18 +245,18 @@
newPath += newPathElements[segmentNum];
return new Path(newPath);
}
-
+
private Path generateOldPathForSegment(int segmentNum){
- assertTrue(Messages.REFACTORINGTEST_SEGMENTNUM_TOO_MATCH, segmentNum <
oldPathElements.length);
+ assertTrue(ConsoleTestMessages.RefactoringTest_segmentnum_too_match, segmentNum <
oldPathElements.length);
String oldPathPart = ""; //$NON-NLS-1$
for (int i = 0; i <= segmentNum; i++) {
oldPathPart += oldPathElements[i] + "/"; //$NON-NLS-1$
}
return new Path(oldPathPart);
}
-
+
private Path generateTruePathForSegment(int segmentNum){
- assertTrue(Messages.REFACTORINGTEST_SEGMENTNUM_TOO_MATCH, segmentNum <
oldPathElements.length);
+ assertTrue(ConsoleTestMessages.RefactoringTest_segmentnum_too_match, segmentNum <
oldPathElements.length);
String newPath = ""; //$NON-NLS-1$
for (int i = 0; i < oldPathElements.length; i++) {
if (i != segmentNum){
@@ -266,14 +266,14 @@
}
return new Path(newPath);
}
-
-//====================================================================================
+
+//====================================================================================
class TestWorkingCopy implements ILaunchConfigurationWorkingCopy{
-
+
private TestLaunchConfig parent;
-
+
private Map<String, Object> attributes = new HashMap<String, Object>();
-
+
TestWorkingCopy(TestLaunchConfig parent){
this.parent = parent;
}
@@ -287,23 +287,23 @@
public boolean hasAttribute(String attributeName)
throws CoreException {
- fail(Messages.REFACTORINGTEST_METHOD_NOT_TESTED);
+ fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
return false;
}
-
+
public Object removeAttribute(String attributeName) {
- fail(Messages.REFACTORINGTEST_METHOD_NOT_TESTED);
+ fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
return null;
}
- public ILaunchConfiguration getOriginal() {
+ public ILaunchConfiguration getOriginal() {
return parent;
}
- public ILaunchConfigurationWorkingCopy getParent() {
+ public ILaunchConfigurationWorkingCopy getParent() {
return null;
}
- public boolean isDirty() {
+ public boolean isDirty() {
return true;
}
@@ -321,66 +321,66 @@
attributes.put(attributeName, value);
}
- public void setAttribute(String attributeName, Map value)
{fail(Messages.REFACTORINGTEST_METHOD_NOT_TESTED);}
+ public void setAttribute(String attributeName, Map value)
{fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
- public void setAttribute(String attributeName, boolean value)
{fail(Messages.REFACTORINGTEST_METHOD_NOT_TESTED);}
+ public void setAttribute(String attributeName, boolean value)
{fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
- public void setAttributes(Map attributes)
{ fail(Messages.REFACTORINGTEST_METHOD_NOT_TESTED);}
+ public void setAttributes(Map attributes)
{ fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
- public void setContainer(IContainer container)
{fail(Messages.REFACTORINGTEST_METHOD_NOT_TESTED);}
+ public void setContainer(IContainer container)
{fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
- public void setMappedResources(IResource[] resources)
{fail(Messages.REFACTORINGTEST_METHOD_NOT_TESTED);}
+ public void setMappedResources(IResource[] resources)
{fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
- public void setModes(Set modes) {fail(Messages.REFACTORINGTEST_METHOD_NOT_TESTED);}
+ public void setModes(Set modes)
{fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
- public void setPreferredLaunchDelegate(Set modes, String delegateId)
{fail(Messages.REFACTORINGTEST_METHOD_NOT_TESTED);}
+ public void setPreferredLaunchDelegate(Set modes, String delegateId)
{fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
- public boolean contentsEqual(ILaunchConfiguration configuration) {
+ public boolean contentsEqual(ILaunchConfiguration configuration) {
return false;
}
public ILaunchConfigurationWorkingCopy copy(String name)
throws CoreException {
- fail(Messages.REFACTORINGTEST_METHOD_NOT_TESTED);
+ fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
return null;
}
public void delete() throws CoreException {}
- public boolean exists() {
+ public boolean exists() {
return false;
}
public boolean getAttribute(String attributeName, boolean defaultValue)
- throws CoreException {
+ throws CoreException {
return parent.getAttribute(attributeName, defaultValue);
}
public int getAttribute(String attributeName, int defaultValue)
- throws CoreException {
- fail(Messages.REFACTORINGTEST_METHOD_NOT_TESTED);
+ throws CoreException {
+ fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
return 0;
}
public List getAttribute(String attributeName, List defaultValue)
- throws CoreException {
+ throws CoreException {
return parent.getAttribute(attributeName, defaultValue);
}
public Set getAttribute(String attributeName, Set defaultValue)
- throws CoreException {
- fail(Messages.REFACTORINGTEST_METHOD_NOT_TESTED);
+ throws CoreException {
+ fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
return null;
}
public Map getAttribute(String attributeName, Map defaultValue)
- throws CoreException {
- fail(Messages.REFACTORINGTEST_METHOD_NOT_TESTED);
+ throws CoreException {
+ fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
return null;
}
public String getAttribute(String attributeName, String defaultValue)
- throws CoreException {
+ throws CoreException {
return parent.getAttribute(attributeName, defaultValue);
}
@@ -388,102 +388,102 @@
return attributes;
}
- public String getCategory() throws CoreException {
+ public String getCategory() throws CoreException {
return parent.getCategory();
}
- public IFile getFile() {
+ public IFile getFile() {
return null;
}
- public IPath getLocation() {
+ public IPath getLocation() {
return null;
}
- public IResource[] getMappedResources() throws CoreException {
+ public IResource[] getMappedResources() throws CoreException {
return null;
}
- public String getMemento() throws CoreException {
+ public String getMemento() throws CoreException {
return null;
}
- public Set getModes() throws CoreException {
+ public Set getModes() throws CoreException {
return null;
}
- public String getName() {
+ public String getName() {
return null;
}
public ILaunchDelegate getPreferredDelegate(Set modes)
- throws CoreException {
+ throws CoreException {
return null;
}
- public ILaunchConfigurationType getType() throws CoreException {
+ public ILaunchConfigurationType getType() throws CoreException {
return null;
}
public ILaunchConfigurationWorkingCopy getWorkingCopy()
- throws CoreException {
+ throws CoreException {
return null;
}
- public boolean isLocal() {
+ public boolean isLocal() {
return false;
}
- public boolean isMigrationCandidate() throws CoreException {
+ public boolean isMigrationCandidate() throws CoreException {
return false;
}
- public boolean isReadOnly() {
+ public boolean isReadOnly() {
return false;
}
- public boolean isWorkingCopy() {
+ public boolean isWorkingCopy() {
return false;
}
public ILaunch launch(String mode, IProgressMonitor monitor)
- throws CoreException {
+ throws CoreException {
return null;
}
public ILaunch launch(String mode, IProgressMonitor monitor,
- boolean build) throws CoreException {
+ boolean build) throws CoreException {
return null;
}
public ILaunch launch(String mode, IProgressMonitor monitor,
- boolean build, boolean register) throws CoreException {
+ boolean build, boolean register) throws CoreException {
return null;
}
public void migrate() throws CoreException {}
- public boolean supportsMode(String mode) throws CoreException {
+ public boolean supportsMode(String mode) throws CoreException {
return false;
}
- public Object getAdapter(Class adapter) {
+ public Object getAdapter(Class adapter) {
return null;
}
-
+
}
-
+
class TestLaunchConfig implements ILaunchConfiguration{
-
+
private Map<String, Object> attributes = new HashMap<String, Object>();
-
+
public Map<String, Object> updatedAttributes = new HashMap<String,
Object>();
-
+
// returns updated attribute
public Object getNewAttribute(String attributeName){
- return updatedAttributes.get(attributeName);
+ return updatedAttributes.get(attributeName);
}
-
+
TestLaunchConfig(Map<String, Object> attributes){
if (attributes != null){
this.attributes = attributes;
@@ -500,7 +500,7 @@
}
public void delete() throws CoreException {
-
+
}
public boolean exists() {
@@ -520,7 +520,7 @@
throws CoreException {
return attributes.containsKey(attributeName);
}
-
+
public int getAttribute(String attributeName, int defaultValue)
throws CoreException {
if (attributes.containsKey(attributeName)){
@@ -556,14 +556,14 @@
} else {
return defaultValue;
}
- }
+ }
public Map getAttributes() throws CoreException {
return null;
}
public String getCategory() throws CoreException {
- return Messages.REFACTORINGTEST_CATEGORY;
+ return ConsoleTestMessages.RefactoringTest_category;
}
public IFile getFile() {
@@ -587,7 +587,7 @@
}
public String getName() {
- return Messages.REFACTORINGTEST_TEST_LAUNCH_CONFIG;
+ return ConsoleTestMessages.RefactoringTest_test_launch_config;
}
public ILaunchDelegate getPreferredDelegate(Set modes)
@@ -636,7 +636,7 @@
}
public void migrate() throws CoreException {
-
+
}
public boolean supportsMode(String mode) throws CoreException {
@@ -646,8 +646,8 @@
public Object getAdapter(Class adapter) {
return null;
}
-
-
+
+
};
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -29,17 +29,18 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.hibernate.eclipse.console.HibernateConsolePerspectiveFactory;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
public class HibernateAllMappingTests extends TestCase {
private MappingTestProject project;
-
+
private static IPackageFragment activePackage;
public HibernateAllMappingTests(String name) {
super(name);
}
-
+
private TestResult result = null;
protected void setUp() throws Exception {
@@ -48,22 +49,22 @@
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().setPerspective(
PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId("org.eclipse.ui.resourcePerspective"));
//$NON-NLS-1$
-
- IPackagesViewPart packageExplorer = null;
+
+ IPackagesViewPart packageExplorer = null;
try {
packageExplorer = (IPackagesViewPart) PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().showView(JavaUI.ID_PACKAGES);
} catch (PartInitException e) {
throw new RuntimeException(e);
}
-
+
packageExplorer.selectAndReveal(project.getIJavaProject());
-
+
PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().setPerspective(
PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(HibernateConsolePerspectiveFactory.ID_CONSOLE_PERSPECTIVE));
-
+
waitForJobs();
runTestsAfterSetup();
ProjectUtil.createConsoleCFG();
@@ -82,13 +83,13 @@
*/
@Override
public void run(TestResult result) {
- this.result = result;
+ this.result = result;
super.run(result);
- }
-
- public void tearDown() throws Exception {
+ }
+
+ public void tearDown() throws Exception {
waitForJobs();
- runTestsBeforeTearDown();
+ runTestsBeforeTearDown();
waitForJobs();
delay(1000);
//this.project.deleteIProject();
@@ -100,13 +101,13 @@
TestSuite suite = TestSetBeforeTearDown.getTests();
for (int i = 0; i < suite.testCount(); i++) {
Test test = suite.testAt(i);
- test.run(result);
- }
+ test.run(result);
+ }
}
/**
* Process UI input but do not return for the specified time interval.
- *
+ *
* @param waitTimeMillis
* the number of milliseconds
*/
@@ -142,16 +143,16 @@
while (Platform.getJobManager().currentJob() != null)
delay(1000);
}
-
+
protected MappingTestProject getProject() {
return this.project;
- }
-
+ }
+
public void testEachPackWithTestSet() throws JavaModelException {
long start_time = System.currentTimeMillis();
TestSuite suite = TestSet.getTests();
int pack_count = 0;
- IPackageFragmentRoot[] roots =
project.getIJavaProject().getAllPackageFragmentRoots();
+ IPackageFragmentRoot[] roots = project.getIJavaProject().getAllPackageFragmentRoots();
for (int i = 0; i < roots.length; i++) {
if (roots[i].getClass() != PackageFragmentRoot.class) continue;
PackageFragmentRoot packageFragmentRoot = (PackageFragmentRoot) roots[i];
@@ -166,15 +167,15 @@
!Pattern.matches(Customization.TEST_PACKS_PATTERN, javaElement.getElementName())){
continue;
}
-
- long st_pack_time = System.currentTimeMillis();
- int prev_failCount = result.failureCount();
+
+ long st_pack_time = System.currentTimeMillis();
+ int prev_failCount = result.failureCount();
int prev_errCount = result.errorCount();
if (Customization.SHOW_EACH_TEST) suite = TestSet.getTests();
-
+
activePackage = pack;
- //==============================
+ //==============================
//run all tests for package
for (int k = 0; k < suite.testCount(); k++) {
Test test = suite.testAt(k);
@@ -184,32 +185,32 @@
//==============================
pack_count++;
if (Customization.USE_CONSOLE_OUTPUT){
- System.out.print( result.errorCount() - prev_errCount +
Messages.HIBERNATEALLMAPPINGTESTS_ERRORS + " \t"); //$NON-NLS-1$
- System.out.print( result.failureCount() - prev_failCount +
Messages.HIBERNATEALLMAPPINGTESTS_FAILS + "\t"); //$NON-NLS-1$
+ System.out.print( result.errorCount() - prev_errCount +
ConsoleTestMessages.HibernateAllMappingTests_errors + " \t"); //$NON-NLS-1$
+ System.out.print( result.failureCount() - prev_failCount +
ConsoleTestMessages.HibernateAllMappingTests_fails + "\t"); //$NON-NLS-1$
long period = System.currentTimeMillis() - st_pack_time;
String time = period / 1000 + "." + (period % 1000) / 100; //$NON-NLS-1$
- System.out.println( time +Messages.HIBERNATEALLMAPPINGTESTS_SECONDS +
javaElement.getElementName());
+ System.out.println( time +ConsoleTestMessages.HibernateAllMappingTests_seconds +
javaElement.getElementName());
}
waitForJobs();
delay(Customization.EACTH_PACK_TEST_DELAY);
-
+
if (Customization.STOP_AFTER_MISSING_PACK){
if (result.failureCount() > prev_failCount) break;
}
prev_failCount = result.failureCount();
prev_errCount = result.errorCount();
- }
- }
+ }
+ }
}
if (Customization.USE_CONSOLE_OUTPUT){
System.out.println(
"====================================================="); //$NON-NLS-1$
- System.out.print( result.errorCount() + Messages.HIBERNATEALLMAPPINGTESTS_ERRORS +
" \t"); //$NON-NLS-1$
- System.out.print( result.failureCount() + Messages.HIBERNATEALLMAPPINGTESTS_FAILS +
"\t"); //$NON-NLS-1$
- System.out.print(( System.currentTimeMillis() - start_time ) / 1000 +
Messages.HIBERNATEALLMAPPINGTESTS_SECONDS + "\t" ); //$NON-NLS-1$
- System.out.println( pack_count + Messages.HIBERNATEALLMAPPINGTESTS_PACKAGES_TESTED );
+ System.out.print( result.errorCount() +
ConsoleTestMessages.HibernateAllMappingTests_errors + " \t"); //$NON-NLS-1$
+ System.out.print( result.failureCount() +
ConsoleTestMessages.HibernateAllMappingTests_fails + "\t"); //$NON-NLS-1$
+ System.out.print(( System.currentTimeMillis() - start_time ) / 1000 +
ConsoleTestMessages.HibernateAllMappingTests_seconds + "\t" ); //$NON-NLS-1$
+ System.out.println( pack_count +
ConsoleTestMessages.HibernateAllMappingTests_packages_tested );
}
- waitForJobs();
-
+ waitForJobs();
+
delay(Customization.AFTER_ALL_PACKS_DELAY);
}
@@ -220,4 +221,3 @@
return activePackage;
}
}
-
\ No newline at end of file
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestProject.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestProject.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestProject.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -41,6 +41,8 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.core.PackageFragmentRoot;
+import org.eclipse.osgi.util.NLS;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
import org.hibernate.eclipse.console.test.HibernateConsoleTestPlugin;
@@ -49,23 +51,23 @@
*
*/
public class MappingTestProject{
-
+
public static final String SRC_FOLDER = "src"; //$NON-NLS-1$
-
+
public static final String LIB_FOLDER = "lib"; //$NON-NLS-1$
private static MappingTestProject singleton= null;
-
+
private static final Path JRE_CONTAINER = new
Path("org.eclipse.jdt.launching.JRE_CONTAINER"); //$NON-NLS-1$
-
+
public static String PROJECT_NAME = "MappingTestProject"; //$NON-NLS-1$
public static String RESOURCE_PATH = "res/project/"; //$NON-NLS-1$
-
+
private static FileFilter fileFilter = new FileFilter(){
public boolean accept(File pathname) {
return !pathname.isDirectory();
}};
-
+
private static FileFilter dirFilter = new FileFilter(){
public boolean accept(File pathname) {
//exclude ".svn" and other unnessesary folders
@@ -73,22 +75,22 @@
if (LIB_FOLDER.equals(pathname.getName())) return false;
return pathname.isDirectory();
}};
-
+
private static FileFilter jarFilter = new FileFilter(){
public boolean accept(File pathname) {
return !pathname.isDirectory() || pathname.getName().endsWith(".jar");
//$NON-NLS-1$
}};
-
+
private IProject project;
private IJavaProject javaProject;
-
+
public static MappingTestProject getTestProject(){
if (singleton == null){
singleton = new MappingTestProject();
}
return singleton;
- }
-
+ }
+
private MappingTestProject() {
initialize();
}
@@ -96,7 +98,7 @@
private void initialize(){
try{
buildBigTestProject();
- }catch(Exception e){
+ }catch(Exception e){
throw new RuntimeException(e);
}
}
@@ -104,34 +106,37 @@
public IProject getIProject(){
return this.project;
}
-
+
public IJavaProject getIJavaProject(){
return this.javaProject;
}
-
+
public void deleteIProject() throws CoreException {
project.delete(true, true, null);
}
-
+
private void buildBigTestProject() throws JavaModelException, CoreException, IOException
{
project = buildNewProject(PROJECT_NAME);
javaProject = buildJavaProject(project);
-
+
IPath resourcePath = new Path(RESOURCE_PATH);
File resourceFolder = resourcePath.toFile();
URL entry =
HibernateConsoleTestPlugin.getDefault().getBundle().getEntry(RESOURCE_PATH);
URL resProject = FileLocator.resolve(entry);
String tplPrjLcStr= FileLocator.resolve(resProject).getFile();
resourceFolder = new File(tplPrjLcStr);
- if (!resourceFolder.exists())
- throw new RuntimeException(Messages.MAPPINGTESTPROJECT_FOLDER + RESOURCE_PATH +
Messages.MAPPINGTESTPROJECT_NOT_FOUND);
-
+ if (!resourceFolder.exists()) {
+ String out = NLS.bind(ConsoleTestMessages.MappingTestProject_folder_not_found,
+ RESOURCE_PATH);
+ throw new RuntimeException(out);
+ }
+
IPackageFragmentRoot sourceFolder = createSourceFolder(project, javaProject);
recursiveCopyFiles(resourceFolder, (IFolder) sourceFolder.getResource());
List<IPath> libs = copyLibs(resourceFolder);
generateClassPath(libs, sourceFolder);
project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
- }
+ }
private void recursiveCopyFiles(File src, IFolder dst){
File[] files = src.listFiles(fileFilter);
@@ -147,9 +152,9 @@
} catch (CoreException e) {
e.printStackTrace();
continue;
- }
+ }
}
-
+
File[] dirs = src.listFiles(dirFilter);
for (int i = 0; i < dirs.length; i++) {
File dir = dirs[i];
@@ -162,39 +167,42 @@
e.printStackTrace();
continue;
}
- }
+ }
}
-
- private List<IPath> copyLibs(File res) throws CoreException {
+
+ private List<IPath> copyLibs(File res) throws CoreException {
IFolder dst = project.getFolder(LIB_FOLDER);
if (!dst.exists()){
dst.create(false, true, null);
javaProject.getPackageFragmentRoot(dst);
}
-
+
File libFolder = new File(res.getAbsolutePath()+"/" + LIB_FOLDER);
//$NON-NLS-1$
- if ( !libFolder.exists() )
- throw new RuntimeException(Messages.MAPPINGTESTPROJECT_FOLDER + RESOURCE_PATH +
"/" + LIB_FOLDER + Messages.MAPPINGTESTPROJECT_NOT_FOUND); //$NON-NLS-1$
-
-
+ if ( !libFolder.exists() ) {
+ String out = NLS.bind(ConsoleTestMessages.MappingTestProject_folder_not_found,
+ RESOURCE_PATH + "/" + LIB_FOLDER); //$NON-NLS-1$
+ throw new RuntimeException(out);
+ }
+
+
List<IPath> libs = new ArrayList<IPath>();
-
+
File[] files = libFolder.listFiles(jarFilter);
for (int i = 0; i < files.length; i++) {
File file = files[i];
if (!file.exists()) continue;
IFile iFile = dst.getFile(file.getName());
try {
- iFile.create(new FileInputStream(file), true, null);
+ iFile.create(new FileInputStream(file), true, null);
libs.add(iFile.getFullPath());
} catch (FileNotFoundException e) {
e.printStackTrace();
continue;
- }
- }
+ }
+ }
return libs;
}
-
+
private void generateClassPath(List<IPath> libs, IPackageFragmentRoot
sourceFolder) throws JavaModelException{
List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
//entries.addAll(Arrays.asList(javaProject.getRawClasspath()));
@@ -205,8 +213,8 @@
entries.add(JavaCore.newContainerEntry(JRE_CONTAINER));
javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[0]), null);
}
-
+
private IProject buildNewProject(String projectName) {
// get a project handle
final IProject newProjectHandle = ResourcesPlugin.getWorkspace()
@@ -240,7 +248,7 @@
} catch (CoreException ce) {
throw new RuntimeException(ce);
}
-
+
javaProject.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
javaProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM,
JavaCore.VERSION_1_5);
javaProject.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
@@ -268,9 +276,9 @@
}
return javaProject.getPackageFragmentRoot(folder);
}
-
-
+
+
/*private boolean removePackage(String name, IProject project,
IJavaProject javaProject) {
IFolder folder = project.getFolder("src");
@@ -283,17 +291,17 @@
return false;
}
return true;
- }
+ }
return false;
}
-
+
/*private IPackageFragment buildPackage(String name, IProject project,
IJavaProject javaProject) throws CoreException {
IPackageFragmentRoot sourceFolder = buildSourceFolder(project,
javaProject);
return sourceFolder.createPackageFragment(name, false, null);
}
-
+
private IType[] buildTypes(IProject project, IJavaProject javaProject, CompilationPack
compPack) throws CoreException
/*throws CoreException*/ //{
@@ -302,9 +310,9 @@
/*IPackageFragment jPack = buildPackage(compPack.getPack(), project, javaProject);
ICompilationUnit cu = null;//jPack.createCompilationUnit(cuName,
//"", false, null);
-
+
List<IType> result = new ArrayList<IType>();
-
+
InputStream is;
try {
File[] files = compPack.getFiles();
@@ -313,31 +321,31 @@
is = new FileInputStream(files[i]);
String fileBody = getStringFromStream(is);
- //ASTParser parser = ASTParser.newParser(AST.JLS3);
- //parser.setSource(fileBody.toCharArray());
+ //ASTParser parser = ASTParser.newParser(AST.JLS3);
+ //parser.setSource(fileBody.toCharArray());
//CompilationUnit cu2 = (CompilationUnit) parser.createAST(null);
String cuName = files[i].getName();
-
+
try {
cu = jPack.createCompilationUnit(cuName, fileBody, false, null);
result.addAll(Arrays.asList(cu.getAllTypes()));
- } catch (JavaModelException e) {
+ } catch (JavaModelException e) {
e.printStackTrace();
System.out.println("Error compiling file " +
files[i].getAbsolutePath());
- }
- }
+ }
+ }
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
- }
+ }
for (int i = 0; i < result.size(); i++) {
System.out.println(((IType)result.get(i)).getElementName());
- }
+ }
return (IType[])result.toArray(new IType[0]);
- }
-
+ }
+
public static String getStringFromStream (InputStream is)
throws IOException
{
@@ -356,28 +364,28 @@
if (null != is) is.close();
}
}
-
+
private void createCompilationPacks(File pack, List<CompilationPack> compPacks,
String packName){
if (pack.isDirectory()){
if (packName.length() != 0) packName += '.';
packName += pack.getName();
-
+
File[] files = pack.listFiles(fileFilter);
if (files.length > 0) compPacks.add(new CompilationPack(packName, files));
-
+
File[] dirs = pack.listFiles(dirFilter);
for (int i = 0; i < dirs.length; i++) {
createCompilationPacks(dirs[i], compPacks, packName);
}
}
}
-
+
public class CompilationPack {
-
+
private String pack = null;
-
+
private File[] files = null;
-
+
CompilationPack (String pack, File[] files){
this.pack = pack;
this.files = files;
@@ -389,7 +397,7 @@
public File[] getFiles() {
return files;
- }
+ }
}*/
}
Deleted:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Messages.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Messages.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Messages.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -1,44 +0,0 @@
-package org.hibernate.eclipse.console.test.mappingproject;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME =
"org.hibernate.eclipse.console.test.mappingproject.messages"; //$NON-NLS-1$
- public static String HIBERNATEALLMAPPINGTESTS_ERRORS;
- public static String HIBERNATEALLMAPPINGTESTS_FAILS;
- public static String HIBERNATEALLMAPPINGTESTS_PACKAGES_TESTED;
- public static String HIBERNATEALLMAPPINGTESTS_SECONDS;
- public static String MAPPINGTESTPROJECT_FOLDER;
- public static String MAPPINGTESTPROJECT_NOT_FOUND;
- public static String OPENJAVAEDITORS_ERROR_OPENNING_COMPILATIONUNIT;
- public static String OPENMAPPINGDIAGRAMTEST_CANNOT_BE_OPENED;
- public static String OPENMAPPINGDIAGRAMTEST_MAPPING_DIAGRAMM_FOR;
- public static String OPENMAPPINGDIAGRAMTEST_MAPPING_DIAGRAMMS_FOR_PACKAGE;
- public static String OPENMAPPINGDIAGRAMTEST_NOT_OPENED;
- public static String OPENMAPPINGFILETEST_CANNOT_BE_OPENED;
- public static String OPENMAPPINGFILETEST_HIGHLIGHTED_REGION_FOR;
- public static String OPENMAPPINGFILETEST_HIGHLIGHTED_REGION_FOR_PROPERTY;
- public static String OPENMAPPINGFILETEST_IS_EMPTY_PACKAGE;
- public static String OPENMAPPINGFILETEST_MAPPING_FILE_FOR;
- public static String OPENMAPPINGFILETEST_MAPPING_FILE_FOR_PROPERTY;
- public static String OPENMAPPINGFILETEST_MAPPING_FILES_FOR_PACKAGE;
- public static String OPENMAPPINGFILETEST_NOT_OPENED_PACKAGE;
- public static String OPENSOURCEFILETEST_CANNOT_BE_OPENED;
- public static String OPENSOURCEFILETEST_HIGHLIGHTED_REGION_FOR;
- public static String OPENSOURCEFILETEST_IS_EMPTY;
- public static String OPENSOURCEFILETEST_MAPPING_FILE_FOR;
- public static String OPENSOURCEFILETEST_NOT_OPENED;
- public static String OPENSOURCEFILETEST_SOURCE_FILES_FOR_PACKAGE;
- public static String PROJECTUTIL_CANNOT_GET_ERROR_FIELD_FROM_ERROREDITORPART;
- public static String PROJECTUTIL_CANNOT_GET_EXCEPTION_FROM_ERROREDITORPART;
- public static String TESTSET_TEST_FOR_MAPPINGTESTPROJECT;
- public static String UPDATECONFIGURATIONTEST_ERROR_CUSTOMISING;
- public static String UPDATECONFIGURATIONTEST_FILE_FOR_PACKAGE;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenJavaEditors.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenJavaEditors.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenJavaEditors.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -24,6 +24,7 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
/**
* @author Dmitry Geraskov
@@ -31,11 +32,11 @@
* just to test that our external Unit tests work right with MappingTestProject
*/
public class OpenJavaEditors extends TestCase {
-
+
public void testOpenJavaEditor() throws JavaModelException {
MappingTestProject mapProject = MappingTestProject.getTestProject();
-
- IPackageFragmentRoot[] roots =
mapProject.getIJavaProject().getAllPackageFragmentRoots();
+
+ IPackageFragmentRoot[] roots =
mapProject.getIJavaProject().getAllPackageFragmentRoots();
for (int i = 0; i < roots.length; i++) {
if (roots[i].getClass() != PackageFragmentRoot.class) continue;
PackageFragmentRoot packageFragmentRoot = (PackageFragmentRoot) roots[i];
@@ -46,15 +47,15 @@
ICompilationUnit[] cus = ((IPackageFragment)javaElement).getCompilationUnits();
for (int k = 0; k < cus.length; k++) {
ICompilationUnit compilationUnit = cus[k];
- FileEditorInput input = new FileEditorInput((IFile)
compilationUnit.getCorrespondingResource());
+ FileEditorInput input = new FileEditorInput((IFile)
compilationUnit.getCorrespondingResource());
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input,
JavaUI.ID_CU_EDITOR );
} catch (PartInitException e) {
- fail(Messages.OPENJAVAEDITORS_ERROR_OPENNING_COMPILATIONUNIT + e.getMessage());
+ fail(ConsoleTestMessages.OpenJavaEditors_error_openning_compilationunit +
e.getMessage());
}
}
}
- }
+ }
}
//PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -12,6 +12,7 @@
import junit.framework.TestCase;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.hibernate.InvalidMappingException;
@@ -19,6 +20,7 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
import org.hibernate.eclipse.console.workbench.ConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter;
import org.hibernate.mapping.PersistentClass;
@@ -41,29 +43,33 @@
assertTrue(configs[0] instanceof Configuration);
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
} catch (InvalidMappingException ex){
- fail(Messages.OPENMAPPINGDIAGRAMTEST_MAPPING_DIAGRAMMS_FOR_PACKAGE +
HibernateAllMappingTests.getActivePackage().getElementName()
- + Messages.OPENMAPPINGDIAGRAMTEST_CANNOT_BE_OPENED + ex.getMessage());
+ String out =
NLS.bind(ConsoleTestMessages.OpenMappingDiagramTest_mapping_diagrams_for_package_cannot_be_opened,
+ new Object[]{HibernateAllMappingTests.getActivePackage().getElementName(),
ex.getMessage()});
+ fail(out);
}
-
+
if (persClasses.length > 0){
for (int i = 0; i < persClasses.length; i++) {
assertTrue(persClasses[0] instanceof PersistentClass);
PersistentClass persClass = (PersistentClass) persClasses[i];
-
+
IEditorPart editor = null;
Throwable ex = null;
try {
editor = new OpenDiagramActionDelegate().openEditor(persClass, consCFG);
} catch (PartInitException e) {
ex = e;
- }
- if (ex == null ) ex = ProjectUtil.getExceptionIfItOccured(editor);
- if (ex != null) fail(Messages.OPENMAPPINGDIAGRAMTEST_MAPPING_DIAGRAMM_FOR +
persClass.getClassName()
- + Messages.OPENMAPPINGDIAGRAMTEST_NOT_OPENED + ex.getMessage());
- }
+ }
+ if (ex == null ) ex = ProjectUtil.getExceptionIfItOccured(editor);
+ if (ex != null) {
+ String out =
NLS.bind(ConsoleTestMessages.OpenMappingDiagramTest_mapping_diagram_for_not_opened,
+ new Object[]{persClass.getClassName(), ex.getMessage()});
+ fail(out);
+ }
+ }
}
//close all editors
}
-
+
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -19,6 +19,7 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.MultiPageEditorPart;
@@ -28,6 +29,7 @@
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.console.actions.OpenMappingAction;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
import org.hibernate.eclipse.console.workbench.ConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.PersistentClassWorkbenchAdapter;
@@ -40,7 +42,7 @@
*
*/
public class OpenMappingFileTest extends TestCase {
-
+
public void testOpenMappingFileTest() {
KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
final ConsoleConfiguration consCFG =
knownConfigurations.find(ProjectUtil.ConsoleCFGName);
@@ -54,8 +56,9 @@
assertTrue(configs[0] instanceof Configuration);
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
} catch (InvalidMappingException ex){
- fail(Messages.OPENMAPPINGFILETEST_MAPPING_FILES_FOR_PACKAGE +
HibernateAllMappingTests.getActivePackage().getElementName()
- + Messages.OPENMAPPINGFILETEST_CANNOT_BE_OPENED + ex.getMessage());
+ String out =
NLS.bind(ConsoleTestMessages.OpenMappingFileTest_mapping_files_for_package_cannot_be_opened,
+ new Object[]{HibernateAllMappingTests.getActivePackage().getElementName(),
ex.getMessage()});
+ fail(out);
}
if (persClasses.length > 0){
for (int i = 0; i < persClasses.length; i++) {
@@ -77,16 +80,18 @@
}
//close all editors
}
-
+
private void openPropertyTest(Property compositeProperty, Property parentProperty,
ConsoleConfiguration consCFG){
IEditorPart editor = null;
Throwable ex = null;
try {
editor = OpenMappingAction.run(compositeProperty, parentProperty, consCFG);
boolean highlighted = ProjectUtil.checkHighlighting(editor);
- if (!highlighted)
- fail(Messages.OPENMAPPINGFILETEST_HIGHLIGHTED_REGION_FOR_PROPERTY +
compositeProperty.getNodeName() + Messages.OPENMAPPINGFILETEST_IS_EMPTY_PACKAGE
- + HibernateAllMappingTests.getActivePackage().getElementName() + ")");
//$NON-NLS-1$
+ if (!highlighted) {
+ String out =
NLS.bind(ConsoleTestMessages.OpenMappingFileTest_highlighted_region_for_property_is_empty_package,
+ new Object[]{compositeProperty.getNodeName(),
HibernateAllMappingTests.getActivePackage().getElementName()});
+ fail(out);
+ }
Object[] compProperties = new
PropertyWorkbenchAdapter().getChildren(compositeProperty);
for (int k = 0; k < compProperties.length; k++) {
//test Composite properties
@@ -100,34 +105,42 @@
ex = e;
} catch (FileNotFoundException e) {
ex = e;
- }
+ }
if (ex == null ) ex = ProjectUtil.getExceptionIfItOccured(editor);
- if (ex != null) fail(Messages.OPENMAPPINGFILETEST_MAPPING_FILE_FOR_PROPERTY +
compositeProperty.getNodeName() + Messages.OPENMAPPINGFILETEST_NOT_OPENED_PACKAGE
- + HibernateAllMappingTests.getActivePackage().getElementName() + ")\n" +
ex.getMessage()); //$NON-NLS-1$
+ if (ex != null) {
+ String out =
NLS.bind(ConsoleTestMessages.OpenMappingFileTest_mapping_file_for_property_not_opened_package,
+ new Object[]{compositeProperty.getNodeName(),
HibernateAllMappingTests.getActivePackage().getElementName(), ex.getMessage()});
+ fail(out);
+ }
}
-
+
private void openTest(Object selection, ConsoleConfiguration consCFG){
IEditorPart editor = null;
Throwable ex = null;
try {
editor = OpenMappingAction.run(selection, consCFG);
boolean highlighted = ProjectUtil.checkHighlighting(editor);
- if (!highlighted)
- fail(Messages.OPENMAPPINGFILETEST_HIGHLIGHTED_REGION_FOR + selection +
Messages.OPENMAPPINGFILETEST_IS_EMPTY_PACKAGE
- + HibernateAllMappingTests.getActivePackage().getElementName() + ")");
//$NON-NLS-1$
+ if (!highlighted) {
+ String out =
NLS.bind(ConsoleTestMessages.OpenMappingFileTest_highlighted_region_for_is_empty_package,
+ new Object[]{selection,
HibernateAllMappingTests.getActivePackage().getElementName()});
+ fail(out);
+ }
} catch (PartInitException e) {
ex = e;
} catch (JavaModelException e) {
ex = e;
} catch (FileNotFoundException e) {
ex = e;
- }
+ }
if (ex == null ) ex = ProjectUtil.getExceptionIfItOccured(editor);
- if (ex != null) fail(Messages.OPENMAPPINGFILETEST_MAPPING_FILE_FOR + selection +
Messages.OPENMAPPINGFILETEST_NOT_OPENED_PACKAGE
- + HibernateAllMappingTests.getActivePackage().getElementName() + ") :\n" +
ex.getMessage()); //$NON-NLS-1$
+ if (ex != null) {
+ String out =
NLS.bind(ConsoleTestMessages.OpenMappingFileTest_mapping_file_for_not_opened_package,
+ new Object[]{selection,
HibernateAllMappingTests.getActivePackage().getElementName(), ex.getMessage()});
+ fail(out);
+ }
}
-
-
+
+
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -15,6 +15,7 @@
import junit.framework.TestCase;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.hibernate.InvalidMappingException;
@@ -22,6 +23,7 @@
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.console.actions.OpenSourceAction;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
import org.hibernate.eclipse.console.workbench.ConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.PersistentClassWorkbenchAdapter;
@@ -35,7 +37,7 @@
*
*/
public class OpenSourceFileTest extends TestCase {
-
+
public void testOpenSourceFileTest() {
//fail("test fail");
KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
@@ -50,8 +52,9 @@
assertTrue(configs[0] instanceof Configuration);
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
} catch (InvalidMappingException ex){
- fail(Messages.OPENSOURCEFILETEST_SOURCE_FILES_FOR_PACKAGE +
HibernateAllMappingTests.getActivePackage().getElementName()
- + Messages.OPENSOURCEFILETEST_CANNOT_BE_OPENED + ex.getMessage());
+ String out =
NLS.bind(ConsoleTestMessages.OpenSourceFileTest_source_files_for_package_cannot_be_opened,
+ HibernateAllMappingTests.getActivePackage().getElementName(), ex.getMessage());
+ fail(out);
}
if (persClasses.length > 0){
for (int i = 0; i < persClasses.length; i++) {
@@ -69,7 +72,7 @@
if (fields[j] instanceof Property
&& ((Property)fields[j]).isComposite()) {
fullyQualifiedName =((Component)((Property)
fields[j]).getValue()).getComponentClassName();
-
+
Object[] compProperties = new PropertyWorkbenchAdapter().getChildren(fields[j]);
for (int k = 0; k < compProperties.length; k++) {
if (compProperties[k].getClass() != Property.class) continue;
@@ -83,27 +86,33 @@
//close all editors
}
-
+
private void openTest(Object selection, ConsoleConfiguration consCFG, String
fullyQualifiedName){
IEditorPart editor = null;
Throwable ex = null;
try {
- editor = new OpenSourceAction().run(selection,
MappingTestProject.getTestProject().getIJavaProject(),
+ editor = new OpenSourceAction().run(selection,
MappingTestProject.getTestProject().getIJavaProject(),
fullyQualifiedName);
boolean highlighted = ProjectUtil.checkHighlighting(editor);
- if (!highlighted) fail(Messages.OPENSOURCEFILETEST_HIGHLIGHTED_REGION_FOR + selection
+ Messages.OPENSOURCEFILETEST_IS_EMPTY);
+ if (!highlighted) {
+ String out =
NLS.bind(ConsoleTestMessages.OpenSourceFileTest_highlighted_region_for_is_empty,
selection);
+ fail(out);
+ }
} catch (PartInitException e) {
ex = e;
} catch (JavaModelException e) {
ex = e;
} catch (FileNotFoundException e) {
ex = e;
- }
+ }
if (ex == null ) ex = ProjectUtil.getExceptionIfItOccured(editor);
- if (ex != null) fail(Messages.OPENSOURCEFILETEST_MAPPING_FILE_FOR +
fullyQualifiedName/*.getClassName()*/
- + Messages.OPENSOURCEFILETEST_NOT_OPENED + ex.getMessage());
+ if (ex != null) {
+ String out =
NLS.bind(ConsoleTestMessages.OpenSourceFileTest_mapping_file_for_not_opened,
+ fullyQualifiedName/*.getClassName()*/, ex.getMessage());
+ fail(out);
+ }
}
-
-
+
+
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/ProjectUtil.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/ProjectUtil.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/ProjectUtil.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -31,6 +31,7 @@
import org.eclipse.ui.part.MultiPageEditorPart;
import org.eclipse.ui.texteditor.ITextEditor;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
import org.hibernate.eclipse.console.wizards.ConsoleConfigurationCreationWizard;
import org.hibernate.mapping.PersistentClass;
@@ -39,26 +40,26 @@
*
*/
public class ProjectUtil {
-
+
private static final StringBuilder XML_HEADER = new StringBuilder("<?xml
version=\"1.0\" encoding=\"UTF-8\"?>\n") //$NON-NLS-1$
.append("<!DOCTYPE hibernate-configuration PUBLIC\n")
//$NON-NLS-1$
.append("\"-//Hibernate/Hibernate Configuration DTD
3.0//EN\"\n") //$NON-NLS-1$
.append("\"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd\">\n");
//$NON-NLS-1$
-
+
private static final StringBuilder XML_CFG_START = new
StringBuilder("<hibernate-configuration>\n") //$NON-NLS-1$
.append("<session-factory>\n") //$NON-NLS-1$
.append("<property name=\"hibernate.dialect\">")
//$NON-NLS-1$
.append(Customization.HIBERNATE_DIALECT)
.append("</property>"); //$NON-NLS-1$
-
+
private static final StringBuilder XML_CFG_END = new
StringBuilder("</session-factory>\n") //$NON-NLS-1$
.append("</hibernate-configuration>\n"); //$NON-NLS-1$
-
-
+
+
public static final String CFG_FILE_NAME = "hibernate.cfg.xml"; //$NON-NLS-1$
-
+
public static final String ConsoleCFGName = "testConfigName"; //$NON-NLS-1$
-
+
public static void customizeCFGFileForPack(IPackageFragment pack) throws CoreException{
IFolder srcFolder = (IFolder) pack.getParent().getResource();
IFile iFile = srcFolder.getFile(CFG_FILE_NAME);
@@ -76,7 +77,7 @@
}
}
}
- }
+ }
/*if (pack.getCompilationUnits().length > 0){
ICompilationUnit[] comps = pack.getCompilationUnits();
for (int i = 0; i < comps.length; i++) {
@@ -95,25 +96,25 @@
iFile.create(new StringInputStream(file_body),
true, null);
}
-
+
public static String getPersistentClassName(PersistentClass persClass) {
if (persClass == null) {
return ""; //$NON-NLS-1$
- } else {
+ } else {
return persClass.getEntityName() != null ? persClass.getEntityName() :
persClass.getClassName();
}
}
-
+
public static void createConsoleCFG() throws CoreException{
new ConsoleConfigurationCreationWizard2().run();
}
-
+
private static class ConsoleConfigurationCreationWizard2 extends
ConsoleConfigurationCreationWizard{
-
+
public void run() throws CoreException {
IPath cfgFilePath = new Path(MappingTestProject.PROJECT_NAME + "/" +
//$NON-NLS-1$
MappingTestProject.SRC_FOLDER + "/" + ProjectUtil.CFG_FILE_NAME);
//$NON-NLS-1$
- createConsoleConfiguration(null, null, ConsoleCFGName,
ConsoleConfigurationPreferences.ConfigurationMode.CORE,
+ createConsoleConfiguration(null, null, ConsoleCFGName,
ConsoleConfigurationPreferences.ConfigurationMode.CORE,
MappingTestProject.PROJECT_NAME, true, "", //$NON-NLS-1$
null, cfgFilePath, new Path[0], new Path[0], "", "", new
NullProgressMonitor()); //$NON-NLS-1$//$NON-NLS-2$
@@ -121,12 +122,12 @@
}
/**
* Sometimes we have exceptions while opening editors.
- * IDE catches this exceptions and opens ErrorEditorPart instead of
+ * IDE catches this exceptions and opens ErrorEditorPart instead of
* our editor. To be sure that editor opened without exception use this method.
* It gets occurred exception from the editor if it was and passes it up.
- *
+ *
* @param editor
- * @return
+ * @return
* @throws Throwable
*/
public static Throwable getExceptionIfItOccured(IEditorPart editor){
@@ -135,9 +136,9 @@
Field field;
try {
field = clazz.getDeclaredField("error"); //$NON-NLS-1$
-
+
field.setAccessible(true);
-
+
Object error = field.get(editor);
if (error instanceof IStatus) {
IStatus err_status = (IStatus) error;
@@ -147,18 +148,18 @@
}
// catch close means that exception occurred but we can't get it
} catch (SecurityException e) {
- return new
RuntimeException(Messages.PROJECTUTIL_CANNOT_GET_EXCEPTION_FROM_ERROREDITORPART +
e.getMessage());
+ return new
RuntimeException(ConsoleTestMessages.ProjectUtil_cannot_get_exception_from_erroreditorpart
+ e.getMessage());
} catch (NoSuchFieldException e) {
- return new
RuntimeException(Messages.PROJECTUTIL_CANNOT_GET_ERROR_FIELD_FROM_ERROREDITORPART +
e.getMessage());
+ return new
RuntimeException(ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart
+ e.getMessage());
} catch (IllegalArgumentException e) {
- return new
RuntimeException(Messages.PROJECTUTIL_CANNOT_GET_ERROR_FIELD_FROM_ERROREDITORPART +
e.getMessage()); //$NON-NLS-1$
+ return new
RuntimeException(ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart
+ e.getMessage());
} catch (IllegalAccessException e) {
- return new
RuntimeException(Messages.PROJECTUTIL_CANNOT_GET_ERROR_FIELD_FROM_ERROREDITORPART +
e.getMessage()); //$NON-NLS-1$
+ return new
RuntimeException(ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart
+ e.getMessage());
}
}
return null;
}
-
+
public static boolean checkHighlighting(IEditorPart editor){
ITextEditor[] tEditors = getTextEditors(editor);
boolean highlighted = false;
@@ -172,8 +173,8 @@
}
return highlighted;
}
-
-
+
+
/**
* Should be identical with OpenMappingAction.getTextEditors()
* @param editorPart
@@ -181,7 +182,7 @@
*/
public static ITextEditor[] getTextEditors(IEditorPart editorPart) {
if (editorPart instanceof MultiPageEditorPart) {
- List testEditors = new ArrayList();
+ List testEditors = new ArrayList();
IEditorPart[] editors = ((MultiPageEditorPart)
editorPart).findEditors(editorPart.getEditorInput());
for (int i = 0; i < editors.length; i++) {
if (editors[i] instanceof ITextEditor){
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.hibernate.eclipse.console.test.mappingproject;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+
import junit.framework.TestSuite;
/**
@@ -18,31 +20,31 @@
*/
public class TestSet{
- /**
+ /**
* use only addTestSuit to prevent errors!!!
* @return
*/
public static TestSuite getTests(){
- TestSuite suite = new TestSuite(Messages.TESTSET_TEST_FOR_MAPPINGTESTPROJECT );
-
+ TestSuite suite = new
TestSuite(ConsoleTestMessages.TestSet_test_for_mappingtestproject);
+
addTestsPackSetUp( suite );
addPackTests( suite );
- addTestsPackTearDown( suite );
-
+ addTestsPackTearDown( suite );
+
return suite;
}
-
-
- private static void addTestsPackSetUp(TestSuite suite){
+
+
+ private static void addTestsPackSetUp(TestSuite suite){
suite.addTestSuite( UpdateConfigurationTest.class );
}
-
+
private static void addPackTests(TestSuite suite){
suite.addTestSuite( OpenSourceFileTest.class );
suite.addTestSuite( OpenMappingFileTest.class );
suite.addTestSuite( OpenMappingDiagramTest.class );
}
-
+
private static void addTestsPackTearDown(TestSuite suite){
suite.addTestSuite( CloseAllEditorsTest.class );
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSetAfterSetup.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSetAfterSetup.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSetAfterSetup.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -11,6 +11,8 @@
package org.hibernate.eclipse.console.test.mappingproject;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+
import junit.framework.TestSuite;
/**
@@ -19,7 +21,7 @@
*/
public class TestSetAfterSetup {
public static TestSuite getTests(){
- TestSuite suite = new TestSuite(Messages.TESTSET_TEST_FOR_MAPPINGTESTPROJECT );
+ TestSuite suite = new
TestSuite(ConsoleTestMessages.TestSet_test_for_mappingtestproject);
suite.addTestSuite( HibernateNatureAddTest.class );
//suite.addTestSuite( CreateConsoleConfigTest.class );
return suite;
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSetBeforeTearDown.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSetBeforeTearDown.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSetBeforeTearDown.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.hibernate.eclipse.console.test.mappingproject;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+
import junit.framework.TestSuite;
/**
@@ -18,9 +20,9 @@
*/
public class TestSetBeforeTearDown {
public static TestSuite getTests(){
- TestSuite suite = new TestSuite(Messages.TESTSET_TEST_FOR_MAPPINGTESTPROJECT );
+ TestSuite suite = new TestSuite(ConsoleTestMessages.TestSet_test_for_mappingtestproject
);
suite.addTestSuite( HibernateNatureRemoveTest.class );
-
+
return suite;
}
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/UpdateConfigurationTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/UpdateConfigurationTest.java 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/UpdateConfigurationTest.java 2008-06-06
16:51:10 UTC (rev 8613)
@@ -15,13 +15,15 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.osgi.util.NLS;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
/**
* @author Dmitry Geraskov
*
*/
public class UpdateConfigurationTest extends TestCase {
-
+
public void testUpdateConfiguration() throws JavaModelException{
//fail("test fail");
IPackageFragment pack = HibernateAllMappingTests.getActivePackage();
@@ -29,8 +31,9 @@
try {
ProjectUtil.customizeCFGFileForPack(pack);
} catch (CoreException e) {
- fail(Messages.UPDATECONFIGURATIONTEST_ERROR_CUSTOMISING + ProjectUtil.CFG_FILE_NAME +
Messages.UPDATECONFIGURATIONTEST_FILE_FOR_PACKAGE
- + pack.getPath() + ".\n" + e.getMessage()); //$NON-NLS-1$
+ String out =
NLS.bind(ConsoleTestMessages.UpdateConfigurationTest_error_customising_file_for_package,
+ new Object[] { ProjectUtil.CFG_FILE_NAME, pack.getPath(), e.getMessage() } );
+ fail(out);
}
}
}
Deleted:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/messages.properties
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/messages.properties 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/messages.properties 2008-06-06
16:51:10 UTC (rev 8613)
@@ -1,30 +0,0 @@
-HIBERNATEALLMAPPINGTESTS_ERRORS=\ errors.
-HIBERNATEALLMAPPINGTESTS_FAILS=\ fails.
-HIBERNATEALLMAPPINGTESTS_PACKAGES_TESTED=\ packages tested.
-HIBERNATEALLMAPPINGTESTS_SECONDS=\ sec.
-MAPPINGTESTPROJECT_FOLDER=Folder
-MAPPINGTESTPROJECT_NOT_FOUND=\ not found\!
-OPENJAVAEDITORS_ERROR_OPENNING_COMPILATIONUNIT=Error opening CompilationUnit:
-OPENMAPPINGDIAGRAMTEST_CANNOT_BE_OPENED=\ can't be opened:\n
-OPENMAPPINGDIAGRAMTEST_MAPPING_DIAGRAMM_FOR=Mapping Diagramm for
-OPENMAPPINGDIAGRAMTEST_MAPPING_DIAGRAMMS_FOR_PACKAGE=Mapping Diagramms for package
-OPENMAPPINGDIAGRAMTEST_NOT_OPENED=\ not opened:\n
-OPENMAPPINGFILETEST_CANNOT_BE_OPENED=\ can't be opened:\n
-OPENMAPPINGFILETEST_HIGHLIGHTED_REGION_FOR=Highlighted region for
-OPENMAPPINGFILETEST_HIGHLIGHTED_REGION_FOR_PROPERTY=Highlighted region for property
-OPENMAPPINGFILETEST_IS_EMPTY_PACKAGE=\ is empty. (package
-OPENMAPPINGFILETEST_MAPPING_FILE_FOR=Mapping file for
-OPENMAPPINGFILETEST_MAPPING_FILE_FOR_PROPERTY=Mapping file for property
-OPENMAPPINGFILETEST_MAPPING_FILES_FOR_PACKAGE=Mapping Files for package
-OPENMAPPINGFILETEST_NOT_OPENED_PACKAGE=\ not opened: (package
-OPENSOURCEFILETEST_CANNOT_BE_OPENED=\ can't be opened:\n
-OPENSOURCEFILETEST_HIGHLIGHTED_REGION_FOR=Highlighted region for
-OPENSOURCEFILETEST_IS_EMPTY=\ is empty.
-OPENSOURCEFILETEST_MAPPING_FILE_FOR=Mapping file for
-OPENSOURCEFILETEST_NOT_OPENED=\ not opened:\n
-OPENSOURCEFILETEST_SOURCE_FILES_FOR_PACKAGE=Source files for package
-PROJECTUTIL_CANNOT_GET_ERROR_FIELD_FROM_ERROREDITORPART=Can't get error field from
ErrorEditorPart.
-PROJECTUTIL_CANNOT_GET_EXCEPTION_FROM_ERROREDITORPART=Can't get exception from
ErrorEditorPart.
-TESTSET_TEST_FOR_MAPPINGTESTPROJECT=Test for MappingTestProject
-UPDATECONFIGURATIONTEST_ERROR_CUSTOMISING=Error customising
-UPDATECONFIGURATIONTEST_FILE_FOR_PACKAGE=\ file for package
Deleted:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/messages.properties
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/messages.properties 2008-06-06
16:50:40 UTC (rev 8612)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/messages.properties 2008-06-06
16:51:10 UTC (rev 8613)
@@ -1,21 +0,0 @@
-BEANSHELLINTEGRATIONTEST_RESULT=Result:
-CONSOLECONFIGTEST_FACTORY_ALREADY_EXISTS=Should throw an exception because a factory
already exists\!
-CONSOLECONFIGTEST_FAKE_PREFS=fake prefs
-CONSOLEPLUGINALLTESTS_TEST_FOR=Test for org.hibernate.eclipse.console.test
-HIBERNATECONSOLETEST_LONG_RUNNING_TASK_DETECTED=A long running task detected
-KNOWNCONFIGURATIONSTEST_FAKE_PREFS=fake prefs
-KNOWNCONFIGURATIONSTEST_NEW_TEST=new test
-KNOWNCONFIGURATIONSTEST_NO_SF_SHOULD_BE_BUILD=no sf should be built\!
-KNOWNCONFIGURATIONSTEST_NO_SF_SHOULD_BE_CLOSED=no sf should be closed\!
-KNOWNCONFIGURATIONSTEST_TRYING_REMOVE_NON_EXISTING_CONSOLE=trying to remove a non
existing console
-PERSPECTIVETEST_HIBERNATE=Hibernate
-REFACTORINGTEST_CATEGORY=Category
-REFACTORINGTEST_COREEXCEPTION_OCCURED_WORK_WITH_MEMENTO=CoreException occured when try to
work with memento.
-REFACTORINGTEST_EXCEPTION_WHILE_FILENAMECHANGE_REFACTOR=Exception while FileNameChange
refactor processing\!
-REFACTORINGTEST_EXCEPTION_WHILE_FINDCHANGE_LAUNCH_CONFIG_PROCESSING=Exception while
FindChanged launch configurations processing\!
-REFACTORINGTEST_EXCEPTION_WHILE_PACKNAMECHANGE_REFACTOR=Exception while PackNameChange
refactor processing\!
-REFACTORINGTEST_EXCEPTION_WHILE_PROJNAMECHANGE_REFACTOR=Exception while ProjectNameChange
refactor processing\!
-REFACTORINGTEST_EXCEPTION_WHILE_SRCNAMECHANGE_REFACTOR=Exception while SrcNameChange
refactor processing\!
-REFACTORINGTEST_METHOD_NOT_TESTED=Method doesn't tested
-REFACTORINGTEST_SEGMENTNUM_TOO_MATCH=SegmentNum is too mach.
-REFACTORINGTEST_TEST_LAUNCH_CONFIG=Test Launch Config