Package net.sourceforge.cruisecontrol.sourcecontrols

Examples of net.sourceforge.cruisecontrol.sourcecontrols.MockSourceControl


        assertEquals(0, modSet.getQuietPeriodDifference(now, mods1));
        assertEquals(2000, modSet.getQuietPeriodDifference(now, mods2));
    }

    public void testGetModifications() throws Exception {
        MockSourceControl mock1 = new MockSourceControl();
        mock1.setType(1);
        MockSourceControl mock2 = new MockSourceControl();
        mock2.setType(2);

        modSet.addSourceControl(mock1);
        modSet.addSourceControl(mock2);

        Element modSetResults = modSet.getModifications(new Date()); //mock source controls don't care about the date

        SimpleDateFormat formatter = new SimpleDateFormat(DateFormatFactory.getFormat());
        Element modificationsElement = new Element("modifications");
        Iterator mock1ModificationsIterator = mock1.getModifications(new Date(), new Date()).iterator();
        while (mock1ModificationsIterator.hasNext()) {
            Modification modification = (Modification) mock1ModificationsIterator.next();
            modificationsElement.addContent(modification.toElement(formatter));
        }
        Iterator mock2ModificationsIterator = mock2.getModifications(new Date(), new Date()).iterator();
        while (mock2ModificationsIterator.hasNext()) {
            Modification modification = (Modification) mock2ModificationsIterator.next();
            modificationsElement.addContent(modification.toElement(formatter));
        }
View Full Code Here


                outputter.outputString(expectedModificationsElement),
                outputter.outputString(modSetResults));
    }

    public void testGetProperties() throws Exception {
        MockSourceControl mock1 = new MockSourceControl();
        mock1.setType(1);
        MockSourceControl mock2 = new MockSourceControl();
        mock2.setType(2);

        modSet.addSourceControl(mock1);
        modSet.addSourceControl(mock2);

        modSet.getModifications(new Date()); //mock source controls don't care about the date

        Hashtable table = modSet.getProperties();
        assertNotNull("Properties shouldn't be null.", table);
        assertEquals("Properties should be empty.", 0, table.size());

        modSet = new ModificationSet();
        modSet.setQuietPeriod(0);
        mock1 = new MockSourceControl();
        mock2 = new MockSourceControl();
        mock1.setType(1);
        mock2.setType(2);
        mock1.setProperty("property");
        mock2.setPropertyOnDelete("propertyOnDelete");

        modSet.addSourceControl(mock1);
        modSet.addSourceControl(mock2);

        modSet.getModifications(new Date()); //mock source controls don't care about the date

        table = modSet.getProperties();
        assertNotNull("Properties shouldn't be null.", table);
        assertEquals("Properties should should have 2 entries.", 2, table.size());
        assertTrue("Property not found.", table.containsKey("property"));
        assertTrue("PropertyOnDelete not found.", table.containsKey("propertyOnDelete"));

        modSet = new ModificationSet();
        modSet.setQuietPeriod(0);
        mock1 = new MockSourceControl();
        mock1.setType(1);
        mock1.setProperty("property");

        modSet.addSourceControl(mock1);
        modSet.getModifications(new Date()); //mock source controls don't care about the date
View Full Code Here

        assertEquals(0, modSet.getQuietPeriodDifference(now, mods1));
        assertEquals(2000, modSet.getQuietPeriodDifference(now, mods2));
    }

    public void testGetModifications() throws Exception {
        MockSourceControl mock1 = new MockSourceControl();
        mock1.setType(1);
        MockSourceControl mock2 = new MockSourceControl();
        mock2.setType(2);

        modSet.addSourceControl(mock1);
        modSet.addSourceControl(mock2);

        Element modSetResults = modSet.getModifications(new Date()); //mock source controls don't care about the date

        DateFormat formatter = DateFormatFactory.getDateFormat();
        Element modificationsElement = new Element("modifications");
        Iterator mock1ModificationsIterator = mock1.getModifications(new Date(), new Date()).iterator();
        while (mock1ModificationsIterator.hasNext()) {
            Modification modification = (Modification) mock1ModificationsIterator.next();
            modificationsElement.addContent(modification.toElement(formatter));
        }
        Iterator mock2ModificationsIterator = mock2.getModifications(new Date(), new Date()).iterator();
        while (mock2ModificationsIterator.hasNext()) {
            Modification modification = (Modification) mock2ModificationsIterator.next();
            modificationsElement.addContent(modification.toElement(formatter));
        }
View Full Code Here

        result.add(mod1.toElement(formatter));
        result.add(mod2);

        assertEquals(mod1.modifiedTime.getTime(), modSet.getLastModificationMillis(result));

        modSet.addSourceControl(new MockSourceControl() {
            public List getModifications(Date lastBuild, Date now) {
                return result;
            }
        });
View Full Code Here

        assertEquals("XML data differ", outputter.outputString(expected), outputter.outputString(actual));

    }

    public void testGetProperties() throws Exception {
        MockSourceControl mock1 = new MockSourceControl();
        mock1.setType(1);
        MockSourceControl mock2 = new MockSourceControl();
        mock2.setType(2);

        modSet.addSourceControl(mock1);
        modSet.addSourceControl(mock2);

        modSet.getModifications(new Date()); //mock source controls don't care about the date

        Hashtable table = modSet.getProperties();
        assertNotNull("Properties shouldn't be null.", table);
        assertEquals("Properties should be empty.", 0, table.size());

        modSet = new ModificationSet();
        modSet.setQuietPeriod(0);
        mock1 = new MockSourceControl();
        mock2 = new MockSourceControl();
        mock1.setType(1);
        mock2.setType(2);
        mock1.setProperty("property");
        mock2.setPropertyOnDelete("propertyOnDelete");

        modSet.addSourceControl(mock1);
        modSet.addSourceControl(mock2);

        modSet.getModifications(new Date()); //mock source controls don't care about the date

        table = modSet.getProperties();
        assertNotNull("Properties shouldn't be null.", table);
        assertEquals("Properties should should have 2 entries.", 2, table.size());
        assertTrue("Property not found.", table.containsKey("property"));
        assertTrue("PropertyOnDelete not found.", table.containsKey("propertyOnDelete"));

        modSet = new ModificationSet();
        modSet.setQuietPeriod(0);
        mock1 = new MockSourceControl();
        mock1.setType(1);
        mock1.setProperty("property");

        modSet.addSourceControl(mock1);
        modSet.getModifications(new Date()); //mock source controls don't care about the date
View Full Code Here

TOP

Related Classes of net.sourceforge.cruisecontrol.sourcecontrols.MockSourceControl

Copyright © 2018 www.massapicom. 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.