Package org.springmodules.javaspaces.gigaspaces.app

Examples of org.springmodules.javaspaces.gigaspaces.app.SimpleBean


    }

  public void testWriteTake() throws Exception{

    ISimpleDao dao = (ISimpleDao)applicationContext.getBean("simpleDAO");
    SimpleBean bean = new SimpleBean("zvika", 32);
    dao.writeSimple(bean);

    SimpleBean template = new SimpleBean("zvika", 32);
    SimpleBean taken = dao.takeIfExists(bean);

    assertEquals("written object is not equal to taken one!", bean, taken);
  }
View Full Code Here


  }

  public void testWrite() throws Exception
  {

    SimpleBean bean = new SimpleBean("ddd", 2);
    bean.setTestboolean(true);
    bean.setTestBooleanObject(new Boolean(true));
    template.write(bean, -1);
    SimpleBean template1 = new SimpleBean(null, 2);
    template1.setTestboolean(true);
    SimpleBean taken = (SimpleBean) template.take(template1, -1);
    assertEquals("written object is not equal to taken one!", bean, taken);
  }
View Full Code Here

  }

  public void testTake() throws Exception
  {
    template.clean();
    SimpleBean bean = new SimpleBean("dddd", 1);
    template.write(bean, -1);
    SimpleBean templateBean = new SimpleBean(null, 1);
    SimpleBean taken = (SimpleBean) template.take(/*bean*/templateBean, -1);
    assertNotNull("Taken object is null!", taken);
  }
View Full Code Here

    assertNotNull("Taken object is null!", taken);
  }

  public void testTakeIfExist() throws Exception
  {
    SimpleBean bean = new SimpleBean("lior_IfExists", 1);
    template.write(bean, -1);
    SimpleBean templateBean = new SimpleBean("lior_IfExists", 1);
    SimpleBean taken = (SimpleBean) template.takeIfExists(/*bean*/templateBean, -1);
    assertNotNull("Taken object is null!", taken);
  }
View Full Code Here

    assertNotNull("Taken object is null!", taken);
  }

  public void testTakeWithTransaction() throws Throwable
  {
    SimpleBean bean = new SimpleBean("lior_TakeWithTransaction", 1);
    template.write(bean, -1);
    SimpleBean templateBean = new SimpleBean"lior_TakeWithTransaction",
                          1);
    SimpleBean taken = (SimpleBean) template.take(/*bean*/  templateBean,
                            Lease.ANY);
    assertNotNull("Taken object is null!", taken);
  }
View Full Code Here

    assertNotNull("Taken object is null!", taken);
  }

  public void testTakeIfExistWithTransaction() throws Throwable
  {
    SimpleBean bean = new SimpleBean("lior_IfExistsTakeWithTransaction", 1);
    template.write(bean, -1);
    SimpleBean templateBean = new SimpleBean"lior_IfExistsTakeWithTransaction",
                          1);
    SimpleBean taken = (SimpleBean) template.takeIfExiststemplateBean/*bean*/,
                                2000);
    assertNotNull("Taken object is null!", taken);
  }
View Full Code Here

    assertNotNull("Taken object is null!", taken);
  }

  public void testSnapshot()
  {
    SimpleBean templateBean = new SimpleBean("lior_Snapshot", 1);
    ExternalEntry taken = (ExternalEntry) template.snapshot(templateBean);
    assertNotNull("Taken object is null!", taken);
  }
View Full Code Here

  public void testCount() throws Exception
  {
    Random rn = new Random();
    String bean_name = "lior_count" + rn.nextInt();
    SimpleBean bean = new SimpleBean(bean_name, 1);
    template.write(bean, -1);
    SimpleBean templateBean = new SimpleBean(bean_name, 1);
    int count = (int) template.count(templateBean);
    assertEquals("The count is not 1!", 1, count);
  }
View Full Code Here

    assertEquals("The count is not 1!", 1, count);
  }

  public void testClear() throws Exception
  {
    SimpleBean bean = new SimpleBean("lior_clear", 1);
    template.write(bean, -1);
    SimpleBean templateBean = new SimpleBean("lior_clear", 1);
    template.clear(templateBean);
    SimpleBean taken = null;
    try
    {
      //throw exception if there is pk decleration
      taken = (SimpleBean) template.takeIfExists(templateBean, -1);
    }
View Full Code Here

    assertNull("The bean is not been clear!", taken);
  }

  public void testClean() throws Exception
  {
    SimpleBean bean = new SimpleBean("lior_clean", 1);
    template.write(bean, -1);
    SimpleBean templateBean = new SimpleBean("lior_clean", 1);
    template.clean();
    SimpleBean taken = null;
    try
    {
      //throw exception if there is pk decleration
      taken = (SimpleBean) template.takeIfExists(templateBean, -1);
    }
View Full Code Here

TOP

Related Classes of org.springmodules.javaspaces.gigaspaces.app.SimpleBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.