Package edu.wpi.cs.wpisuitetng.database

Examples of edu.wpi.cs.wpisuitetng.database.Data.save()


  @Test
  public void testDBSession() throws WPISuiteException
  {
    Data db = DataStore.getDataStore();
    User[] arr = new User[1];
    db.save(new User("andrew", "ahurle", "p", 0));
    User me = db.retrieve(User.class, "username", "ahurle").toArray(arr)[0];
    User me2 = db.retrieve(User.class, "username", "ahurle").toArray(arr)[0];
    db.delete(me);
    System.out.println("equal: " + (me == me2));
    assertEquals(me, me2);
View Full Code Here


  @Test
  public void testDelete() throws WPISuiteException{
    Data db = DataStore.getDataStore();
    User[] arr = new User[1];
    User firstUser = new User("Ryan", "rchamer", "password", 0);
    db.save(firstUser);
    db.delete(firstUser);
    User me = db.retrieve(User.class, "username", "rchamer").toArray(arr)[0];
    assertEquals(me, null);
  }
 
View Full Code Here

  @Test
  public void testUpdate() throws WPISuiteException{
    Data db = DataStore.getDataStore();
    User[] arr = new User[2];
    User firstUser = new User("Ryan", "rchamer", "password", 0);
    db.save(firstUser);
    db.update(User.class, "username", "rchamer", "name", "Mjolnir");
    User Mjolnir = db.retrieve(User.class, "username", "rchamer").toArray(arr)[0];
    assertEquals(firstUser, Mjolnir);
    db.delete(Mjolnir);
   
View Full Code Here

 
  @Test
  public void testRetrieveAll(){
    Data db = DataStore.getDataStore();
    User firstUser = new User("Brian", "bgaffey", "password", 0);
    db.save(firstUser);
    User secondUser = new User("Gaffey", "gafftron", "password", 0);
    db.save(secondUser);
    List<User> retrievedList = db.retrieveAll(firstUser);
   
    int initCount = retrievedList.size();
View Full Code Here

  public void testRetrieveAll(){
    Data db = DataStore.getDataStore();
    User firstUser = new User("Brian", "bgaffey", "password", 0);
    db.save(firstUser);
    User secondUser = new User("Gaffey", "gafftron", "password", 0);
    db.save(secondUser);
    List<User> retrievedList = db.retrieveAll(firstUser);
   
    int initCount = retrievedList.size();
    assertTrue(retrievedList.contains(firstUser));
    assertTrue(retrievedList.contains(secondUser));
View Full Code Here

  @Test
  public void testDeleteAll() throws WPISuiteException{
    Data db = DataStore.getDataStore();
    User[] arr = new User[2];
    User firstUser = new User("Brian", "bgaffey", "password", 0);
    db.save(firstUser);
    User secondUser = new User("Gaffey", "gafftron", "password", 0);
    db.save(secondUser);
    List<User> retrievedList = db.retrieveAll(firstUser);
   
    int initCount = retrievedList.size();
View Full Code Here

    Data db = DataStore.getDataStore();
    User[] arr = new User[2];
    User firstUser = new User("Brian", "bgaffey", "password", 0);
    db.save(firstUser);
    User secondUser = new User("Gaffey", "gafftron", "password", 0);
    db.save(secondUser);
    List<User> retrievedList = db.retrieveAll(firstUser);
   
    int initCount = retrievedList.size();
    assertTrue(retrievedList.contains(firstUser));
    assertTrue(retrievedList.contains(secondUser));
View Full Code Here

    User[] arr = new User[2];
    User firstUser = new User("Brian", "bgaffey", "password", 0);
    User secondUser = new User("Alex", "alex", "password1", 1);
    Project myProject = new Project("myProject", "0");
    Project notMyProject = new Project("notMyProject", "1");
    db.save(firstUser);
    db.save(myProject);
//    User result = db.retrieve(User.class, "username", "bgaffey", myProject).toArray(arr)[0];
  //  assertEquals(firstUser, result);
    db.deleteAll(firstUser);
    db.deleteAll(myProject)
View Full Code Here

    User firstUser = new User("Brian", "bgaffey", "password", 0);
    User secondUser = new User("Alex", "alex", "password1", 1);
    Project myProject = new Project("myProject", "0");
    Project notMyProject = new Project("notMyProject", "1");
    db.save(firstUser);
    db.save(myProject);
//    User result = db.retrieve(User.class, "username", "bgaffey", myProject).toArray(arr)[0];
  //  assertEquals(firstUser, result);
    db.deleteAll(firstUser);
    db.deleteAll(myProject)
  }
View Full Code Here

    User secondUser = new User("Bryan", "bgaffey", "pword", 1);
    List<User> both = new ArrayList<User>();
    both.add(firstUser);
    both.add(secondUser);
    db.deleteAll(firstUser);
    db.save(firstUser);
    db.save(secondUser);
    String[] list = new String[2];
    list[0] = "Username";
    list[1] = "Name";
    List<Object> objlist = new ArrayList<Object>();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.