@Ignore
  // TODO test in besDAO
  @Test(expected = ConfigurationException.class)
  public void testAuthenticateTMForInstance_SSO_withoutConfiguredPassword() throws Throwable {

    proxyConfigSettings.put(PlatformConfigurationKey.BSS_AUTH_MODE.name(), "SAML_SP");
    VOUserDetails supplier = createVOUserDetails(10000, "supplier", "tp123");
    controllerConfigSettings.put(ControllerConfigurationKey.BSS_USER_PWD.name(), null);
    // do not add instance specific TP credentials
    createServiceInstance(ProvisioningStatus.COMPLETED, InstanceParameter.PUBLIC_IP);

    authenticateTMForInstance(CTRL_ID, "appInstanceId", supplier.getUserId(), "secret");
    UserBase userBase = new UserBase();
    userBase.addUser(supplier, "secret");
    identityService = userBase.mockIdentityService();
  }
Beispiel #2
0
	@Override
	public void updateMoneyCache(double userMoney)
	{
		if (super.getMoney() != userMoney)
		{
			super.setMoney(userMoney);
		}
	}
Beispiel #3
0
	@Override
	public void setMoney(final double value)
	{
		if (Methods.hasMethod())
		{
			try
			{
				final Method method = Methods.getMethod();
				if (!method.hasAccount(this.getName()))
				{
					throw new Exception();
				}
				final Method.MethodAccount account = Methods.getMethod().getAccount(this.getName());
				account.set(value);
			}
			catch (Exception ex)
			{
			}
		}
		super.setMoney(value);
	}
  /** Metoda za isplatu kojoj proslije�ujemo korisni�ko ime */
  public static void withdraw(String userName) {
    Scanner input = new Scanner(System.in);

    // kreiramo objekat user i dodjeljujemo mu vrijednosti objekta cije smo
    // korisnicko ime proslijedili u metodu
    User user = UserBase.getUser(userName);

    System.out.print("\n   Enter the amount you want to withdraw: ");
    int amount = input.nextInt();

    // provjeravamo da li u bankomatu ima dovolno novca za isplatu
    if (amount > getATMBalance()) {
      System.out.println("U bankomatu nema dovoljno novca za isplatu.");

      // ako korisnik zahtijeva vise od njegovog stanja racuna
    } else if (amount > user.getBalance()) {
      System.out.println("Nemate toliko novaca na ra�unu.");

    } else {
      int brojac100 = 0, brojac50 = 0, brojac20 = 0, brojac10 = 0;
      int isplaceno = 0;
      while (amount >= 100 && brojac100 < novcanica100) {
        amount -= 100;
        brojac100++;
        isplaceno += 100;
      }
      while (amount >= 50 && brojac50 < novcanica50) {
        amount -= 50;
        brojac50++;
        isplaceno += 50;
      }

      while (amount >= 20 && brojac20 < novcanica20) {
        amount -= 20;
        brojac20++;
        isplaceno += 20;
      }
      while (amount >= 10 && brojac10 < novcanica10) {
        amount -= 10;
        brojac10++;
        isplaceno += 10;
      }

      // provjeravamo da li mozemo isplatiti trazeni iznos
      if (amount == 0) {
        novcanica100 -= brojac100;
        novcanica50 -= brojac50;
        novcanica20 -= brojac20;
        novcanica10 -= brojac10;

        // poslije isplate setujemo novu vrjednost stanja na racunu korisnika
        user.setBalance(user.getBalance() - isplaceno);
        System.out.println("\n   Dobili  ste: ");
        if (brojac100 > 0) System.out.println("    - " + brojac100 + " 100KM novcanica,");
        if (brojac50 > 0) System.out.println("    - " + brojac50 + " 50KM novcanica,");
        if (brojac20 > 0) System.out.println("    - " + brojac20 + " 20KM novcanica,");
        if (brojac10 > 0) System.out.println("    - " + brojac10 + " 10KM novcanica.");
        System.out.println("\nProvjerite iznos.\nDodatne reklamacije se ne prihvataju.\n");
      } else {
        System.out.println("Ne mozemo vam isplatiti tu sumu.\n");
      }
    }
  }
Beispiel #5
0
	@Override
	public void addMail(String mail)
	{
		super.addMail(mail);
		gotMailInfo.set(false);
	}
Beispiel #6
0
 private void save() {
   userBase.getStorage().save(this);
 }