Examples of SalaryStrategy


Examples of org.jboss.example.service.util.SalaryStrategy

 
  @SuppressWarnings("unchecked")
  String printStatus() {
    boolean hiringFreeze;
    int totalEmployees;
    SalaryStrategy salaryStrategy;
   
    if (useBus) {
      hiringFreeze = (Boolean) invoke(HRSERVICE, "isHiringFreeze", new Object[] {}, new String[] {});
      Set<Employee> employees = (Set<Employee>) invoke(HRSERVICE, "getEmployees", new Object[] {}, new String[] {});
      totalEmployees = employees.size();       
      salaryStrategy = (SalaryStrategy) invoke(HRSERVICE, "getSalaryStrategy", new Object[] {}, new String[] {});
    } else {
      hiringFreeze = manager.isHiringFreeze();
      totalEmployees = manager.getEmployees().size();
      salaryStrategy = manager.getSalaryStrategy();   
   
   
    StringBuffer buffer = new StringBuffer();
    buffer.append("Total number of employees: " + totalEmployees);
    buffer.append("\nHiring Freeze: " + hiringFreeze)
    buffer.append("\nSalary Strategy: ");
    if (salaryStrategy == null) {
      buffer.append("None");
    } else {
      buffer.append(salaryStrategy.toString());
    }
    return buffer.toString();
  }
View Full Code Here

Examples of org.jboss.example.service.util.SalaryStrategy

 
  @SuppressWarnings("unchecked")
  String printStatus() {
    boolean hiringFreeze;
    int totalEmployees;
    SalaryStrategy salaryStrategy;
   
    if (useBus) {
      hiringFreeze = (Boolean) invoke(HRSERVICE, "isHiringFreeze", new Object[] {}, new String[] {});
      Set<Employee> employees = (Set<Employee>) invoke(HRSERVICE, "getEmployees", new Object[] {}, new String[] {});
      totalEmployees = employees.size();       
      salaryStrategy = (SalaryStrategy) invoke(HRSERVICE, "getSalaryStrategy", new Object[] {}, new String[] {});
    } else {
      hiringFreeze = manager.isHiringFreeze();
      totalEmployees = manager.getEmployees().size();
      salaryStrategy = manager.getSalaryStrategy();   
   
   
    StringBuffer buffer = new StringBuffer();
    buffer.append("Total number of employees: " + totalEmployees);
    buffer.append("\nHiring Freeze: " + hiringFreeze)
    buffer.append("\nSalary Strategy: ");
    if (salaryStrategy == null) {
      buffer.append("None");
    } else {
      buffer.append(salaryStrategy.toString());
    }
    return buffer.toString();
  }
View Full Code Here

Examples of org.jboss.example.service.util.SalaryStrategy

  public AgeBasedSalaryTestCase(String name) {
    super(name);
  }

  public void testSalaryRanges() throws Exception {
    SalaryStrategy strategy = (SalaryStrategy) getBean("AgeBasedSalary");
    assertNotNull(strategy);
   
    // Check the minimum and maximum salaries for all employees
    assertEquals(1000, strategy.getMinSalary());   
    assertEquals(80000, strategy.getMaxSalary());   

    // Check the minimum and maximum salaries that bob (age 17) can earn
    assertEquals((Integer) 1000, strategy.checkSalary(bob, 500));
    assertEquals((Integer) 80000, strategy.checkSalary(bob, 85000));

    // Check the minimum and maximum salaries that rebecca (age 25) can earn
    assertEquals((Integer) 25000, strategy.checkSalary(rebecca, 20000));
    assertEquals((Integer) 80000, strategy.checkSalary(rebecca, 90000));
   
    // Check the minimum and maximum salaries that karen (age 44) can earn
    assertEquals((Integer) 50000, strategy.checkSalary(karen, 49000));
    assertEquals((Integer) 80000, strategy.checkSalary(karen, 81000));
   
    // Check the minimum and maximum salaries that joe (age 62) can earn
    assertEquals((Integer) 1000, strategy.checkSalary(joe, 900));
    assertEquals((Integer) 80000, strategy.checkSalary(joe, 90000));
  }
View Full Code Here

Examples of org.jboss.example.service.util.SalaryStrategy

  public LocationBasedSalaryTestCase(String name) {
    super(name);
  }

  public void testSalaryRanges() throws Exception {
    SalaryStrategy strategy = (SalaryStrategy) getBean("LocationBasedSalary");
    assertNotNull(strategy);
   
    // Check the minimum and maximum salaries for all employees
    assertEquals(2000, strategy.getMinSalary());   
    assertEquals(90000, strategy.getMaxSalary());   

    // Check the minimum and maximum salaries that bob (London) can earn
    assertEquals((Integer) 50000, strategy.checkSalary(bob, 30000));
    assertEquals((Integer) 90000, strategy.checkSalary(bob, 95000));

    // Check the minimum and maximum salaries that rebecca (Belfast) can earn
    assertEquals((Integer) 20000, strategy.checkSalary(rebecca, 10000));
    assertEquals((Integer) 90000, strategy.checkSalary(rebecca, 91000));
   
    // Check the minimum and maximum salaries that karen (Glagow) can earn
    assertEquals((Integer) 30000, strategy.checkSalary(karen, 29000));
    assertEquals((Integer) 90000, strategy.checkSalary(karen, 98000));
   
    // Check the minimum and maximum salaries that joe (Manchester) can earn
    assertEquals((Integer) 40000, strategy.checkSalary(joe, 31000));
    assertEquals((Integer) 90000, strategy.checkSalary(joe, 96000));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.