Package java.util

Examples of java.util.Collection.clear()


        JDBCRepositoryImpl repository = (JDBCRepositoryImpl)
                createTestableRepository();

        Collection connections = repository.connections;
        connections.clear();
        JDBCRepositoryConnection connection =
                new JDBCRepositoryConnectionImpl(repository, false, "user",
                                             "password", true);
        connection.getConnection();
        assertEquals("There should be one connection in the connections" +
View Full Code Here


            throws RepositoryException {

        JDBCRepositoryImpl repository =
                (JDBCRepositoryImpl) createTestableRepository();
        Collection connections = repository.connections;
        connections.clear();

        int noOfConnections = 3;

        dataSourceMock.expects.getConnection(null, null)
                .returns(connectionMock).fixed(3);
View Full Code Here

    /**
     * Helper method for updating a collection based property.
     */
    void updateCollectionProperty( Object object, Collection newValue, Method getter ) throws Exception {
        Collection oldValue = (Collection) getter.invoke( object, null );
        oldValue.clear();
        oldValue.addAll( newValue );
    }

    /**
     * Helper method for updating a map based property.
View Full Code Here

        this.wrapped = wrapped;
    }

    public void setObject(Object object) {
        Collection collection = (Collection) wrapped.getObject();
        collection.clear();
        collection.addAll((Collection) object);
    }

    public void detach() {
        wrapped.detach();
View Full Code Here

                    Method g = getter(p);
                   
                    //handle collection case
                    if ( Collection.class.isAssignableFrom( g.getReturnType() ) ) {
                        Collection c = (Collection) g.invoke(proxyObject,null);
                        c.clear();
                        c.addAll( (Collection) v );
                    }
                    else {
                        Method s = setter(p,g.getReturnType());
                       
View Full Code Here

        ValueMetaData vmd = fmd.getElement();
        if (!vmd.isDeclaredTypePC())
            return coll;

        // unfortunately we have to clear the original and re-add
        coll.clear();
        Object elem;
        for (Iterator itr = orig.iterator(); itr.hasNext();) {
            if (vmd.getCascadeAttach() == ValueMetaData.CASCADE_NONE)
                elem = getReference(manager, itr.next(), sm, vmd);
            else
View Full Code Here

        try {
            coll = getProxyManager().copyCollection(orig);
        } catch (Exception e) {
            coll = (Collection) _sm.newFieldProxy(vmd.getFieldMetaData().getIndex());
        }
        coll.clear();
        for (Iterator itr = orig.iterator(); itr.hasNext();)
            coll.add(embed(vmd, itr.next()));
        return coll;
    }
View Full Code Here

        resetFull();
        assertTrue("Full collection shouldn't contain other elements",
                   !collection.containsAll(col));
       
        col.clear();
        col.addAll(Arrays.asList(getFullElements()));
        assertTrue("Full collection should containAll full elements",
                   collection.containsAll(col));
        // make sure calls to "containsAll" don't change anything
        verify();
View Full Code Here

        // clear values, reflected in map
        resetFull();
        Collection values = map.values();
        assertTrue(map.size() > 0);
        assertTrue(values.size() > 0);
        values.clear();
        assertTrue(map.size() == 0);
        assertTrue(values.size() == 0);
       
        // clear map, reflected in values
        resetFull();
View Full Code Here

        Collection coll = new ArrayList();
        coll.add(PredicateUtils.truePredicate());
        coll.add(PredicateUtils.truePredicate());
        coll.add(PredicateUtils.truePredicate());
        assertEquals(true, PredicateUtils.allPredicate(coll).evaluate(null));
        coll.clear();
        coll.add(PredicateUtils.truePredicate());
        coll.add(PredicateUtils.falsePredicate());
        coll.add(PredicateUtils.truePredicate());
        assertEquals(false, PredicateUtils.allPredicate(coll).evaluate(null));
        coll.clear();
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.