Package edu.wpi.cs.wpisuitetng.modules.core.models

Examples of edu.wpi.cs.wpisuitetng.modules.core.models.User


 
  @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();
    assertTrue(retrievedList.contains(firstUser));
    assertTrue(retrievedList.contains(secondUser));
   
    retrievedList = db.deleteAll(firstUser);
    User me1 = db.retrieve(User.class, "username", "bgaffey").toArray(arr)[0];
    User me2 = db.retrieve(User.class, "username", "gafftron").toArray(arr)[0];
    assertEquals(initCount, retrievedList.size());
    assertEquals(me1, null);
    assertEquals(me2, null);
  }
View Full Code Here


 
  @Test
  public void testRetrieveWithProjects() throws WPISuiteException{
    Data db = DataStore.getDataStore();
    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];
View Full Code Here

  @Test
  public void testOrRetrieve() throws WPISuiteException, IllegalAccessException, InvocationTargetException{
    Data db = DataStore.getDataStore();
   
    User[] arr = new User[2];
    User firstUser = new User("Ryan", "rchamer", "password", 0);
    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);
View Full Code Here

  public void testAndRetrieve() throws WPISuiteException, IllegalAccessException, InvocationTargetException{
 
    Data db = DataStore.getDataStore();
   
    User[] arr = new User[2];
    User firstUser = new User("Ryan", "rchamer", "password", 0);
    User secondUser = new User("Bryan", "rchamer", "pword", 1);
    List<User> first = new ArrayList<User>();
    first.add(firstUser);
    db.deleteAll(firstUser);
    db.save(firstUser);
    db.save(secondUser);
View Full Code Here

  public void testComplexRetrieve() throws WPISuiteException, IllegalAccessException, InvocationTargetException{
Data db = DataStore.getDataStore();
   
   
    User[] arr = new User[2];
    User firstUser = new User("Ryan", "rchamer", "password", 0);
    User secondUser = new User("Bryan", "rchamer", "pword", 1);
    User thirdUser = new User("Tyler", "twack", "word", 2);
    List<User> first = new ArrayList<User>();
    db.deleteAll(firstUser);
    first.add(firstUser);
    first.add(thirdUser);
    db.deleteAll(firstUser);
View Full Code Here

 
  private MockDataStore()
  {
    models = new ArrayList<Model>();
    models.add(new Project("test", "5"));
    models.add(new User("steve", "steve",null, 0));
    models.add(new User("fred","fred",null, 1));
    models.add(new User("jeff","jeff",null, 2));
    models.add(new User("tyler","tyler",null, 3));
    models.add(new Project("WPISUITE","0"));
    models.add(new Project("ANDROID:BEARCLAW","1"));
    models.add(new Project("WINDOWS9","2"));
    models.add(new Project("OSX:HOUSECAT","3"));
    models.add(new Project("UBUNTU_RABID_RHINO","4"));
View Full Code Here

public class MockUserManager extends UserManager {

  @Override
  public User update(Session s, String content) throws WPISuiteException {
    return new User("asdf","asdf","asdf", 0);
  }
View Full Code Here

    return args[0];
  }

  @Override
  public User makeEntity(Session s, String content) throws WPISuiteException {
    return new User("asdf","asdf","asdf", 0);
  }
View Full Code Here

      u[0] = fake;
      u[1] = fake;
    }
   
    if(id.equalsIgnoreCase("asdf"))
      u[0] = new User("asdf","asdf","asdf", 0);
   
    if(!(id.equalsIgnoreCase(fake.getUsername()) || id.equalsIgnoreCase("") || id.equalsIgnoreCase("asdf")))
      return null;
    System.out.println("MockUserManager retval: " + u[0]);
    return u;
View Full Code Here

  Defect otherDefect;
  Project otherProject;
   
  @Before
  public void setUp() {
    invalidUser = new User("idontexist", "blah", "1234", 99);
   
    tag = new Tag("tag");
    bob = new User("bob", "bob", "1234", 1);
    existingUser = new User("joe", "joe", "1234", 2);
    existingDefect = new Defect(1, "An existing defect", "", bob);
    existingDefect.setCreationDate(new Date(0));
    existingDefect.setLastModifiedDate(new Date(0));
    existingDefect.setEvents(new ArrayList<DefectEvent>());
   
    otherDefect = new Defect(2, "A defect in a different project", "", bob);
    otherProject = new Project("other", "2");
   
    testProject = new Project("test", "1");
    mockSsid = "abc123";
    defaultSession = new Session(bob, testProject, mockSsid);
   
    //need copies to simulate db4o cross-container problem
    tagCopy = new Tag("tag");
    bobCopy = new User(null, "bob", null, -1);
    goodNewDefect = new Defect(-1, "This is a good title", "", bobCopy);
    goodNewDefect.setAssignee(bobCopy);
    goodNewDefect.getTags().add(tagCopy);
    goodNewDefect.setStatus(DefectStatus.CONFIRMED); // ignored
    ignoredEvents = new ArrayList<DefectEvent>();
    goodNewDefect.setEvents(ignoredEvents); // ignored
   
    existingUserCopy = new User(null, "joe", null, -1);
    goodUpdatedDefect = new Defect(1, "A changed title", "A changed description", bobCopy);
    goodUpdatedDefect.setAssignee(existingUserCopy);
    goodUpdatedDefect.setEvents(new ArrayList<DefectEvent>());
    goodUpdatedDefect.getTags().add(tagCopy);
    goodUpdatedDefect.setStatus(DefectStatus.CONFIRMED);
View Full Code Here

TOP

Related Classes of edu.wpi.cs.wpisuitetng.modules.core.models.User

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.