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.

DocumentParserTest.java 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*******************************************************************************
  2. * Copyright (c) 2005 Contributors.
  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://eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * Alexandre Vasseur initial implementation
  11. *******************************************************************************/
  12. package org.aspectj.weaver.loadtime.test;
  13. import java.net.URL;
  14. import org.aspectj.weaver.loadtime.definition.Definition;
  15. import org.aspectj.weaver.loadtime.definition.DocumentParser;
  16. import junit.framework.TestCase;
  17. /**
  18. * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
  19. */
  20. public class DocumentParserTest extends TestCase {
  21. public void testSimple() throws Throwable {
  22. URL url = DocumentParserTest.class.getResource("simple.xml");
  23. Definition def = DocumentParser.parse(url);
  24. assertEquals("-showWeaveInfo", def.getWeaverOptions().trim());
  25. }
  26. public void testSimpleWithDtd() throws Throwable {
  27. URL url = DocumentParserTest.class.getResource("simpleWithDtd.xml");
  28. Definition def = DocumentParser.parse(url);
  29. assertEquals("-showWeaveInfo", def.getWeaverOptions().trim());
  30. assertTrue(def.getAspectClassNames().contains("test.Aspect"));
  31. assertEquals("foo..bar.Goo+", def.getIncludePatterns().get(0));
  32. assertEquals("@Baz", def.getAspectExcludePatterns().get(0));
  33. assertEquals("@Whoo", def.getAspectIncludePatterns().get(0));
  34. assertEquals("foo..*", def.getDumpPatterns().get(0));
  35. assertEquals(true,def.shouldDumpBefore());
  36. }
  37. }