-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from emmartins/AS7-3570
adding code that ensures ejb-name is set for ebj bound parsers, and a co...
- Loading branch information
Showing
4 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...jboss/metadata/ejb/test/parser/jboss/ejb3/AbstractEJBBoundMetaDataParserUnitTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2012, JBoss Inc., and individual contributors as indicated | ||
* by the @authors tag. See the copyright.txt 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.metadata.ejb.test.parser.jboss.ejb3; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import javax.xml.stream.XMLStreamException; | ||
|
||
import org.jboss.metadata.ejb.parser.jboss.ejb3.IIOPMetaDataParser; | ||
import org.jboss.metadata.ejb.parser.spec.AbstractMetaDataParser; | ||
import org.jboss.metadata.ejb.spec.EjbJarMetaData; | ||
import org.jboss.metadata.ejb.test.common.UnmarshallingHelper; | ||
import org.jboss.test.metadata.ejb.AbstractEJBEverythingTest; | ||
|
||
/** | ||
* Tests that AbstractEJBBoundMetaDataParser fails when ejb name is not set. | ||
* | ||
* More info at AS7-3570. | ||
* | ||
* @author Eduardo Martins | ||
*/ | ||
public class AbstractEJBBoundMetaDataParserUnitTestCase extends AbstractEJBEverythingTest { | ||
|
||
public AbstractEJBBoundMetaDataParserUnitTestCase(String name) { | ||
super(name); | ||
} | ||
|
||
public void testInvalidXML() throws Exception { | ||
IIOPMetaDataParser parser = new IIOPMetaDataParser(); | ||
Map<String, AbstractMetaDataParser<?>> parsers = new HashMap<String, AbstractMetaDataParser<?>>(); | ||
parsers.put("urn:iiop", parser); | ||
try { | ||
UnmarshallingHelper.unmarshalJboss(EjbJarMetaData.class, "../test/parser/jboss/ejb3/invalid-jboss-ejb3.xml", | ||
parsers); | ||
fail("The unmarshalling of the XML did not throw the expected expection"); | ||
} catch (XMLStreamException e) { | ||
|
||
} | ||
} | ||
|
||
public void testValidXML() throws Exception { | ||
IIOPMetaDataParser parser = new IIOPMetaDataParser(); | ||
Map<String, AbstractMetaDataParser<?>> parsers = new HashMap<String, AbstractMetaDataParser<?>>(); | ||
parsers.put("urn:iiop", parser); | ||
try { | ||
UnmarshallingHelper.unmarshalJboss(EjbJarMetaData.class, "../test/parser/jboss/ejb3/valid-jboss-ejb3.xml", parsers); | ||
} catch (Throwable e) { | ||
e.printStackTrace(); | ||
fail("The unmarshalling of the XML thrown an unexpected exception"); | ||
} | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
ejb/src/test/resources/org/jboss/metadata/ejb/test/parser/jboss/ejb3/invalid-jboss-ejb3.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0"?> | ||
<jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee" | ||
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:iiop="urn:iiop" | ||
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd | ||
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd" | ||
version="3.1" impl-version="2.0"> | ||
<assembly-descriptor> | ||
<iiop:ior-security-config> | ||
<!-- <ejb-name>X</ejb-name> --> | ||
</iiop:ior-security-config> | ||
</assembly-descriptor> | ||
</jboss:ejb-jar> |
13 changes: 13 additions & 0 deletions
13
ejb/src/test/resources/org/jboss/metadata/ejb/test/parser/jboss/ejb3/valid-jboss-ejb3.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0"?> | ||
<jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee" | ||
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:iiop="urn:iiop" | ||
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd | ||
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd" | ||
version="3.1" impl-version="2.0"> | ||
<assembly-descriptor> | ||
<iiop:ior-security-config> | ||
<ejb-name>X</ejb-name> | ||
</iiop:ior-security-config> | ||
</assembly-descriptor> | ||
</jboss:ejb-jar> |