Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'BaseArquillianTest' of https://github.com/smigielski/wi…
…cket into smigielski-BaseArquillianTest
- Loading branch information
Showing
23 changed files
with
1,197 additions
and
1 deletion.
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
67 changes: 67 additions & 0 deletions
67
mock/src/main/java/org/jboss/seam/wicket/mock/SeamTestRequestCycle.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,67 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2010, Red Hat, Inc., and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.jboss.seam.wicket.mock; | ||
|
||
import org.apache.wicket.Response; | ||
import org.apache.wicket.protocol.http.WebApplication; | ||
import org.apache.wicket.protocol.http.WebRequest; | ||
import org.jboss.seam.wicket.SeamRequestCycle; | ||
|
||
/** | ||
* Simple request cycle with manual control of detaching conversation context and rest of wicket stuff. | ||
* @author <a href="http://community.jboss.org/people/smigielski">Marek | ||
* Smigielski</a> | ||
* | ||
*/ | ||
public class SeamTestRequestCycle extends SeamRequestCycle | ||
{ | ||
private boolean detach; | ||
|
||
|
||
public SeamTestRequestCycle(WebApplication application, WebRequest request, Response response,boolean detach) | ||
{ | ||
super(application, request, response); | ||
this.detach=detach; | ||
} | ||
|
||
/** Detach only when you know that conversation scope isn't need any more. | ||
* @see org.jboss.seam.wicket.SeamRequestCycle#detach() | ||
*/ | ||
@Override | ||
public void detach() | ||
{ | ||
if(isDetach()){ | ||
super.detach(); | ||
} | ||
} | ||
|
||
public void superDetach() | ||
{ | ||
super.detach(); | ||
} | ||
|
||
|
||
public boolean isDetach() | ||
{ | ||
return detach; | ||
} | ||
|
||
public void setDetach(boolean detach) | ||
{ | ||
this.detach = detach; | ||
} | ||
} |
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
71 changes: 71 additions & 0 deletions
71
mock/src/test/java/org/jboss/seam/wicket/test/application/AbstractObjectProducer.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,71 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2010, Red Hat, Inc., and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.jboss.seam.wicket.test.application; | ||
|
||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
/** | ||
* Abstract object producer which can be injected and control from test class. | ||
* | ||
* @author <a href="http://community.jboss.org/people/smigielski">Marek Smigielski</a> | ||
* | ||
*/ | ||
public class AbstractObjectProducer | ||
{ | ||
|
||
protected List<String> localMessages = new LinkedList<String>(); | ||
|
||
public AbstractObjectProducer() | ||
{ | ||
super(); | ||
} | ||
|
||
/** | ||
* Returning next message from the list | ||
* @return StringObject wrapping text message | ||
*/ | ||
public StringObject getMessage(){ | ||
if (localMessages.size() > 0) | ||
{ | ||
String value = localMessages.remove(0); | ||
return new StringObject().setValue(value); | ||
} | ||
return new StringObject(); | ||
} | ||
|
||
/** | ||
* Get local message list for manipulation. List implements LinkedList. | ||
* | ||
* @return local message list | ||
*/ | ||
public List<String> getLocalMessages() | ||
{ | ||
return localMessages; | ||
} | ||
|
||
/** | ||
* Add single text message to the end of the list. | ||
* | ||
* @param text | ||
*/ | ||
public void add(String text) | ||
{ | ||
localMessages.add(text); | ||
} | ||
|
||
} |
Oops, something went wrong.