Package com.github.C204_242_DJSMT.Assignment_2

Examples of com.github.C204_242_DJSMT.Assignment_2.User


    new Teacher("");
  }
 
  @Test(expected=IllegalArgumentException.class)
  public void creationTest3() {
    new Teacher(null);
  }
View Full Code Here


public class TeacherTest {
 
  @Test
  public void creationTest1() {
    new Teacher("Name");
  }
View Full Code Here

    new Teacher("Name");
  }
 
  @Test(expected=IllegalArgumentException.class)
  public void creationTest2() {
    new Teacher("");
  }
View Full Code Here

    new Teacher("");
  }
 
  @Test(expected=IllegalArgumentException.class)
  public void creationTest3() {
    new Teacher(null);
  }
View Full Code Here

  }
 
  @Test public void createDeleteTest() {
    Teacher t = new Teacher("Name");
    ClassGroup cls = new ClassGroup("Name", "description");
    Teaches te = TeachingManager.getInstance().add(t, cls);
    Assert.assertTrue(TeachingManager.getInstance().contains(te));
    Assert.assertTrue(TeachingManager.getInstance().delete(te));
    Assert.assertFalse(TeachingManager.getInstance().contains(te));
  }
View Full Code Here

public class TeachesTest {
  Teacher testTeacher = new Teacher("name");
  ClassGroup testClass = new ClassGroup("name", "description");
 
  @Test public void creationTest1() {
    new Teaches(testClass, testTeacher);
  }
View Full Code Here

    new Teaches(testClass, testTeacher);
  }
 
  @Test (expected=IllegalArgumentException.class)
  public void creationTest2() {
    new Teaches(null, testTeacher);
  }
View Full Code Here

    new Teaches(null, testTeacher);
  }
 
  @Test (expected=IllegalArgumentException.class)
  public void creationTest3() {
    new Teaches(testClass, null);
  }
View Full Code Here

          throws Exception {
    // Request the user service.
    UserRemote userService = dfaServices.get(session, UserRemote.class);

    // Retrieve the user who is to be modified.
    User user = userService.getUser(userId);

    // Create and configure a user filter.
    UserFilter filterToAdd = new UserFilter();
    // The following field has been filled in to make a filter that allows a
    // user to access only the assigned objects.
    // This value was determined using GetUserFilterCriteriaTypes.java.
    filterToAdd.setUserFilterCriteriaId(2);
    // Because this filter used the criteria type "Assigned" it is necessary
    // to specify what advertisers this user has access to. This next step
    // would be skipped for the criteria types "All" and "None".

    // Create an object filter to represent each object the user has access
    // to. Since this is an advertiser filter, an object filter represents an
    // advertiser. The total of object filter objects will need to match the
    // total of advertisers the user is assigned.
    ObjectFilter allowedObject = new ObjectFilter();
    // Insert the advertiser ID of an advertiser assigned to this user.
    allowedObject.setId(advertiserId);
    // Create any additional object filters that are needed, then create an
    // array of all of the object filters for this filter.
    ObjectFilter[] objectFilters = {allowedObject};
    // Add these settings to the user filter
    filterToAdd.setObjectFilters(objectFilters);

    // Add the filter to the user. The following method is specific to
    // advertiser filters. See the User class documentation for the names of
    // methods for other filters.
    user.setAdvertiserUserFilter(filterToAdd);

    // Save the changes made and display a success message.
    UserSaveResult userSaveResult = userService.saveUser(user);
    System.out.printf("User with ID \"%s\" was modified.", userSaveResult.getId());
  }
View Full Code Here

          throws Exception {
    // Request the user service.
    UserRemote userService = dfaServices.get(session, UserRemote.class);

    // Retrieve the user who is to be modified.
    User user = userService.getUser(userId);

    // Create and configure a user filter.
    UserFilter filterToAdd = new UserFilter();
    // The following field has been filled in to make a filter that allows a
    // user to access only the assigned objects.
    // This value was determined using GetUserFilterCriteriaTypes.java.
    filterToAdd.setUserFilterCriteriaId(2);
    // Because this filter used the criteria type "Assigned" it is necessary
    // to specify what advertisers this user has access to. This next step
    // would be skipped for the criteria types "All" and "None".

    // Create an object filter to represent each object the user has access
    // to. Since this is an advertiser filter, an object filter represents an
    // advertiser. The total of object filter objects will need to match the
    // total of advertisers the user is assigned.
    ObjectFilter allowedObject = new ObjectFilter();
    // Insert the advertiser ID of an advertiser assigned to this user.
    allowedObject.setId(advertiserId);
    // Create any additional object filters that are needed, then create an
    // array of all of the object filters for this filter.
    ObjectFilter[] objectFilters = {allowedObject};
    // Add these settings to the user filter
    filterToAdd.setObjectFilters(objectFilters);

    // Add the filter to the user. The following method is specific to
    // advertiser filters. See the User class documentation for the names of
    // methods for other filters.
    user.setAdvertiserUserFilter(filterToAdd);

    // Save the changes made and display a success message.
    UserSaveResult userSaveResult = userService.saveUser(user);
    System.out.printf("User with ID \"%s\" was modified.", userSaveResult.getId());
  }
View Full Code Here

TOP

Related Classes of com.github.C204_242_DJSMT.Assignment_2.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.