Package com.volantis.synergetics

Examples of com.volantis.synergetics.BooleanWrapper


    /**
     * Test the method startPrefixMapping    
     */
    public void testStartPrefixMapping() throws Exception {
        final BooleanWrapper calledMethod = new BooleanWrapper(false);
        final String prefixParam = "prefix";
        final String uriParam = "uri";

        AbstractMarlinContentHandler defaultHandler = new TestHandler() {
            // Javadoc inherited from ContentHandler interface
            public void startPrefixMapping(String s, String s1)
                    throws SAXException {
                calledMethod.setValue(true);
                assertEquals("Unexpected parameter value", prefixParam, s);
                assertEquals("Unexpected parameter value", uriParam, s1);
            }
        };

        NamespaceSwitchContentHandler handler =
                new NamespaceSwitchContentHandler(defaultHandler);
        handler.startPrefixMapping(prefixParam, uriParam);

        assertTrue("Expected method to be invoked.", calledMethod.getValue());
    }
View Full Code Here


    /**
     * Test the method endPrefix mapping.    
     */
    public void testEndPrefixMapping() throws Exception {
        final BooleanWrapper calledMethod = new BooleanWrapper(false);
        final String prefixParam = "prefix";       

        AbstractMarlinContentHandler defaultHandler = new TestHandler() {
            // Javadoc inherited from ContentHandler interface
            public void endPrefixMapping(String s)
                    throws SAXException {
                calledMethod.setValue(true);
                assertEquals("Unexpected parameter value", prefixParam, s);               
            }
        };

        NamespaceSwitchContentHandler handler =
                new NamespaceSwitchContentHandler(defaultHandler);
        handler.endPrefixMapping(prefixParam);

        assertTrue("Expected method to be invoked.", calledMethod.getValue());
    }
View Full Code Here

    /**
     * Test the method characters.   
     */
    public void testCharacters() throws Exception {
        final BooleanWrapper calledMethod = new BooleanWrapper(false);
        final char[] charParam = new char[] {'x', 'y', 'z'};
        final int startParam = 37;
        final int lenParam = 13;
       
        AbstractMarlinContentHandler defaultHandler = new TestHandler() {
            // Javadoc inherited from ContentHandler interface
            public void characters(char[] chars, int i, int i1)
                    throws SAXException {
                calledMethod.setValue(true);
                assertEquals("Unexpected param value.", charParam, chars);
                assertEquals("Unexpected param value.", startParam, i);
                assertEquals("Unexpected param value.", lenParam, i1);
            }
        };

        NamespaceSwitchContentHandler handler =
                new NamespaceSwitchContentHandler(defaultHandler);
        handler.characters(charParam, startParam, lenParam);

        assertTrue("Expected method to be invoked.", calledMethod.getValue());
    }
View Full Code Here

    /**
     * Test the method characters.   
     */
    public void testIgnorableWhitespace() throws Exception {
        final BooleanWrapper calledMethod = new BooleanWrapper(false);
        final char[] charParam = new char[]{' ', ' ', ' '};
        final int startParam = 39;
        final int lenParam = 17;

        AbstractMarlinContentHandler defaultHandler = new TestHandler() {
            // Javadoc inherited from ContentHandler interface
            public void ignorableWhitespace(char[] chars, int i, int i1)
                    throws SAXException {
                calledMethod.setValue(true);
                assertEquals("Unexpected param value.", charParam, chars);
                assertEquals("Unexpected param value.", startParam, i);
                assertEquals("Unexpected param value.", lenParam, i1);
            }
        };

        NamespaceSwitchContentHandler handler =
                new NamespaceSwitchContentHandler(defaultHandler);
        handler.ignorableWhitespace(charParam, startParam, lenParam);

        assertTrue("Expected method to be invoked.", calledMethod.getValue());
    }
View Full Code Here

    /**
     * Test the method processingInstruction    
     */
    public void testProcessingInstruction() throws Exception {
        final BooleanWrapper calledMethod = new BooleanWrapper(false);
        final String targetParam = "target";
        final String dataParam = "data";

        AbstractMarlinContentHandler defaultHandler = new TestHandler() {
            // Javadoc inherited from ContentHandler interface
            public void processingInstruction(String s, String s1)
                    throws SAXException {
                calledMethod.setValue(true);
                assertEquals("Unexpected parameter value", targetParam, s);
                assertEquals("Unexpected parameter value", dataParam, s1);
            }
        };

        NamespaceSwitchContentHandler handler =
                new NamespaceSwitchContentHandler(defaultHandler);
        handler.processingInstruction(targetParam, dataParam);

        assertTrue("Expected method to be invoked.", calledMethod.getValue());
    }
View Full Code Here

    /**
     * Test the method skippedEntity    
     */
    public void testSkippedEntity() throws Exception {
        final BooleanWrapper calledMethod = new BooleanWrapper(false);
        final String nameParam = "name";

        AbstractMarlinContentHandler defaultHandler = new TestHandler() {
            // Javadoc inherited from ContentHandler interface
            public void skippedEntity(String s) throws SAXException {
                calledMethod.setValue(true);
                assertEquals("Unexpected parameter value", nameParam, s);
            }
        };

        NamespaceSwitchContentHandler handler =
                new NamespaceSwitchContentHandler(defaultHandler);
        handler.skippedEntity(nameParam);

        assertTrue("Expected method to be invoked.", calledMethod.getValue());
    }
View Full Code Here

    /**
     * Implementation for testPruningAndGC()
     */
    public void doTestPruningAndGC(final GenericCache cache) {

        final BooleanWrapper stop = new BooleanWrapper(false);
        final BooleanWrapper concurrentModificationExceptionThrown =
            new BooleanWrapper(false);

        Thread fillCache = new Thread("Cache Filler") {
            public void run() {
                int count = 0;
                while (!stop.getValue() &&
                    !concurrentModificationExceptionThrown.getValue()) {
                    try {
                        cache.put(new Integer(count), "An Object");
                        count++;
                        // The following sleep allows other threads
                        // to be scheduled. Without this, this test
                        // causes an OutOfMemoryError (tested on IBM JDK).
                        sleep(1);
                    } catch (ConcurrentModificationException e) {
                        concurrentModificationExceptionThrown.setValue(true);
                        throw e;
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };

        fillCache.start();

        for (int i = 0; i < 100 &&
            !concurrentModificationExceptionThrown.getValue(); i++) {
            System.gc();
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

        stop.setValue(true);

        assertTrue(!concurrentModificationExceptionThrown.getValue());
    }
View Full Code Here

TOP

Related Classes of com.volantis.synergetics.BooleanWrapper

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.