Package com.alvazan.test.db

Examples of com.alvazan.test.db.Account


    readWriteBasic(mgr);
  }
 
  @Test
  public void testWriteActivityAccountNoSavedYet() {
    Account acc = new Account();
    acc.setName(ACCOUNT_NAME);
    acc.setUsers(5.0f);
   
    Activity act = new Activity("act1");
    act.setAccount(acc);
    act.setName("asdfsdf");
    act.setNumTimes(3);
View Full Code Here


    Assert.assertNull(act);
  }
 
  @Test
  public void testIndexWithToOne() {
    Account acc = new Account();
    acc.setName(ACCOUNT_NAME);
    acc.setUsers(5.0f);
    mgr.put(acc);
   
    Account acc2 = new Account();
    acc2.setName("account2");
    acc2.setUsers(5.0f);
    mgr.put(acc2);
   
    Activity act1 = new Activity("act1");
    act1.setAccount(acc);
    act1.setName("asdfsdf");
View Full Code Here

   
  }
 
  @Test
  public void testFillInKeyMethod() {
    Account acc = new Account("acc1");
    acc.setName(ACCOUNT_NAME);
    acc.setUsers(5.0f);
    mgr.fillInWithKey(acc);
   
    Activity act = new Activity("act1");
    act.setAccount(acc);
    act.setName("asdfsdf");
    act.setNumTimes(3);
   
    mgr.put(act);
   
    mgr.flush();
   
    Activity activityResult = mgr.find(Activity.class, act.getId());
    Account theProxy = activityResult.getAccount();
    try {
      theProxy.getName();
      Assert.fail("Account was never saved so above line should fail");
    } catch(RowNotFoundException e) {
      log.info("this is expected");
    }
  }
View Full Code Here

    }
  }

  //@Test
  public void testToOneWithUUID() {
    Account acc1 = new Account();
    acc1.setId("acc1");
    acc1.setName("acc1name");
    mgr.fillInWithKey(acc1);

    EntityWithUUIDKey entity = new EntityWithUUIDKey();
    entity.setSomething("something");
    entity.setAccount(acc1);
View Full Code Here

    Assert.assertNotNull(user2);
    Assert.assertEquals(entity.getId(), user2.getUuidEntity().getId());
  }

  private Activity readWriteBasic(NoSqlEntityManager mgr) {
    Account acc = new Account("acc1");
    acc.setName(ACCOUNT_NAME);
    acc.setUsers(5.0f);
   
    mgr.put(acc);
   
    Activity act = new Activity("act1");
    act.setAccount(acc);
    act.setName("asdfsdf");
    act.setNumTimes(3);
   
    mgr.put(act);
   
    mgr.flush();
   
    Account accountResult = mgr.find(Account.class, acc.getId());
    Assert.assertEquals(ACCOUNT_NAME, accountResult.getName());
    Assert.assertEquals(acc.getUsers(), accountResult.getUsers());
   
    Activity activityResult = mgr.find(Activity.class, act.getId());
    Assert.assertEquals(act.getName(), activityResult.getName());
    Assert.assertEquals(act.getNumTimes(), activityResult.getNumTimes());
    Assert.assertEquals(acc.getId(), activityResult.getAccount().getId());
View Full Code Here

  }
 
  @Test
  public void testTwoQueriesSameNameDifferentEntitiesAllowed() {
    //Account has the same name as a query in Activity which IS allowed in our implementation
    Account acc = new Account("acc1");
    acc.setName("tempxxxxx");
    acc.setUsers(9.33333f);
    mgr.put(acc);
    Account acc2 = new Account("acc2");
    acc2.setName("xyz");
    acc2.setUsers(3.1f);
    mgr.put(acc2);
    Account acc3 = new Account("acc3");
    acc3.setName(acc2.getName());
    acc3.setUsers(2.9f);
    mgr.put(acc3);
   
    Activity act = new Activity("act1");
    mgr.put(act);
   
View Full Code Here

  }
 
  @Test
  public void testTwoQueriesSameNameDifferentEntitiesAllowedBackward() {
    //Account has the same name as a query in Activity which IS allowed in our implementation
    Account acc = new Account("acc1");
    acc.setName("tempxxxxx");
    acc.setUsers(9.33333f);
    mgr.put(acc);
    Account acc2 = new Account("acc2");
    acc2.setName("xyz");
    acc2.setUsers(3.1f);
    mgr.put(acc2);
    Account acc3 = new Account("acc3");
    acc3.setName(acc2.getName());
    acc3.setUsers(2.9f);
    mgr.put(acc3);
   
    Activity act = new Activity("act1");
    mgr.put(act);
   
View Full Code Here

    Assert.assertEquals(2, list.size());
  }

  @Test
  public void testBooleanWithAndClause() {
    Account acc = new Account("acc1");
    acc.setName("abc");
    acc.setIsActive(true);
    mgr.put(acc);
    Account acc2 = new Account("acc2");
    acc2.setName("dean");
    acc2.setIsActive(false);
    mgr.put(acc2);
    Account acc3 = new Account("acc3");
    acc3.setName("dean");
    acc3.setIsActive(true);
    mgr.put(acc3);
    Account acc4 = new Account("acc4");
    acc4.setName("dean");
    acc4.setIsActive(true);
    mgr.put(acc4);   
    Account acc5 = new Account("acc5");
    acc5.setName("dean");
    acc5.setIsActive(null);
    mgr.put(acc5);
   
    mgr.flush();
   
    List<Account> activeList = Account.findAnd(mgr, "dean", true);
View Full Code Here

    Assert.assertEquals(expectedKey, key);
    Assert.assertEquals(expectedAccKey, keyAcc);
  }

  private void setupRecords() {
    Account acc1 = new Account("acc1");
    acc1.setIsActive(false);
    mgr.fillInWithKey(acc1);

   
    Account acc2 = new Account("acc2");
    acc2.setIsActive(true);
    mgr.fillInWithKey(acc2);
   
    Account acc3 = new Account("acc3");
    acc3.setIsActive(false);
    mgr.fillInWithKey(acc3);

   
    Activity act1 = new Activity("act1");
    act1.setAccount(acc1);
View Full Code Here

TOP

Related Classes of com.alvazan.test.db.Account

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.