Examples of Department


Examples of org.apache.jdo.tck.pc.company.Department

           
            // Set relationship
            Object emp4Oid = getOidByName("emp4");
            Employee emp4 = (Employee)pm.getObjectById(emp4Oid);
            Object dept2Oid = getOidByName("dept2");
            Department dept2 = (Department)pm.getObjectById(dept2Oid);

            Set emps = new HashSet();
            emps.add(emp4);
            dept1.setEmployees(emps);
            pm.flush();
           
            // Postcondition
            deferredAssertTrue(emp4.getDepartment() == dept1,
                ASSERTION_FAILED + testMethod,
                "Postcondition is false; "
                + "other side of relationship not set on flush");
            deferredAssertTrue(!dept2.getEmployees().contains(emp4),
                ASSERTION_FAILED + testMethod,
                "Postcondition is false; "
                + "previous relationship not unset on flush");
            pm.currentTransaction().commit();
            cleanupPM();
            getPM();
           
            pm.currentTransaction().begin();
            emp4 = (Employee)pm.getObjectById(emp4Oid);
            dept1 = (Department)pm.getObjectById(dept1Oid);
            dept2 = (Department)pm.getObjectById(dept2Oid);
            deferredAssertTrue(emp4.getDepartment() == dept1,
                ASSERTION_FAILED + testMethod,
                "In new transaction, postcondition is false; " +
                "other side of relationship is not set.");
            deferredAssertTrue(!dept2.getEmployees().contains(emp4),
                ASSERTION_FAILED + testMethod,
                "Postcondition is false; "
                + "previous relationship not unset on flush");
            pm.currentTransaction().commit();
           
View Full Code Here

