Ejemplo n.º 1
0
 @Before
 public void setUp() throws Exception {
   testUser = new User();
   testUser.setPassword(testpassword);
   testUser.setUsername(testusername);
   testUser.setUsertype(testusertype);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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());
  }
Ejemplo n.º 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;
 }
Ejemplo n.º 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";
  }
Ejemplo n.º 6
0
 @Test
 public void testSetUsertype() {
   assertEquals("Set UserType is running", testusertype, testUser.getUsertype());
 }
Ejemplo n.º 7
0
 @Test
 public void testGetUsertype() {
   testUser.setUsertype("gamemaker");
   assertEquals("Get UserType is running", "gamemaker", testUser.getUsertype());
 }
Ejemplo n.º 8
0
 @Test
 public void testSetPassword() {
   assertEquals("Set Password is running", testpassword, testUser.getPassword());
 }
Ejemplo n.º 9
0
 @Test
 public void testGetPassword() {
   testUser.setPassword("testpassword");
   assertEquals("Get Password is running", "testpassword", testUser.getPassword());
 }
Ejemplo n.º 10
0
 @Test
 public void testGetUsername() {
   testUser.setUsername("testuser");
   assertEquals("Get Username is running", "testuser", testUser.getUsername());
 }