Пример #1
0
 @Before
 public void setUp() throws Exception {
   testUser = new User();
   testUser.setPassword(testpassword);
   testUser.setUsername(testusername);
   testUser.setUsertype(testusertype);
 }
Пример #2
0
 @Test
 public void testUserStringStringString() {
   testUser = new User("username", "password", "usertype");
   if (testUser.getUsername() == "username"
       && testUser.getPassword() == "password"
       && testUser.getUsertype() == "usertype") {
     assertTrue(true);
   } else assertTrue(false);
 }
Пример #3
0
  private void DetayDoldur(TableRow tr) {

    ObDataBase db = new ObDataBase(this);
    TextView x = (TextView) tr.getChildAt(0);
    YeDatabase yDbUpdate = new YeDatabase(this);
    yDbUpdate.open();
    Cursor crx = yDbUpdate.QueryTbDataBases();
    while (crx.moveToNext()) {
      if (x.getText().equals(crx.getString(8))) {
        db.ID = crx.getInt(0);
        db.Name = crx.getString(1);
        db.Instance = crx.getString(2);
        db.Ip = crx.getString(3);
        db.Port = crx.getString(4);
        db.User = crx.getString(5);
        db.Pass = crx.getString(6);
        db.InUse = 1;
        db.Description = crx.getString(8);
      }
    }
    etID.setText(db.ID + "");
    etDatabase.setText(db.Name.toString());
    etDesc.setText(db.Description.toString());
    etInstance.setText(db.Instance.toString());
    etIpAdresi.setText(db.Ip.toString());
    etKullaniciAdi.setText(db.User.toString());
    etPort.setText(db.Port.toString());
    etSifre.setText(db.Pass.toString());
  }
Пример #4
0
 public User getUserProfile() {
   if (userProfile == null) {
     userProfile = getLoggedSession().getLogUser();
     if (userProfile == null) {
       util.Utilities.redirect("index.xhtml");
     } else {
       userProfile = userFacade.find(userProfile.getUserId());
     }
   }
   return userProfile;
 }
Пример #5
0
  public String newPresentation() {
    if (!newPresentationCode.trim().isEmpty()) {
      if (presentationFacade.find(newPresentationCode.trim()) != null) {
        util.Utilities.showMessage("The presentation code already exists.", true);
        return "";
      }
    } else {
      do {
        newPresentationCode = generateRandomCode();
      } while (presentationFacade.find(newPresentationCode.trim()) != null);
    }
    Presentation newPresentation =
        new Presentation(null, newPresentationCode, newPresentationTitle);
    newPresentation.setDescription(newPresentationDescription);
    newPresentation.setSectionList(new ArrayList<Section>());
    newPresentation.setQuestionList(new ArrayList<Question>());
    newPresentation.setUserListAdmin(new ArrayList<User>());
    newPresentation.setUserList(new ArrayList<User>());
    newPresentation.getUserListAdmin().add(userProfile);
    newPresentation = presentationFacade.create(newPresentation);
    newPresentation.setPresentationHaveFeelingList(new ArrayList<PresentationHaveFeeling>());
    for (Feeling feeling : feelingFacade.findDefaultFeelings()) {
      PresentationHaveFeeling f =
          new PresentationHaveFeeling(newPresentation.getPresentationId(), feeling.getFeelingId());
      f.setOrder(feeling.getFeelingId());
      f.setIsdefault((short) (f.getOrder() == 3 ? 1 : 0));
      f.setFeeling(feeling);
      newPresentation.getPresentationHaveFeelingList().add(f);
    }
    userProfile.getPresentationListAdmin().add(newPresentation);
    newPresentation = presentationFacade.edit(newPresentation);
    loggedSession.setAdminPresentation(
        presentationFacade.find(newPresentation.getPresentationId()));

    newPresentationCode = newPresentationTitle = newPresentationDescription = "";

    return "adminpresentation";
  }
Пример #6
0
 @Test
 public void testSetUsertype() {
   assertEquals("Set UserType is running", testusertype, testUser.getUsertype());
 }
Пример #7
0
 @Test
 public void testGetUsertype() {
   testUser.setUsertype("gamemaker");
   assertEquals("Get UserType is running", "gamemaker", testUser.getUsertype());
 }
Пример #8
0
 @Test
 public void testSetPassword() {
   assertEquals("Set Password is running", testpassword, testUser.getPassword());
 }
Пример #9
0
 @Test
 public void testGetPassword() {
   testUser.setPassword("testpassword");
   assertEquals("Get Password is running", "testpassword", testUser.getPassword());
 }
Пример #10
0
 @Test
 public void testGetUsername() {
   testUser.setUsername("testuser");
   assertEquals("Get Username is running", "testuser", testUser.getUsername());
 }