Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
111 additions
and
4 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
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
21 changes: 21 additions & 0 deletions
21
tests/src/test/java/org/jboss/weld/tests/producer/field/named/Employee.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,21 @@ | ||
package org.jboss.weld.tests.producer.field.named; | ||
|
||
import java.io.Serializable; | ||
|
||
|
||
public class Employee implements Serializable | ||
{ | ||
|
||
private String name; | ||
|
||
public void setName(String name) | ||
{ | ||
this.name = name; | ||
} | ||
|
||
public String getName() | ||
{ | ||
return name; | ||
} | ||
|
||
} |
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
46 changes: 46 additions & 0 deletions
46
tests/src/test/java/org/jboss/weld/tests/producer/field/named/SaveAction.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,46 @@ | ||
package org.jboss.weld.tests.producer.field.named; | ||
|
||
import java.io.Serializable; | ||
|
||
import javax.enterprise.context.SessionScoped; | ||
import javax.enterprise.inject.Produces; | ||
import javax.inject.Named; | ||
|
||
@Named("save") | ||
@SessionScoped | ||
public class SaveAction implements Serializable | ||
{ | ||
|
||
@Produces | ||
@Named | ||
private Employee employeeField = new Employee(); | ||
|
||
private Employee employeeMethod = new Employee(); | ||
|
||
private boolean executeCalled; | ||
|
||
@Produces | ||
@Named | ||
public Employee getEmployeeMethod() | ||
{ | ||
return employeeMethod; | ||
} | ||
|
||
public SaveAction() | ||
{ | ||
} | ||
|
||
public String execute() | ||
{ | ||
assert employeeMethod.getName().equals("Gavin"); | ||
assert employeeField.getName().equals("Pete"); | ||
this.executeCalled = true; | ||
return "/home?faces-redirect=true"; | ||
} | ||
|
||
public boolean isExecuteCalled() | ||
{ | ||
return executeCalled; | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
tests/src/test/resources/org/jboss/weld/tests/producer/field/named/home.xhtml
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,19 @@ | ||
<?xml version='1.0' encoding='UTF-8' ?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:h="http://java.sun.com/jsf/html" | ||
xmlns:ui="http://java.sun.com/jsf/facelets"> | ||
<h:head> | ||
<title>New Employee</title> | ||
</h:head> | ||
<h:body> | ||
<ui:debug hotkey="d"/> | ||
<h:form> | ||
<h:messages/> | ||
<h:outputLabel value="Name:"/> | ||
<h:inputText value="#{employeeField.name}" id="employeeFieldName" /> | ||
<h:inputText value="#{employeeMethod.name}" id="employeeMethodName" /> | ||
<h:commandButton action="#{save.execute}" value="Save!" id="saveButton"/> | ||
</h:form> | ||
</h:body> | ||
</html> |