[Seasar-user:13793] S2Junitを利用したteedaでのテストについて

Osamu Sakai [E-MAIL ADDRESS DELETED]
2008年 4月 16日 (水) 21:20:35 JST


$B$O$8$a$^$7$F!#(B
$B$*@$OC$K$J$j$^$9!#:d0f$H?=$7$^$9!#(B

$B8=:_(BTeeda+dbflute$B$N4D6-$G3+H/$r9T$C$F$$$^$9!#(B
$BITm?$J$,$i<ALd$G$9$,!"(BJunit$B$G(BS2TestCase$B$rMxMQ$7$?%/%i%9$G%F%9%H%/%i%9$r<B9T$9$k$H(B
$B%(%i!<$,=PNO$5$l$F$7$^$$$^$9!#(B

$B$?$@!"$9$Y$F$N%/%i%9$G%(%i!<$,H/@8$9$k$o$1$G$O$J$/!"$"$kFCDj$N%Q%C%1!<%80J30$N(B 

$B%/%i%9$G%(%i!<$,H/@8$7$^$9!#(B

$B6qBNE*$K$O8=:_(BInterCeptor$B$r:[E-MAIL ADDRESS DELETED]$7$F!"%;%C%7%g%s%A%'%C%/$r9T$C$F$$$k$N$G$9$,!"(B 

$B%;%C%7%g%s%A%'%C%/$r9T$C$F$$$J$$%/%i%90J30$,%(%i!<$K$J$j$^$9!#(B

$B$=$3$G%;%C%7%g%s%A%'%C%/$r9T$&(Bapp_aop.dicon$B$H(Bcustumizer.dicon$B$NEv3:2U=j$r%3%a%s%H%"%&%H(B
$B$7$F$_$^$7$?$,%(%i!<$,2r>C$5$l$^$;$s!#(B

$B6qBNE*$J%(%i!<$O!"(B

org.seasar.framework.exception.OgnlRuntimeException: [ESSR0073]OGNL$B$GNc30$,H/@8$7$^$7$?!#M}M3$O(B[ESSR0046]$B%3%s%]!<%M%s%H(B(aop)$B$,8+$D$+$j$^$;$s(B


$B!D$G$9!#(B

aop$B$,8+$D$+$i$J$$$H$$$&$3$H$G$9$,!"$"$k%/%i%9$+$i$O(Baop$B$,;2>H$G$-!"$"$k%/%i%9$+$i$O;2>H$G$-$J$$$H$$$&8=>](B
$B$,5/$3$C$F$$$^$9!#(B

$B0J2<$K!"$3$A$i$G:[E-MAIL ADDRESS DELETED]$7$?%F%9%H%/%i%9!"%U%!%$%kEy$r5-=R$$$?$7$^$9!#(B




$B-!%F%9%H%/%i%9(B

package prottype.web.dagta;

import junit.framework.TestCase;

import org.seasar.extension.unit.S2TestCase;
import org.seasar.teeda.core.unit.TeedaTestCase;

import sampleproject.web.testing.ConfirmationsPage;
import sampleproject.web.testing.TaskprogPage;

public class TaskProgPageTest extends TeedaTestCase{
 public TaskprogPage taskprog;


 @Override
 protected void setUp() throws Exception {
  include("dbflute.dicon");
 }

 public void testdoUpdate() throws Exception{
  System.out.println("from update dpof");

  System.out.println("from update dpof");
  taskprog.createItem(true,"001","abanama",1234,1,12);

  Class a = taskprog.doUpdate();

  assertEquals("TaskprogPage",a.getSimpleName());

 }


}


$B-"%(%i!<=PNO%m%0(B

org.seasar.framework.exception.OgnlRuntimeException: [ESSR0073]OGNL$B$GNc30$,H/@8$7$^$7$?!#M}M3$O(B[ESSR0046]$B%3%s%]!<%M%s%H(B(aop)$B$,8+$D$+$j$^$;$s(B
 at org.seasar.framework.util.OgnlUtil.getValue(OgnlUtil.java:103)
 at 
org.seasar.framework.container.ognl.OgnlExpression.evaluate(OgnlExpression.java:64)
 at 
org.seasar.framework.container.impl.ArgDefImpl.getValue(ArgDefImpl.java:60)
 at 
org.seasar.framework.container.impl.AspectDefImpl.getAspect(AspectDefImpl.java:81)
 at 
org.seasar.framework.container.util.AopProxyUtil.getAspects(AopProxyUtil.java:61)
 at 
org.seasar.framework.container.util.AopProxyUtil.getConcreteClass(AopProxyUtil.java:51)
 at 
org.seasar.framework.container.impl.ComponentDefImpl.getConcreteClass(ComponentDefImpl.java:140)
 at 
org.seasar.framework.container.impl.ComponentDefImpl.init(ComponentDefImpl.java:235)
 at 
org.seasar.framework.container.warmdeploy.WarmdeployBehavior.getComponentDef(WarmdeployBehavior.java:104)
 at 
org.seasar.framework.container.impl.S2ContainerBehavior$DefaultProvider.acquireFromHasComponentDef(S2ContainerBehavior.java:172)
 at 
org.seasar.framework.container.impl.S2ContainerBehavior.acquireFromHasComponentDef(S2ContainerBehavior.java:86)
 at 
org.seasar.framework.container.impl.S2ContainerImpl.hasComponentDef(S2ContainerImpl.java:456)
 at 
org.seasar.framework.unit.S2FrameworkTestCase.bindField(S2FrameworkTestCase.java:709)
 at 
org.seasar.framework.unit.S2FrameworkTestCase.bindFields(S2FrameworkTestCase.java:672)
 at 
org.seasar.framework.unit.S2FrameworkTestCase.runBare(S2FrameworkTestCase.java:304)
 at junit.framework.TestResult$1.protect(TestResult.java:106)
 at junit.framework.TestResult.runProtected(TestResult.java:124)
 at junit.framework.TestResult.run(TestResult.java:109)
 at junit.framework.TestCase.run(TestCase.java:120)
 at junit.framework.TestSuite.runTest(TestSuite.java:230)
 at junit.framework.TestSuite.run(TestSuite.java:225)
 at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
 at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
 at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
 at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
 at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.seasar.framework.container.ComponentNotFoundRuntimeException: 
[ESSR0046]$B%3%s%]!<%M%s%H(B(aop)$B$,8+$D$+$j$^$;$s(B
 at 
org.seasar.framework.container.impl.S2ContainerBehavior$DefaultProvider.acquireFromGetComponentDef(S2ContainerBehavior.java:165)
 at 
org.seasar.framework.container.impl.S2ContainerBehavior$DefaultProvider.acquireFromGetComponent(S2ContainerBehavior.java:158)
 at 
org.seasar.framework.container.impl.S2ContainerBehavior.acquireFromGetComponent(S2ContainerBehavior.java:62)
 at 
org.seasar.framework.container.impl.S2ContainerImpl.getComponent(S2ContainerImpl.java:124)
 at 
org.seasar.framework.container.ognl.S2ContainerPropertyAccessor.getProperty(S2ContainerPropertyAccessor.java:36)
 at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1758)
 at ognl.ASTProperty.getValueBody(ASTProperty.java:92)
 at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:171)
 at ognl.SimpleNode.getValue(SimpleNode.java:211)
 at ognl.ASTChain.getValueBody(ASTChain.java:109)
 at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:171)
 at ognl.SimpleNode.getValue(SimpleNode.java:211)
 at ognl.Ognl.getValue(Ognl.java:333)
 at ognl.Ognl.getValue(Ognl.java:310)
 at org.seasar.framework.util.OgnlUtil.getValue(OgnlUtil.java:95)
 ... 26 more

$B-#(Bcustumize.dicon

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE components PUBLIC "-//SEASAR//DTD S2Container 2.4//EN"
 "http://www.seasar.org/dtd/components24.dtd">
<components>
  <include path="default-customizer.dicon"/>

  <component name="pageCustomizer"
class="org.seasar.framework.container.customizer.CustomizerChain">
    <initMethod name="addCustomizer">
      <arg>traceCustomizer</arg>
    </initMethod>
<!--$B$3$3$+$[E-MAIL ADDRESS DELETED]$O%3%a%s%H%"%&%H(B-->


    <!-- $B!!0J2<$rDI2C!!(BStart$B!!(Bfor differnce due to version 2.4.14 -->
  <!--
    <initMethod name="addCustomizer">
    <arg>
      <component
class="org.seasar.framework.container.customizer.AspectCustomizer">
        <property name="interceptorName">"LoginAuthoInterceptor"</property>
        <property name="pointcut">"initialize, prerender"</property>
      </component>
    </arg>
  </initMethod>
  -->
  <!-- End -->
<!-- $B!!0J2<$rDI2C!!(BStart$B!!(B for differnce due to version 2.4.15 -->
<!--
    <initMethod name="addAspectCustomizer">
    <arg>"LoginAuthoInterceptor"</arg>
    <arg>"do.*,initialize, prerender"</arg>
  </initMethod>
  <initMethod name="addIgnoreClassPattern">
    <arg>"sampleproject.web.login"</arg>
    <arg>"LoginPage"</arg>
  </initMethod>
    <initMethod name="addIgnoreClassPattern">
    <arg>"sampleproject.web.login"</arg>
    <arg>"RegisterPage"</arg>
  </initMethod>
  <initMethod name="addIgnoreClassPattern">
    <arg>"sampleproject.web.login"</arg>
    <arg>"LogoutPage"</arg>
  </initMethod>
  <initMethod name="addIgnoreClassPattern">
    <arg>"sampleproject.web.layout"</arg>
    <arg>"HeaderPage"</arg>
  </initMethod>
    <initMethod name="addIgnoreClassPattern">
    <arg>"sampleproject.web.error"</arg>
    <arg>"Error.*"</arg>
  </initMethod>
-->
  <!-- End -->
  <!-- $B$3$3$^$G$r%3%a%s%H%"%&%H(B -->

    <initMethod name="addCustomizer">
      <arg>
        <component
class="org.seasar.framework.container.customizer.AspectCustomizer">
          <initMethod name="addInterceptorName">
            <arg>"app_aop.appFacesExceptionThrowsInterceptor"</arg>
          </initMethod>
          <property name="pointcut">"do.*, initialize, prerender"</property>
        </component>
      </arg>
    </initMethod>
    <initMethod name="addCustomizer">
      <arg>
        <component
class="org.seasar.framework.container.customizer.AspectCustomizer">
          <initMethod name="addInterceptorName">
            <arg>"j2ee.requiredTx"</arg>
          </initMethod>
          <property name="pointcut">"do.*, initialize, prerender"</property>
        </component>
      </arg>
    </initMethod>
  </component>
  <component name="actionCustomizer"
class="org.seasar.framework.container.customizer.CustomizerChain">
    <initMethod name="addCustomizer">
      <arg>traceCustomizer</arg>
    </initMethod>
    <initMethod name="addCustomizer">
      <arg>
        <component
class="org.seasar.framework.container.customizer.AspectCustomizer">
          <initMethod name="addInterceptorName">
            <arg>"app_aop.actionSupportInterceptor"</arg>
          </initMethod>
          <property name="pointcut">"do.*, initialize, prerender"</property>
        </component>
      </arg>
    </initMethod>
  </component>
  <component name="serviceCustomizer"
class="org.seasar.framework.container.customizer.CustomizerChain">
    <initMethod name="addCustomizer">
      <arg>traceCustomizer</arg>
    </initMethod>
    <initMethod name="addCustomizer">
      <arg>requiredTxCustomizer</arg>
    </initMethod>
  </component>
  <component name="logicCustomizer"
class="org.seasar.framework.container.customizer.CustomizerChain">
    <initMethod name="addCustomizer">
      <arg>traceCustomizer</arg>
    </initMethod>
  </component>
  <component name="daoCustomizer"
class="org.seasar.framework.container.customizer.CustomizerChain">
    <initMethod name="addCustomizer">
      <arg>traceCustomizer</arg>
    </initMethod>
    <initMethod name="addCustomizer">
      <arg>s2DaoCustomizer</arg>
    </initMethod>
  </component>
  <component name="dxoCustomizer"
class="org.seasar.framework.container.customizer.CustomizerChain">
    <initMethod name="addCustomizer">
      <arg>traceCustomizer</arg>
    </initMethod>

    <initMethod name="addCustomizer">
      <arg>s2DxoCustomizer</arg>
    </initMethod>

  </component>
  <component name="helperCustomizer"
class="org.seasar.framework.container.customizer.CustomizerChain">
    <initMethod name="addCustomizer">
      <arg>traceCustomizer</arg>
    </initMethod>
  </component>
  <!-- Added for New Version of interceptor -->
  <!--
  <component name="pageCustomizer"
class="org.seasar.framework.container.customizer.CustomizerChain">
  <initMethod name="addAspectCustomizer">
    <arg>"LoginAuthoInterceptor"</arg>
    <arg>"initialize, prerender"</arg>
  </initMethod>
</component>
-->
</components>

$B-%(Bapp_aop.dicon

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE components PUBLIC "-//SEASAR//DTD S2Container 2.4//EN"
 "http://www.seasar.org/dtd/components24.dtd">
<components namespace="app_aop">
 <include path="convention.dicon"/>
 <component name="actionSupportInterceptor" 
class="org.seasar.teeda.extension.interceptor.ActionSupportInterceptor" />
 <component name="appFacesExceptionThrowsInterceptor" 
class="org.seasar.teeda.core.interceptor.AppFacesExceptionThrowsInterceptor" 
/>
 <!--$B$3$3$r%3%a%s%H%"%&%H(B-->
 <!--<component name="LoginAuthoInterceptor" 
class="sampleproject.interceptor.LoginAuthoInterceptor" />-->

 <!--$B$3$3$^$G%3%a%s%H%"%&%H(B-->
</components>





$B-&%F%9%HBP>]%/%i%9(B

package sampleproject.web.dagta;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import sampleproject.dbflute.cbean.AmountCB;
import sampleproject.dbflute.cbean.ItemsCB;
import sampleproject.dbflute.exbhv.AmountBhv;
import sampleproject.dbflute.exbhv.ItemsBhv;
import sampleproject.dbflute.exentity.Amount;
import sampleproject.dbflute.exentity.Items;
import sampleproject.dto.SampleprojDto;
import sampleproject.dto.SlistDto;
import sampleproject.dto.SllistDto;
import sampleproject.dto.SvalDto;
import sampleproject.dxo.TaskprogDxo;
import java.util.ArrayList;
import javax.servlet.http.HttpSession;
import org.seasar.teeda.extension.annotation.convert.NumberConverter;
import org.seasar.teeda.extension.annotation.validator.LongRange;
import org.seasar.teeda.extension.annotation.validator.Required;
import org.seasar.teeda.extension.util.LabelHelper;

/***
 * @author selva_v.
 * @version 1.0.
 * This page is Display all the Existing records in List and we able to 
insert New records.
 */
public class TaskprogPage {
 public LabelHelper lp;
 public HttpSession session;
 public static final String text1_lengthValidator = "minimum=3";
 public List subItems;
 public List<Amount> tem;
 //Required Field Validator
 @Required
 public String sub;
 @NumberConverter(pattern =CommonText.NUMBERCOMMAPATTERN)
 public int disp;
 public int rdb;
 public List rdbItems;
 public List<Items> addItems;
 @Required(messageId=CommonText.E01MSG,target=CommonText.GOCONPAGE)
 public String text1;
 //Range Validator....
 @Required(messageId=CommonText.E12MSG,target=CommonText.GOCONPAGE)
 @LongRange(maximum=10000,minimum=1,target=CommonText.GOCONPAGE)
 //@RegularExpression(pattern="[a-zA-Z]", messageId="E10")
 //@RegularExpression(pattern="[a-z]")
 @NumberConverter(pattern = CommonText.NUMBERCOMMAPATTERN)
 public int text2;
    public AmountBhv amountBhv;
 public ItemsBhv itemsBhv;
 public int tot;
 public int testIndex;
 public String aaa;
 public String bbb;
 @NumberConverter(pattern = CommonText.NUMBERCOMMAPATTERN)
 public int ccc;
 public String ddd;
 public String eee;
 public boolean chk;
 private boolean chkboxcount;
 public String nocheckedmsg;
 public SllistDto[] selectItems;
 public SlistDto[] testItems;
 AmountCB amountCB=new AmountCB();
 public List<Amount> aaddItems;
 public SvalDto[] valItems;
 public SllistDto[] storeItems;
 public TaskprogDxo samDxo;

 public void initialize() {
 }

 /**
  * This Prerender is used to fill the list
  * @return void
  */
 public void prerender() {
  amountCB.query().addOrderBy_Orderid_Desc();
  aaddItems =  amountBhv.selectList(amountCB);
  valItems = new SvalDto[aaddItems.size()];
  for (int i = 0;i < aaddItems.size();i++){
   tot = tot+aaddItems.get(i).getAmount();
   valItems[i] = 
createItem(false,aaddItems.get(i).getSubjectcode(),aaddItems.get(i).getDetail(),aaddItems.get(i).getAmount(),aaddItems.get(i).getOutinflg(),aaddItems.get(i).getOrderid());
  }
  disp = tot;
  testItems = samDxo.convert(valItems);
 }

 /**
  * This doUpdate is used to Check the Combobox selected or not
  * @Return class
  */
 public Class doUpdate(){
  chkboxcount = checktickedCheckbox();
  if (chkboxcount){
   return UpdatePage.class;
  }
  else{
   nocheckedmsg = lp.getLabelValue("Notick");
   return null;
  }
 }

 /**
  * This doDelete is used to Check the Combobox selected or not
  * @Return class
  */
 public Class doDelete(){
  chkboxcount = checktickedCheckbox();
  if (chkboxcount){
   return DeletePage.class;
  }
  else{
   nocheckedmsg = lp.getLabelValue("Notick");
   return null;
  }
 }
 /**
  * This getmethod is used to Fill or Set the Radio Button
  * @Return List
  */
 public List getRdbItems() {
  rdbItems = new ArrayList();
     setSamleRadio(CommonText.RADIOVAL,lp.getLabelValue(CommonText.RADIOLBL));
  setSamleRadio(CommonText.RADIOVAL1,lp.getLabelValue(CommonText.RADIOLBL1));
  return rdbItems;
 }
 /**
  * setSampleRadio Set the value and Label for Radio Button
  * @return void
  * @param String,String
  */
 private void setSamleRadio(String val, String lbl) {
  SampleprojDto dt = new SampleprojDto();
  dt.setValue(val);
  dt.setLabel(lbl);
  rdbItems.add(dt);
 }

 /**
  * checktickedCheckbox is userdefined function to check the combobox 
checked or not
  * @Return boolean
  */
 private boolean checktickedCheckbox(){
  int flag = 0;
  for(int j = 0;j < testItems.length;j++){
   if (testItems[j].isChk()){
    flag = ++flag;
   }
  }
  if (flag == 0){
   return false;
  }
  else{
   return true;
  }
 }

 /**
  * createItem is userdefined function to set the values in Dto
  * @param boolean, String, String, int, int, int
  * @Return Dto
  */
 private SvalDto createItem(boolean chk,String aaa,String bbb,int ccc,int 
ddd,int eee){
  SvalDto item = new SvalDto();
  item.setChk(chk);
  item.setAaa(aaa);
  item.setBbb(bbb);
  item.setCcc(ccc);
  item.setDdd(ddd);
  item.setEee(eee);
  return item;
 }
 /**
  * getSubItems is used to fill the combo box or selection
  * @return List
  */
 public List getSubItems() {
  ItemsCB itemsCB = new ItemsCB();
  itemsCB.query();
  subItems = new ArrayList();
  addItems =  itemsBhv.selectList(itemsCB);
  for (int i = 0;i < addItems.size();i++){
   Map map = new HashMap();
   map.put("label",addItems.get(i).getSubjectcode()+" 
"+addItems.get(i).getSubject());
   map.put("value",addItems.get(i).getSubjectcode());
   subItems.add(map);
  }
  return subItems;
 }

 public boolean isChk() {
  return chk;
 }
 public void setChk(boolean chk) {
  this.chk = chk;
 }
}





$B$*<j?t$G$9$,$*Ez$(4j$($^$9$+!)(B
$B2?B4$h$m$7$/8f4j$$$$$?$7$^$9!#(B 



Seasar-user メーリングリストの案内