diff options
author | avasseur <avasseur> | 2005-05-04 14:42:14 +0000 |
---|---|---|
committer | avasseur <avasseur> | 2005-05-04 14:42:14 +0000 |
commit | cc7137d761b7232996f20b84958d9e714075d113 (patch) | |
tree | eefd46b79c9a84942c86e6288fe0749da89948d5 /loadtime/testsrc | |
parent | d5d800b24cd16c1bb8b99e3216b30b6b3fbb56a4 (diff) | |
download | aspectj-cc7137d761b7232996f20b84958d9e714075d113.tar.gz aspectj-cc7137d761b7232996f20b84958d9e714075d113.zip |
loadtime java1.3 module
Diffstat (limited to 'loadtime/testsrc')
4 files changed, 97 insertions, 0 deletions
diff --git a/loadtime/testsrc/LoadtimeModuleTests.java b/loadtime/testsrc/LoadtimeModuleTests.java new file mode 100644 index 000000000..4cf2326dc --- /dev/null +++ b/loadtime/testsrc/LoadtimeModuleTests.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2005 Contributors. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexandre Vasseur initial implementation + *******************************************************************************/ + +import junit.framework.TestCase; +import junit.framework.Test; +import junit.framework.TestSuite; +import junit.textui.TestRunner; +import org.aspectj.weaver.loadtime.test.DocumentParserTest; + +/** + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +public class LoadtimeModuleTests extends TestCase { + + public static Test suite() { + TestSuite suite = new TestSuite(LoadtimeModuleTests.class.getName()); + + suite.addTestSuite(DocumentParserTest.class); + + return suite; + } + + public static void main(String args[]) throws Throwable { + TestRunner.run(suite()); + } + +} diff --git a/loadtime/testsrc/org/aspectj/weaver/loadtime/test/DocumentParserTest.java b/loadtime/testsrc/org/aspectj/weaver/loadtime/test/DocumentParserTest.java new file mode 100644 index 000000000..c0f26ab99 --- /dev/null +++ b/loadtime/testsrc/org/aspectj/weaver/loadtime/test/DocumentParserTest.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2005 Contributors. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexandre Vasseur initial implementation + *******************************************************************************/ +package org.aspectj.weaver.loadtime.test; + +import junit.framework.TestCase; + +import java.net.URL; + +import org.aspectj.weaver.loadtime.definition.Definition; +import org.aspectj.weaver.loadtime.definition.DocumentParser; + +/** + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +public class DocumentParserTest extends TestCase { + + public void testSimple() throws Throwable { + URL url = DocumentParserTest.class.getResource("simple.xml"); + Definition def = DocumentParser.parse(url); + assertEquals("-showWeaveInfo", def.getWeaverOptions().trim()); + } + + public void testSimpleWithDtd() throws Throwable { + URL url = DocumentParserTest.class.getResource("simpleWithDtd.xml"); + Definition def = DocumentParser.parse(url); + assertEquals("-showWeaveInfo", def.getWeaverOptions().trim()); + assertTrue(def.getAspectClassNames().contains("test.Aspect")); + + assertEquals("foo..bar.Goo+", def.getIncludePatterns().get(0)); + assertEquals("@Baz", def.getAspectExcludePatterns().get(0)); + + } + +} diff --git a/loadtime/testsrc/org/aspectj/weaver/loadtime/test/simple.xml b/loadtime/testsrc/org/aspectj/weaver/loadtime/test/simple.xml new file mode 100644 index 000000000..54d3dd7af --- /dev/null +++ b/loadtime/testsrc/org/aspectj/weaver/loadtime/test/simple.xml @@ -0,0 +1,7 @@ +<aspectj> + <weaver options="-showWeaveInfo"> + </weaver> + <aspects> + <aspect name="test.Aspect"/> + </aspects> +</aspectj> diff --git a/loadtime/testsrc/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml b/loadtime/testsrc/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml new file mode 100644 index 000000000..03b77ff3c --- /dev/null +++ b/loadtime/testsrc/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://sswww.aspectj.org/dtd/aspectj_1_5_0.dtd"> +<aspectj> + <weaver options="-showWeaveInfo"> + <include within="foo..bar.Goo+"/> + </weaver> + <aspects> + <exclude within="@Baz"/> + <aspect name="test.Aspect"/> + </aspects> +</aspectj> |