title: Select Menu JSF to CDI differences
body: <p>I want to use the arquillian warp test framework for a JSF project I am developing. I understand that I need to use the CDI annotations instead of the JSF ones to get this to work. I am using <code>@ViewScoped</code> beans so I have included seam-faces in my project to deal with this (i am running on JBoss 7). I have modified my beans to use <code>@Named</code> and where I was using <code>@PostConstruct</code> I have put this into the constructor which all seems to be okay.</p>
  
  <p>When I access a view with a <code>selectOneMenu</code> it never has any list items. Here is the code form the view and the bean.</p>
  
  <p>View:</p>
  
  <pre><code>&lt;h:selectOneMenu value="#{ngoBean.ngo.country}" &gt;
      &lt;f:selectItems value="#{ngoBean.countryValues}" /&gt;
  &lt;/h:selectOneMenu&gt;
  </code></pre>
  
  <p>Bean:</p>
  
  <pre><code>import com.a.Facade;
  import com.a.CountryEnum;
  import com.a.GoverningBody;
  
  import javax.annotation.PostConstruct;
  import javax.ejb.EJB;
  import javax.faces.bean.ViewScoped;
  import javax.faces.model.SelectItem;
  import javax.inject.Named;
  import java.io.Serializable;
  import java.util.ArrayList;
  import java.util.List;
  
  /**
   * Created with IntelliJ IDEA.
   */
  @Named("ngoBean")
  @ViewScoped
  public class NgoBean implements Serializable {
  
      private GoverningBody ngo = new GoverningBody();
      private List&lt;GoverningBody&gt; ngoList;
      private boolean edit;
  
      private List&lt;SelectItem&gt; countryValues;
  
      @EJB(beanName = "NgoFacadeImpl")
      private Facade&lt;GoverningBody&gt; ngoController;
  
      public NgoBean(){
      }
  
      @PostConstruct
      public void init(){
          //TODO this is a bad way of loading db data i should change it
          ngoList = ngoController.findAll();
  
          countryValues = initCountryValues();
      }
  
      public void add(){
          ngoList.add(ngoController.save(ngo));
  
          //reset the variable
          ngo = new GoverningBody();
      }
  
      public void edit(GoverningBody item) {
          this.ngo = item;
          edit = true;
      }
  
      public void save() {
          ngo = ngoController.update(ngo);
          edit = false;
      }
  
      public void delete(GoverningBody item) {
          ngoController.delete(item);
          ngoList.remove(item);
      }
  
      public List&lt;GoverningBody&gt; getNgoList() {
          return ngoList;
      }
  
      public GoverningBody getNgo() {
          return ngo;
      }
  
      public boolean isEdit() {
          return edit;
      }
  
      public List&lt;SelectItem&gt; getCountryValues() {
          return countryValues;
      }
  
      public void setCountryValues(List&lt;SelectItem&gt; countryValues) {
          this.countryValues = countryValues;
      }
  
      public List&lt;SelectItem&gt; initCountryValues() {
          List&lt;SelectItem&gt; items = new ArrayList&lt;&gt;(CountryEnum.values().length);
          int i = 0;
          for(CountryEnum g: CountryEnum.values()) {
              items.add(new SelectItem(g, g.getName()));
          }
  
          System.out.println("items = " + items);
          return items;
      }
  }
  </code></pre>
  
  <p>I tried annotating the method with <code>@Factory("countryValues")</code> but this didn't seem to help. </p>