You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /********************************************************************
  2. * Copyright (c) 2007 Contributors. All rights reserved.
  3. * This program and the accompanying materials are made available
  4. * under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution and is available at
  6. * http://eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors: IBM Corporation - initial API and implementation
  9. * Helen Hawkins - initial version (bug 148190)
  10. *******************************************************************/
  11. package org.aspectj.ajde;
  12. import org.aspectj.ajde.core.AjCompiler;
  13. /**
  14. * Tests ajde's management of the AjCompiler instances. Expect
  15. * there to be a different one for each .lst file and for ajde
  16. * to only remember the compiler for the last .lst file.
  17. */
  18. public class AjdeCompilerTests extends AjdeTestCase {
  19. protected void setUp() throws Exception {
  20. super.setUp();
  21. initialiseProject("LstBuildConfigManagerTest");
  22. }
  23. // Expect to get a different compiler instance for each
  24. // different config file
  25. public void testGetSameAjCompilerForSameConfigFiles() {
  26. AjCompiler c1 = getCompilerForConfigFileWithName("bad-injar.lst");
  27. AjCompiler c2 = getCompilerForConfigFileWithName("bad-injar.lst");
  28. assertEquals("expected the same AjCompiler instance to be returned" +
  29. " for the same configFile but found different ones", c1, c2);
  30. }
  31. // Expect to get a different compiler instance for each
  32. // different config file
  33. public void testGetDifferentAjCompilerForDifferentConfigFiles() {
  34. AjCompiler c1 = getCompilerForConfigFileWithName("bad-injar.lst");
  35. AjCompiler c2 = getCompilerForConfigFileWithName("dir-entry.lst");
  36. assertNotSame("expected different AjCompiler instances to be returned" +
  37. " for different configFiles but found the smae", c1, c2);
  38. }
  39. // want to keep the same setting regardless of the configFile
  40. // being built - therefore the same instance should be passed
  41. // from one AjCompiler instance to the next
  42. public void testSameCompilerConfigForDifferentConfigFiles() {
  43. AjCompiler c1 = getCompilerForConfigFileWithName("bad-injar.lst");
  44. AjCompiler c2 = getCompilerForConfigFileWithName("dir-entry.lst");
  45. assertEquals("expected the same compilerConfig instance to be associated" +
  46. " with the different AjCompiler's however found different ones",
  47. c1.getCompilerConfiguration(), c2.getCompilerConfiguration());
  48. }
  49. // want to have a different messageHandler instance for the different
  50. // config files - or we can just reset?!?! Resetting would be easier
  51. public void testSameMessageHandlerForDifferentConfigFiles() {
  52. AjCompiler c1 = getCompilerForConfigFileWithName("bad-injar.lst");
  53. AjCompiler c2 = getCompilerForConfigFileWithName("dir-entry.lst");
  54. assertEquals("expected the same messageHandler instance to be associated" +
  55. " with the different AjCompiler's however found different ones",
  56. c1.getMessageHandler(), c2.getMessageHandler());
  57. }
  58. // can have the same buildProgressMonitor for the different configFiles
  59. // because it holds no state
  60. public void testSameBuildProgressMonitorForDifferentConfigFiles() {
  61. AjCompiler c1 = getCompilerForConfigFileWithName("bad-injar.lst");
  62. AjCompiler c2 = getCompilerForConfigFileWithName("dir-entry.lst");
  63. assertEquals("expected the same buildProgressMonitor instance to be associated" +
  64. " with the different AjCompiler's however found different ones",
  65. c1.getBuildProgressMonitor(), c2.getBuildProgressMonitor());
  66. }
  67. }