[jboss-cvs] JBossAS SVN: r71254 - in projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src: main/org/jboss/aop/microcontainer/beans/metadata and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Mar 25 14:51:43 EDT 2008
Author: kabir.khan at jboss.com
Date: 2008-03-25 14:51:43 -0400 (Tue, 25 Mar 2008)
New Revision: 71254
Added:
projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DeclareDefinition.java
projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AbstractDeclareBeanMetaDataFactory.java
projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DeclareErrorBeanMetaDataFactory.java
projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DeclareWarningBeanMetaDataFactory.java
projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DeclareAopTestCase.xml
projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DeclareBeansTestCase.xml
projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DeclareDeploymentTestCase.xml
projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareAopTestCase.java
projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareBeansTestCase.java
projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareDeploymentTestCase.java
projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareTest.java
Modified:
projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AOPDeployment.java
projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DomainBeanMetaDataFactory.java
projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/main/schema/aop-beans_1_0.xsd
Log:
[JBAOP-468] Add declare-error + declare-warning and tests
Added: projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DeclareDefinition.java
===================================================================
--- projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DeclareDefinition.java (rev 0)
+++ projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DeclareDefinition.java 2008-03-25 18:51:43 UTC (rev 71254)
@@ -0,0 +1,131 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.aop.microcontainer.beans;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.pointcut.DeclareDef;
+import org.jboss.aop.pointcut.ast.ParseException;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class DeclareDefinition
+{
+ AspectManager manager;
+
+ String name;
+
+ String expr;
+
+ String message;
+
+ boolean isWarning;
+
+ public AspectManager getManager()
+ {
+ return manager;
+ }
+
+ public void setManager(AspectManager manager)
+ {
+ this.manager = manager;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getExpr()
+ {
+ return expr;
+ }
+
+ public void setExpr(String expr)
+ {
+ this.expr = expr;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage(String warning)
+ {
+ this.message = warning;
+ }
+
+ public boolean isWarning()
+ {
+ return isWarning;
+ }
+
+ public void setWarning(boolean isWarning)
+ {
+ this.isWarning = isWarning;
+ }
+
+ public void start()
+ {
+ if (name == null || name.length() == 0)
+ {
+ throw new IllegalArgumentException("Null name");
+ }
+ if (manager == null)
+ {
+ throw new IllegalArgumentException("Null manager");
+ }
+ if (expr == null)
+ {
+ throw new IllegalArgumentException("Null expr");
+ }
+ if (message == null)
+ {
+ throw new IllegalArgumentException("Null message");
+ }
+
+ try
+ {
+ DeclareDef def = new DeclareDef(name, expr, isWarning, message);
+ manager.addDeclare(def);
+ }
+ catch(ParseException e)
+ {
+ throw new IllegalArgumentException("The expression '" + expr + "' did not parse", e);
+ }
+ }
+
+ public void stop()
+ {
+ manager.removeDeclare(name);
+ }
+
+
+}
Modified: projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AOPDeployment.java
===================================================================
--- projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AOPDeployment.java 2008-03-25 18:13:40 UTC (rev 71253)
+++ projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AOPDeployment.java 2008-03-25 18:51:43 UTC (rev 71254)
@@ -59,6 +59,8 @@
@XmlElement(name="aspect", type=AspectBeanMetaDataFactory.class),
@XmlElement(name="bind", type=BindBeanMetaDataFactory.class),
@XmlElement(name="cflow-stack", type=CFlowStackBeanMetaDataFactory.class),
+ @XmlElement(name="declare-error", type=DeclareErrorBeanMetaDataFactory.class),
+ @XmlElement(name="declare-warning", type=DeclareWarningBeanMetaDataFactory.class),
@XmlElement(name="dynamic-cflow", type=DynamicCflowBeanMetaDataFactory.class),
@XmlElement(name="domain", type=DomainBeanMetaDataFactory.class),
@XmlElement(name="interceptor", type=InterceptorBeanMetaDataFactory.class),
Added: projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AbstractDeclareBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AbstractDeclareBeanMetaDataFactory.java (rev 0)
+++ projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AbstractDeclareBeanMetaDataFactory.java 2008-03-25 18:51:43 UTC (rev 71254)
@@ -0,0 +1,90 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.aop.microcontainer.beans.metadata;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlValue;
+
+import org.jboss.aop.microcontainer.beans.DeclareDefinition;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.util.id.GUID;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractDeclareBeanMetaDataFactory extends AspectManagerAwareBeanMetaDataFactory
+{
+ String expr;
+
+ String message;
+
+ public String getExpr()
+ {
+ return expr;
+ }
+
+ @XmlAttribute
+ public void setExpr(String expr)
+ {
+ this.expr = expr;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ @XmlValue
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
+
+ @Override
+ public List<BeanMetaData> getBeans()
+ {
+ ArrayList<BeanMetaData> beans = new ArrayList<BeanMetaData>();
+
+ if (name == null)
+ {
+ name = GUID.asString();
+ }
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, DeclareDefinition.class.getName());
+ builder.addPropertyMetaData("expr", expr);
+ builder.addPropertyMetaData("name", name);
+ builder.addPropertyMetaData("message", message);
+ builder.addPropertyMetaData("warning", isWarning());
+ setAspectManagerProperty(builder);
+
+ beans.add(builder.getBeanMetaData());
+
+ return beans;
+ }
+
+ protected abstract boolean isWarning();
+}
Added: projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DeclareErrorBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DeclareErrorBeanMetaDataFactory.java (rev 0)
+++ projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DeclareErrorBeanMetaDataFactory.java 2008-03-25 18:51:43 UTC (rev 71254)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.aop.microcontainer.beans.metadata;
+
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlRootElement(name="declare-error")
+public class DeclareErrorBeanMetaDataFactory extends AbstractDeclareBeanMetaDataFactory
+{
+ private static final long serialVersionUID = 1L;
+
+ protected boolean isWarning()
+ {
+ return false;
+ }
+
+}
Added: projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DeclareWarningBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DeclareWarningBeanMetaDataFactory.java (rev 0)
+++ projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DeclareWarningBeanMetaDataFactory.java 2008-03-25 18:51:43 UTC (rev 71254)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.aop.microcontainer.beans.metadata;
+
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlRootElement(name="declare-warning")
+public class DeclareWarningBeanMetaDataFactory extends AbstractDeclareBeanMetaDataFactory
+{
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected boolean isWarning()
+ {
+ return true;
+ }
+
+}
Modified: projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DomainBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DomainBeanMetaDataFactory.java 2008-03-25 18:13:40 UTC (rev 71253)
+++ projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DomainBeanMetaDataFactory.java 2008-03-25 18:51:43 UTC (rev 71254)
@@ -89,6 +89,8 @@
@XmlElement(name="arraybind", type=ArrayBindBeanMetaDataFactory.class),
@XmlElement(name="aspect", type=AspectBeanMetaDataFactory.class),
@XmlElement(name="bind", type=BindBeanMetaDataFactory.class),
+ @XmlElement(name="declare-error", type=DeclareErrorBeanMetaDataFactory.class),
+ @XmlElement(name="declare-warning", type=DeclareWarningBeanMetaDataFactory.class),
@XmlElement(name="dynamic-cflow", type=DynamicCflowBeanMetaDataFactory.class),
@XmlElement(name="cflow-stack", type=CFlowStackBeanMetaDataFactory.class),
@XmlElement(name="interceptor", type=InterceptorBeanMetaDataFactory.class),
Modified: projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/main/schema/aop-beans_1_0.xsd
===================================================================
--- projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/main/schema/aop-beans_1_0.xsd 2008-03-25 18:13:40 UTC (rev 71253)
+++ projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/main/schema/aop-beans_1_0.xsd 2008-03-25 18:51:43 UTC (rev 71254)
@@ -271,6 +271,8 @@
<xsd:element name="introduction" type="introductionType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="arrayreplacement" type="arrayreplacementType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="arraybind" type="arraybindType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="declare-error" type="declareType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="declare-warning" type="declareType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:any namespace="##other" processContents="strict" minOccurs="0">
<xsd:annotation>
<xsd:documentation>An extension value</xsd:documentation>
@@ -313,6 +315,8 @@
<xsd:element name="introduction" type="introductionType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="arrayreplacement" type="arrayreplacementType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="arraybind" type="arraybindType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="declare-error" type="declareType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="declare-warning" type="declareType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:choice>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="parentFirst" type="xsd:boolean" use="optional" default="false"/>
@@ -633,6 +637,42 @@
<xsd:attribute name="manager-property" type="xsd:string" use="optional"/>
</xsd:complexType>
+ <xsd:element name="declare-error" type="declareType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A declare error
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="declare-warning" type="declareType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A declare warning
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:complexType name="declareType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A dynamic cflow
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="expr" type="xsd:string" use="required"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
<xsd:element name="pointcut" type="pointcutType">
<xsd:annotation>
<xsd:documentation>
Added: projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DeclareAopTestCase.xml
===================================================================
--- projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DeclareAopTestCase.xml (rev 0)
+++ projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DeclareAopTestCase.xml 2008-03-25 18:51:43 UTC (rev 71254)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<aop xmlns="urn:jboss:aop-beans:1.0">
+
+ <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+ <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+ </bean>
+
+ <declare-error name="DeclareError" expr="call(* org.acme.Foo->error(..))">Error!!!</declare-error>
+
+ <declare-warning name="DeclareWarning" expr="call(* org.acme.Foo->warning(..))">Warning!!!</declare-warning>
+
+ <declare-error expr="call(* org.acme.Foo->anonymous(..))">Anon!!!</declare-error>
+
+</aop>
Added: projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DeclareBeansTestCase.xml
===================================================================
--- projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DeclareBeansTestCase.xml (rev 0)
+++ projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DeclareBeansTestCase.xml 2008-03-25 18:51:43 UTC (rev 71254)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+ <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+ </bean>
+
+ <bean name="DeclareError" class="org.jboss.aop.microcontainer.beans.DeclareDefinition">
+ <property name="manager"><inject bean="AspectManager"/></property>
+ <property name="name">DeclareError</property>
+ <property name="expr">call(* org.acme.Foo->error(..))</property>
+ <property name="message">Error!!!</property>
+ <property name="warning">false</property>
+ </bean>
+
+ <bean name="DeclareWarning" class="org.jboss.aop.microcontainer.beans.DeclareDefinition">
+ <property name="manager"><inject bean="AspectManager"/></property>
+ <property name="name">DeclareWarning</property>
+ <property name="expr">call(* org.acme.Foo->warning(..))</property>
+ <property name="message">Warning!!!</property>
+ <property name="warning">true</property>
+ </bean>
+
+ <bean name="DeclareErrorAnynomous" class="org.jboss.aop.microcontainer.beans.DeclareDefinition">
+ <property name="manager"><inject bean="AspectManager"/></property>
+ <property name="name">Some-GUID-Generated-by-xml-layer</property>
+ <property name="expr">call(* org.acme.Foo->anonymous(..))</property>
+ <property name="message">Anon!!!</property>
+ <property name="warning">false</property>
+ </bean>
+
+</deployment>
Added: projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DeclareDeploymentTestCase.xml
===================================================================
--- projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DeclareDeploymentTestCase.xml (rev 0)
+++ projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DeclareDeploymentTestCase.xml 2008-03-25 18:51:43 UTC (rev 71254)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+ <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+ </bean>
+
+ <declare-error xmlns="urn:jboss:aop-beans:1.0" name="DeclareError" expr="call(* org.acme.Foo->error(..))">Error!!!</declare-error>
+
+ <declare-warning xmlns="urn:jboss:aop-beans:1.0" name="DeclareWarning" expr="call(* org.acme.Foo->warning(..))">Warning!!!</declare-warning>
+
+ <declare-error xmlns="urn:jboss:aop-beans:1.0" expr="call(* org.acme.Foo->anonymous(..))">Anon!!!</declare-error>
+
+</deployment>
Added: projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareAopTestCase.java
===================================================================
--- projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareAopTestCase.java (rev 0)
+++ projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareAopTestCase.java 2008-03-25 18:51:43 UTC (rev 71254)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.microcontainer.beans.test;
+
+import junit.framework.Test;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class DeclareAopTestCase extends DeclareTest
+{
+ public DeclareAopTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(DeclareAopTestCase.class);
+ }
+}
Added: projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareBeansTestCase.java
===================================================================
--- projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareBeansTestCase.java (rev 0)
+++ projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareBeansTestCase.java 2008-03-25 18:51:43 UTC (rev 71254)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.microcontainer.beans.test;
+
+import junit.framework.Test;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class DeclareBeansTestCase extends DeclareTest
+{
+ public DeclareBeansTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(DeclareBeansTestCase.class);
+ }
+}
Added: projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareDeploymentTestCase.java
===================================================================
--- projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareDeploymentTestCase.java (rev 0)
+++ projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareDeploymentTestCase.java 2008-03-25 18:51:43 UTC (rev 71254)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.microcontainer.beans.test;
+
+import junit.framework.Test;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class DeclareDeploymentTestCase extends DeclareTest
+{
+ public DeclareDeploymentTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(DeclareDeploymentTestCase.class);
+ }
+}
Added: projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareTest.java
===================================================================
--- projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareTest.java (rev 0)
+++ projects/microcontainer/branches/jaxb-aop-mc-int/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DeclareTest.java 2008-03-25 18:51:43 UTC (rev 71254)
@@ -0,0 +1,83 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.microcontainer.beans.test;
+
+import java.util.Iterator;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.pointcut.DeclareDef;
+import org.jboss.test.aop.junit.AOPMicrocontainerTest;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class DeclareTest extends AOPMicrocontainerTest
+{
+ public DeclareTest(String name)
+ {
+ super(name);
+ }
+
+ public void testDeclares()
+ {
+ AspectManager manager = AspectManager.instance();
+
+ boolean doneAnonymous = false;
+ int i = 0;
+ Iterator<DeclareDef> it = manager.getDeclares();
+ while (it.hasNext())
+ {
+ DeclareDef def = it.next();
+ if (def.getName().equals("DeclareError"))
+ {
+ checkDeclare(def, false, "call(* org.acme.Foo->error(..))", "Error!!!");
+ }
+ else if (def.getName().equals("DeclareWarning"))
+ {
+ checkDeclare(def, true, "call(* org.acme.Foo->warning(..))", "Warning!!!");
+ }
+ else
+ {
+ //This one will have a GUID for its name when done from a deployment or aop xml
+ if (doneAnonymous)
+ {
+ fail("Already done an anonymous DeclareDef in the deployment");
+ }
+ checkDeclare(def, false, "call(* org.acme.Foo->anonymous(..))", "Anon!!!");
+ doneAnonymous = true;
+ }
+ i++;
+ }
+
+ assertEquals("Wrong number of DeclareDefs", 3, i);
+ }
+
+ private void checkDeclare(DeclareDef def, boolean isWarning, String expr, String msg)
+ {
+ assertEquals(isWarning, def.getWarning());
+ assertEquals(expr, def.getExpr());
+ assertEquals(msg, def.getMsg());
+ }
+
+}
More information about the jboss-cvs-commits
mailing list