[JBoss Seam] - Integration testing Seam components with Maven
by trent_j_rosenbaum
I have been able to use maven 2 to work with a Seam project. Deploying everything has been fine and I have been able to expand my project as I read the documentation further.
One area I am experiencing problems with is running Integration tests based on testng and the SeamTest class. I implemented the examples under section 31.2. of the documentation, but I keep getting the following stacktrace, (included below). I started to play around with the examples back with CR2 and then decided to wait for the GA release, but I still experience the same problems. I was wondering if someone could help me understand the nature of my problem?
javax.servlet.ServletException: ServletContext not allow to getResourceAsStream for /WEB-INF/web.xml
at org.ajax4jsf.webapp.WebXml.init(WebXml.java:113)
at org.ajax4jsf.resource.InternetResourceService.init(InternetResourceService.java:133)
at org.ajax4jsf.webapp.BaseFilter.init(BaseFilter.java:148)
at org.jboss.seam.web.Ajax4jsfFilter.init(Ajax4jsfFilter.java:86)
at org.jboss.seam.servlet.SeamFilter.init(SeamFilter.java:97)
at org.jboss.seam.mock.BaseSeamTest.createSeamFilter(BaseSeamTest.java:961)
at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:942)
at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:397)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:145)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:82)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:166)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
at org.testng.TestRunner.runWorkers(TestRunner.java:689)
at org.testng.TestRunner.privateRun(TestRunner.java:566)
at org.testng.TestRunner.run(TestRunner.java:466)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:301)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:296)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:276)
at org.testng.SuiteRunner.run(SuiteRunner.java:191)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:808)
at org.testng.TestNG.runSuitesLocally(TestNG.java:776)
at org.testng.TestNG.run(TestNG.java:701)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4102366#4102366
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4102366
18 years, 6 months
[JBoss jBPM] - Re: Token.signal() throws Exception from FieldInstantiator
by SidKennedy
I can't remove the xmlns because an exception is thrown otherwise.
Here's the code of the JpdlExecutionInvoker:
| public class JpdlExecutionInvoker implements ActionHandler {
|
| public void execute(ExecutionContext executionContext) throws Exception {
| try {
| // very project-specific statements
| Date startDate = executionContext.getProcessInstance().getStart();
| DataContainerManager dcManager = DataContainerManager
| .getInstanceFor(startDate);
| System.out.println(executionContext.getNode().getAction().getActionExpression());
| TTool toolXML = Tool.unmarshal(new StringReader(executionContext
| .getNode().getAction().getActionDelegation()
| .getConfiguration()));
|
| Display disp = Display.getCurrent();
| if (disp == null) {
| disp = new Display();
| }
| // execute Tool
| ITool tool = ToolFactory.createTool(toolXML);
|
| tool.execute(dcManager);
| IStatus status = tool.getExecutionStatus();
|
| // dependent on status, signal outgoing transition
| if (status.equals(IStatus.SUCCESS)) {
| String transition;
| if (status instanceof JPDLStatus) {
| transition = ((JPDLStatus) status).getTransition();
| } else {
| transition = "success";
| }
| executionContext.getToken().signal(transition);
| return;
| } else if (status.equals(IStatus.FAIL)) {
| String transition;
| if (status instanceof JPDLStatus) {
| transition = ((JPDLStatus) status).getTransition();
| } else {
| transition = "failure";
| }
| executionContext.getToken().signal(transition);
| return;
| } else {
| throw new IllegalArgumentException(
| "Unknown tool execution status " + status);
| }
| } catch (Exception e) {
| e.printStackTrace();
| throw e;
| }
| }
| }
| anonymous wrote :
| |
| | does it help you to locate my fault?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4102363#4102363
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4102363
18 years, 6 months
[JBoss Seam] - Seam-gen generates compile error
by sdthomas
I am attempting to reverse engineer a database with seam-gen/generate-entities. Everything is built correctly. But the isDefined() method in the generated TransectHome class incorrectly applies a Strings.isEmpty() method (the objects are not always Strings). Is this a bug?
Generated Pojo
@Entity
| @Table(name = "transect", schema = "public")
| public class Transect implements java.io.Serializable {
|
| private TransectId id;
|
| public Transect() {
| }
|
| public Transect(TransectId id) {
| this.id = id;
| }
|
| @EmbeddedId
| @AttributeOverrides({
| @AttributeOverride(name = "pkTransect", column = @Column(name = "pk_transect", nullable = false)),
| @AttributeOverride(name = "transectId", column = @Column(name = "transect_id")),
| @AttributeOverride(name = "transectName", column = @Column(name = "transect_name")),
| @AttributeOverride(name = "groupedData", column = @Column(name = "grouped_data")),
| @AttributeOverride(name = "plots", column = @Column(name = "plots"))})
| @NotNull
| public TransectId getId() {
| return this.id;
| }
|
| public void setId(TransectId id) {
| this.id = id;
| }
|
| }
Generated Id Class
@Embeddable
| public class TransectId implements java.io.Serializable {
|
| private int pkTransect;
| private Integer transectId;
| private String transectName;
| private Integer groupedData;
| private String plots;
|
| public TransectId() {
| }
|
| public TransectId(int pkTransect) {
| this.pkTransect = pkTransect;
| }
| public TransectId(int pkTransect, Integer transectId, String transectName,
| Integer groupedData, String plots) {
| this.pkTransect = pkTransect;
| this.transectId = transectId;
| this.transectName = transectName;
| this.groupedData = groupedData;
| this.plots = plots;
| }
|
| @Column(name = "pk_transect", nullable = false)
| @NotNull
| public int getPkTransect() {
| return this.pkTransect;
| }
|
| public void setPkTransect(int pkTransect) {
| this.pkTransect = pkTransect;
| }
|
| @Column(name = "transect_id")
| public Integer getTransectId() {
| return this.transectId;
| }
|
| public void setTransectId(Integer transectId) {
| this.transectId = transectId;
| }
|
| @Column(name = "transect_name")
| public String getTransectName() {
| return this.transectName;
| }
|
| public void setTransectName(String transectName) {
| this.transectName = transectName;
| }
|
| @Column(name = "grouped_data")
| public Integer getGroupedData() {
| return this.groupedData;
| }
|
| public void setGroupedData(Integer groupedData) {
| this.groupedData = groupedData;
| }
|
| @Column(name = "plots")
| public String getPlots() {
| return this.plots;
| }
|
| public void setPlots(String plots) {
| this.plots = plots;
| }
|
| public boolean equals(Object other) {
| if ((this == other))
| return true;
| if ((other == null))
| return false;
| if (!(other instanceof TransectId))
| return false;
| TransectId castOther = (TransectId) other;
|
| return (this.getPkTransect() == castOther.getPkTransect())
| && ((this.getTransectId() == castOther.getTransectId()) || (this
| .getTransectId() != null
| && castOther.getTransectId() != null && this
| .getTransectId().equals(castOther.getTransectId())))
| && ((this.getTransectName() == castOther.getTransectName()) || (this
| .getTransectName() != null
| && castOther.getTransectName() != null && this
| .getTransectName().equals(castOther.getTransectName())))
| && ((this.getGroupedData() == castOther.getGroupedData()) || (this
| .getGroupedData() != null
| && castOther.getGroupedData() != null && this
| .getGroupedData().equals(castOther.getGroupedData())))
| && ((this.getPlots() == castOther.getPlots()) || (this
| .getPlots() != null
| && castOther.getPlots() != null && this.getPlots()
| .equals(castOther.getPlots())));
| }
|
| public int hashCode() {
| int result = 17;
|
| result = 37 * result + this.getPkTransect();
| result = 37
| * result
| + (getTransectId() == null ? 0 : this.getTransectId()
| .hashCode());
| result = 37
| * result
| + (getTransectName() == null ? 0 : this.getTransectName()
| .hashCode());
| result = 37
| * result
| + (getGroupedData() == null ? 0 : this.getGroupedData()
| .hashCode());
| result = 37 * result
| + (getPlots() == null ? 0 : this.getPlots().hashCode());
| return result;
| }
|
| }
Generated Action Class
@Name("transectHome")
| public class TransectHome extends EntityHome<Transect> {
|
| public void setTransectId(TransectId id) {
| setId(id);
| }
|
| public TransectId getTransectId() {
| return (TransectId) getId();
| }
|
| public TransectHome() {
| setTransectId(new TransectId());
| }
|
| @Override
| public boolean isIdDefined() {
| if (getTransectId().getPkTransect() == 0)
| return false;
| if (Strings.isEmpty(getTransectId().getTransectId()))
| return false;
| if (Strings.isEmpty(getTransectId().getTransectName()))
| return false;
| if (Strings.isEmpty(getTransectId().getGroupedData()))
| return false;
| if (Strings.isEmpty(getTransectId().getPlots()))
| return false;
| return true;
| }
|
| @Override
| protected Transect createInstance() {
| Transect transect = new Transect();
| transect.setId(new TransectId());
| return transect;
| }
|
| public void wire() {
| }
|
| public boolean isWired() {
| return true;
| }
|
| public Transect getDefinedInstance() {
| return isIdDefined() ? getInstance() : null;
| }
|
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4102358#4102358
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4102358
18 years, 6 months