Examples of org.apache.jdo.tck.pc.company.Department

    public void testSetToNewFromMappedSide() {
        testMethod = "testSetToNewFromMappedSide";
        if (isTestToBePerformed) {
           
            // Set relationship
            IDepartment deptNew = new Department(99L, "The New Department");
            pm.makePersistent(deptNew);
            emp1.setDepartment(deptNew);
            Object deptNewOid = pm.getObjectId((Object)deptNew);
            pm.flush();
           
            assertFalse(testMethod + ": Test aborted, precondition is false; " +
                "expected deptNewOid to be non-null", deptNewOid == null);
           
            // Postcondition
            deferredAssertTrue(deptNew.getEmployees().contains(emp1),
                ASSERTION_FAILED + testMethod,
                "Postcondition is false; "
                + "other side of relationship not set on flush");
            deferredAssertTrue(!dept1.getEmployees().contains(emp1),
                ASSERTION_FAILED + testMethod,
                "Postcondition is false; "
                + "previous relationship (dept1) not nulled on flush");
           
            pm.currentTransaction().commit();
            cleanupPM();
            getPM();
           
            pm.currentTransaction().begin();
            emp1 = (Employee)pm.getObjectById(emp1Oid);
            deptNew = (Department)pm.getObjectById(deptNewOid);
            dept1 = (Department)pm.getObjectById(dept1Oid);
            deferredAssertTrue(deptNew.getEmployees().contains(emp1),
                ASSERTION_FAILED + testMethod,
                "Postcondition is false; "
                + "other side of relationship not set in new pm");
            deferredAssertTrue(!dept1.getEmployees().contains(emp1),
                ASSERTION_FAILED + testMethod,
View Full Code Here

Examples of org.apache.openjpa.persistence.common.apps.Department

        List<Department> dlist = new ArrayList<Department>();

        for (int i = 0; i < 5; i++) {
            Course curr = new Course("Math " + i, i * 2, i);
            Course acurr = new ArtCourse(i + 20, "English" + (2 * i));
            Department durr = new Department("CompSci" + i, null, i + 2);
            clist.add(curr);
            clist.add(acurr);
            dlist.add(durr);
        }

View Full Code Here

Examples of org.apache.openjpa.persistence.inheritance.entity.Department

        m.setFirstName("mf1");
        m.setLastName("ml1");
        m.setSalary(1000000);
        m.setVacationDays(20);
               
        Department d = new Department();
        d.setId(1);
        d.setDepartmentName("d1");
        d.setDepartmentManager(m);
        m.setDepartment(d);
       
        Employee e1 = new Employee();
        e1.setId(2);
        e1.setFirstName("ef1");
View Full Code Here

Examples of org.apache.openjpa.persistence.inheritance.entity.Department

            // Create a manager and a department
            em.getTransaction().begin();
            Manager m = new Manager();
            m.setId(1);
            em.persist(m);
            Department dept = new Department();
            dept.setId(1);
            dept.setDepartmentManager(m);
            em.persist(dept);
            m.setDepartment(dept);
            em.getTransaction().commit();
            em.clear();
View Full Code Here

Examples of org.apache.openjpa.persistence.inheritance.entity.Department

        m.setFirstName("mf1");
        m.setLastName("ml1");
        m.setSalary(1000000);
        m.setVacationDays(20);
               
        Department d = new Department();
        d.setId(1);
        d.setDepartmentName("d1");
        d.setDepartmentManager(m);
        m.setDepartment(d);
       
        Employee e1 = new Employee();
        e1.setId(2);
        e1.setFirstName("ef1");
View Full Code Here

Examples of org.apache.wicket.security.examples.customactions.entities.Department

        "false"};
    int size = 5;
    List<Department> data = new ArrayList<Department>(size);
    for (int i = 0; i < size; i++)
    {
      data.add(new Department(organization, departments[i * 3], departments[(i * 3) + 1],
        Boolean.valueOf(departments[(i * 3) + 2]).booleanValue()));
    }
    DEPARTMENTS = data;
  }
View Full Code Here

Examples of org.apache.wink.itest.contextresolver.Department

            // make sure everything is clear before testing
            DepartmentDatabase.clearEntries();

            // create a new Department
            Department newDepartment = new Department();
            newDepartment.setDepartmentId("1");
            newDepartment.setDepartmentName("Marketing");
            JAXBContext context =
                JAXBContext.newInstance(new Class<?>[] {Department.class,
                    DepartmentListWrapper.class});
            Marshaller marshaller = context.createMarshaller();
            StringWriter sw = new StringWriter();
            marshaller.marshal(newDepartment, sw);
            HttpClient client = new HttpClient();
            postMethod = new PostMethod(getBaseURI());
            RequestEntity reqEntity =
                new ByteArrayRequestEntity(sw.toString().getBytes(), "text/xml");
            postMethod.setRequestEntity(reqEntity);
            client.executeMethod(postMethod);

            newDepartment = new Department();
            newDepartment.setDepartmentId("2");
            newDepartment.setDepartmentName("Sales");
            sw = new StringWriter();
            marshaller.marshal(newDepartment, sw);
            client = new HttpClient();
            postMethod = new PostMethod(getBaseURI());
            reqEntity = new ByteArrayRequestEntity(sw.toString().getBytes(), "text/xml");
            postMethod.setRequestEntity(reqEntity);
            client.executeMethod(postMethod);

            // now let's get the list of Departments that we just created
            // (should be 2)
            client = new HttpClient();
            getAllMethod = new GetMethod(getBaseURI());
            client.executeMethod(getAllMethod);
            byte[] bytes = getAllMethod.getResponseBody();
            assertNotNull(bytes);
            InputStream bais = new ByteArrayInputStream(bytes);
            Unmarshaller unmarshaller = context.createUnmarshaller();
            Object obj = unmarshaller.unmarshal(bais);
            assertTrue(obj instanceof DepartmentListWrapper);
            DepartmentListWrapper wrapper = (DepartmentListWrapper)obj;
            List<Department> dptList = wrapper.getDepartmentList();
            assertNotNull(dptList);
            assertEquals(2, dptList.size());

            // now get a specific Department that was created
            client = new HttpClient();
            getOneMethod = new GetMethod(getBaseURI() + "/1");
            client.executeMethod(getOneMethod);
            bytes = getOneMethod.getResponseBody();
            assertNotNull(bytes);
            bais = new ByteArrayInputStream(bytes);
            obj = unmarshaller.unmarshal(bais);
            assertTrue(obj instanceof Department);
            Department dept = (Department)obj;
            assertEquals("1", dept.getDepartmentId());
            assertEquals("Marketing", dept.getDepartmentName());

            // let's send a Head request for both an existent and non-existent
            // resource
            // we are testing to see if header values being set in the resource
            // implementation
View Full Code Here

Examples of org.crank.crud.model.Department

    address.setZipCode("90210");
    return address;
  }
 
  public Department persistDepartments(GenericDao<Department, Long> deptDao) {
    Department dep = new Department();
    dep.setName("Gizmot");
    deptDao.persist(dep);
    departments.add(dep);
    dep = new Department();
    dep.setName("Bistor");
    deptDao.persist(dep);
    departments.add(dep);
    dep = new Department();
    dep.setName("Zible");
    deptDao.persist(dep);
    departments.add(dep);
    return deptDao.read(dep.getId());
  }
View Full Code Here

Examples of org.crank.crud.test.model.Department

    this.departmentDao = departmentDao;
    this.employeeDao = employeeDao;
  }

  public void setupEmployeeData() {
    Department engineeringDept = departmentDao.read(1L);
    Department itDept = departmentDao.read(2L);
    Department hrDept = departmentDao.read(3L);

    Employee[] employees = {
      new Employee("Rick", "Hightower", engineeringDept, true, 40, 1, "333333331"),
      new Employee("Chris", null, engineeringDept, true, 40, 1, "333333332"),
      new Employee("Scott", null, engineeringDept, true, 40, 1, "333333333"),
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.