Package mock

Examples of mock.SimpleEntity


        doc5.setHeight(1);
        doc5.setCreation(new Date());
        doc5.setMimeType("image/gif");
        doc5.setAuthor((UserImpl) securityDAO.findUser("adminuser"));
        doc5.setContents(contents);
        SimpleEntity entity = new SimpleEntity("john");
        entity.setPhotos(md.addDocument(doc).addDocument(doc3).addDocument(doc4).addDocument(doc5));
        baseDao.create(entity);
        assertNotNull(baseDao.first(SimpleEntity.class));
        assertNotNull(baseDao.first(MultiDocument.class));
    }
View Full Code Here


        MultiDocument md = new MultiDocument();
        assertNull(multiDocumentParser.parse(md));
        md.addDocument(new Document());
        md.addDocument(new Document());
        assertNull(multiDocumentParser.parse(md));
        SimpleEntity entity = baseDao.first(SimpleEntity.class);
        md = baseDao.first(MultiDocument.class);
        md.removeAll();
        MultiDocument parsed = multiDocumentParser.parse(md);
        assertNull(parsed);
        entity.setPhotos(parsed);
        baseDao.update(entity);
        assertNull(baseDao.first(MultiDocument.class));
    }
View Full Code Here

                assertEquals("newimageid", pdoc.getIdentifier());
    }

    @Test
    public void testParseComplicated() throws Exception {
        SimpleEntity entity = baseDao.first(SimpleEntity.class);
        MultiDocument bmd = entity.getPhotos();
        assertTrue(bmd.getDocuments().size() == 4);
        MultiDocument md = new MultiDocument();
        md.setId(bmd.getId());
        md.addDocument(new Document());
        md.getDocuments().iterator().next().setId(bmd.getDocuments().iterator().next().getId());
        Document doc2 = new Document();
        doc2.setTemporal(false);
        doc2.setIdentifier("void image");
        doc2.setWidth(1);
        doc2.setHeight(1);
        doc2.setCreation(new Date());
        doc2.setMimeType("image/gif");
        doc2.setAuthor((UserImpl) securityDAO.findUser("adminuser"));
        doc2.setContents(FileCopyUtils.copyToByteArray(getClass().getResourceAsStream("/void.gif")));
        md.addDocument(doc2);
        Document doc = baseDao.find(Document.class, generatedDocIDs.get(0));
        assertNull(doc.getDocumentGroup());
        Document t = new Document();
        t.setId(doc.getId());
        md.addDocument(t);
        entity.setPhotos(multiDocumentParser.parse(md));
        baseDao.update(entity);
        assertTrue(entity.getPhotos().getDocuments().size() == 2);
    }
View Full Code Here

TOP

Related Classes of mock.SimpleEntity

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.