Examples of VolunteerApplication


Examples of org.spw.model.VolunteerApplication

        int begin = applicationString.lastIndexOf('[') + 1;
        int last  = applicationString.lastIndexOf(']');
        if (begin < 0 || last < 0 || begin > last) return null;
       
        String number = applicationString.substring(begin, last);
        VolunteerApplication retValue = null;
        try {
            retValue = read(Long.parseLong(number));
        } catch (NumberFormatException ex) {
            //incorrect number, could not appen
            Logger.getLogger(VolunteerApplicationController.class.getName()).severe(applicationString +
View Full Code Here

Examples of org.spw.model.VolunteerApplication

    protected void tearDown() throws Exception {
        VolunteerController vc = new VolunteerController();
        Volunteer v = vc.read(TEST_ID);
        if (v != null) vc.delete(v);
        VolunteerApplicationController vac = new VolunteerApplicationController();
        VolunteerApplication va = vac.read(TEST_ID);
        if (va != null) vac.delete(va);
       
    }
View Full Code Here

Examples of org.spw.model.VolunteerApplication

        volunteer.setIdContact(TEST_ID);
        volunteer.setFirstName(getName());
        volunteer.setLastName(getName());
        volunteer.setTypeVolunteer("Potential");
       
        VolunteerApplication application = new VolunteerApplication();
        application.setIdApplication(TEST_ID);
       
        //obtain a program
        ProgramController pc = new ProgramController();
        Program aProgram = pc.getPrograms().get(0);
        application.setProgram(aProgram);
       
        VolunteerController instance = new VolunteerController();
       
        Volunteer result = instance.addApplication(volunteer, application, null);
        assertNotNull(result);
        assertEquals(volunteer, result);
        assertEquals(application, result.getApplication());
        assertEquals(aProgram, result.getApplication().getProgram());
       
        aProgram = pc.read(aProgram.getIdProgram());
        List<VolunteerApplication> theApplications =
                new ArrayList<VolunteerApplication> (aProgram.getApplications());
        assertTrue("Cannot find the inserted application in the program", theApplications.contains(application));

        //Check the application
        VolunteerApplicationController vac = new VolunteerApplicationController ();
        application = vac.read(application.getIdApplication());
        assertEquals(volunteer, application.getVolunteer());
       
        // Change the program
        Program anotherProgram = pc.getPrograms().get(1);
        application.setProgram(anotherProgram);
        volunteer = instance.addApplication(volunteer, application, aProgram);
        aProgram = pc.read(aProgram.getIdProgram());
        theApplications =
                new ArrayList<VolunteerApplication> (aProgram.getApplications());
        assertFalse("Find the stale application in the previous program", theApplications.contains(application));
View Full Code Here

Examples of org.spw.model.VolunteerApplication

        if (! (person instanceof Volunteer)) {
            return null;
        } else {
            getSessionBean1().setVolunteer((Volunteer) person);
        }
        VolunteerApplication application = getSessionBean1().getVolunteer().getApplication();
        if (application == null) {
            application = new VolunteerApplication();
        }
        getSessionBean1().setVolunteerApplication(application);
       
        return "application";
    }
View Full Code Here

Examples of org.spw.model.VolunteerApplication

        if (! (person instanceof Volunteer)) {
            return null;
        } else {
            getSessionBean1().setVolunteer((Volunteer) person);
        }
        VolunteerApplication application = getSessionBean1().getVolunteer().getApplication();
        if (application == null) {
            return null;
        }
        getSessionBean1().setVolunteerApplication(application);
        Program program = application.getProgram();
        getSessionBean1().setProgram(program);
       
        return "application";
    }
View Full Code Here

Examples of org.spw.model.VolunteerApplication

    public String hyperlinkContributions_action() {
        Person person = getSessionBean1().getPerson();
        if (! (person instanceof Volunteer)) {
            return null;
        }
        VolunteerApplication application = getSessionBean1().getVolunteer().getApplication();
        if (application == null) {
            return null;
        }
        getSessionBean1().getContributionDataProvider().setApplication(application);
       
View Full Code Here

Examples of org.spw.model.VolunteerApplication

    public VolunteerApplicationControllerTest(String testName) {
        super(testName);
    }
   
    protected void setUp() throws Exception {
        VolunteerApplication test = new VolunteerApplication();
        test.setIdApplication(TEST_ID);
        test.setDetailInfoSent(getName());
        ctrl.create(test);
    }
View Full Code Here

Examples of org.spw.model.VolunteerApplication

        test.setDetailInfoSent(getName());
        ctrl.create(test);
    }
   
    protected void tearDown() throws Exception {
        VolunteerApplication va;
        //TODO:check all teardown and add a check if read = null
        for (long id = TEST_ID; id <= TEST_ID +1; id++) {
            va = ctrl.read(id);
            if (va != null) ctrl.delete(va);
        }
View Full Code Here

Examples of org.spw.model.VolunteerApplication

    public void testParse() {
        System.out.println("parse");
       
        String id = "";
       
        VolunteerApplication result = ctrl.parse(id);
        assertNull("Must not find a VolunteerApplication with incorrect string rep.", result);
        id = null;
        assertNull("Must not find a VolunteerApplication with incorrect string rep.", result);
        id = "]" + TEST_ID + "[";
        assertNull("Must not find a VolunteerApplication with incorrect string rep.", result);
       
        id = "anything[" + TEST_ID + "]";
        result = ctrl.parse(id);
        assertEquals((long)TEST_ID, (long)result.getIdApplication());
    }
View Full Code Here

Examples of org.spw.model.VolunteerApplication

     * Test of create method, of class org.spw.controller.VolunteerApplicationController.
     */
    public void testCreate() {
        System.out.println("create");
       
        VolunteerApplication va = new VolunteerApplication();
        va.setIdApplication(TEST_ID + 1);
        va.setDetailInfoSent(getName());
        VolunteerApplicationController instance = new VolunteerApplicationController();
        Contribution c1 = new Contribution();
        c1.setReference(getName());
        va.addContribution(c1);
       
        instance.create(va);
       
        va = instance.read(TEST_ID + 1);
        assertEquals(getName(), va.getContributions().get(0).getReference());
       
        //double
        VolunteerApplication vaDouble = new VolunteerApplication();
        vaDouble.setIdApplication(TEST_ID + 1);
        vaDouble.setDetailInfoSent(getName());
        try {
            instance.create(vaDouble);
            fail("double must throw an exception");
        } catch (EntityExistsException ex) {
            //OK
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.