Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

StructureModelUtilTest.java 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* *******************************************************************
  2. * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * Xerox/PARC initial implementation
  11. * Helen Hawkins Converted to new interface (bug 148190)
  12. * ******************************************************************/
  13. package org.aspectj.testing.util;
  14. import java.io.File;
  15. import java.util.List;
  16. import org.aspectj.ajde.core.AjdeCoreTestCase;
  17. import org.aspectj.ajde.core.TestCompilerConfiguration;
  18. import org.aspectj.asm.IProgramElement;
  19. import junit.framework.TestSuite;
  20. /**
  21. * @author Mik Kersten
  22. */
  23. public class StructureModelUtilTest extends AjdeCoreTestCase {
  24. private final String[] files = new String[] { "figures" + File.separator + "Debug.java",
  25. "figures" + File.separator + "Figure.java", "figures" + File.separator + "FigureElement.java",
  26. "figures" + File.separator + "Main.java", "figures" + File.separator + "composites" + File.separator + "Line.java",
  27. "figures" + File.separator + "composites" + File.separator + "Square.java",
  28. "figures" + File.separator + "primitives" + File.separator + "planar" + File.separator + "Point.java",
  29. "figures" + File.separator + "primitives" + File.separator + "solid" + File.separator + "SolidPoint.java" };
  30. public static TestSuite suite() {
  31. TestSuite result = new TestSuite();
  32. result.addTestSuite(StructureModelUtilTest.class);
  33. return result;
  34. }
  35. public void testPackageViewUtil() {
  36. List packages = StructureModelUtil.getPackagesInModel(getCompiler().getModel());
  37. assertTrue("packages list not null", packages != null);
  38. assertTrue("packages list not empty", !packages.isEmpty());
  39. IProgramElement packageNode = (IProgramElement) ((Object[]) packages.get(0))[0];
  40. assertTrue("package node not null", packageNode != null);
  41. List files = StructureModelUtil.getFilesInPackage(packageNode);
  42. assertTrue("fle list not null", files != null);
  43. // TODO: re-enable
  44. // Map lineAdviceMap = StructureModelUtil.getLinesToAspectMap(
  45. // ((IProgramElement)files.get(0)).getSourceLocation().getSourceFile().getAbsolutePath()
  46. // );
  47. //
  48. // assertTrue("line->advice map not null", lineAdviceMap != null);
  49. //
  50. // Set aspects = StructureModelUtil.getAspectsAffectingPackage(packageNode);
  51. // assertTrue("aspect list not null", aspects != null);
  52. }
  53. protected void setUp() throws Exception {
  54. super.setUp();
  55. initialiseProject("figures-coverage");
  56. TestCompilerConfiguration compilerConfig = (TestCompilerConfiguration) getCompiler().getCompilerConfiguration();
  57. compilerConfig.setProjectSourceFiles(getSourceFileList(files));
  58. doBuild();
  59. }
  60. protected void tearDown() throws Exception {
  61. super.tearDown();
  62. }
  63. }