Examples of ObjectGenerator


Examples of org.apache.chemistry.opencmis.util.repository.ObjectGenerator

    public void testQueryPaging() {
        log.info("starting testQuery() ...");

        String statement;
        ObjectList res;
        ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepSvc, fRepositoryId);
        gen.setNumberOfDocumentsToCreatePerFolder(3);
        gen.setDocumentTypeId(TEST_DOCUMENT_TYPE_ID);
        gen.setFolderTypeId(TEST_FOLDER_TYPE_ID);

        List<String> propsToSet = new ArrayList<String>();
        propsToSet.add(TEST_DOCUMENT_STRING_PROP_ID);
        gen.setDocumentPropertiesToGenerate(propsToSet);

        propsToSet = new ArrayList<String>();
        propsToSet.add(TEST_FOLDER_STRING_PROP_ID);
        gen.setFolderPropertiesToGenerate(propsToSet);

        gen.createFolderHierachy(2, 2, fRootFolderId);

        Boolean searchAllVersions = Boolean.FALSE;
        Boolean includeAllowableActions = Boolean.FALSE;
        IncludeRelationships includeRelationships = IncludeRelationships.NONE;
        String renditionFilter = null;
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.repository.ObjectGenerator

            String documentType, String folderType, int contentSizeInKB, String rootFolderId, boolean doCleanup) {

        MultiThreadedObjectGenerator.ObjectGeneratorRunner runner = MultiThreadedObjectGenerator.prepareForCreateTree(
                getClientBindings(), repoId, docsPerFolder, foldersPerFolders, depth, documentType, folderType,
                contentSizeInKB, rootFolderId, fContentKind, doCleanup);
        ObjectGenerator gen = runner.getObjectGenerator();
        runner.doCreateTree();

        System.out.println();
        System.out.println("Result:");
        System.out.println("Filling repository succeeded.");
        System.out.println("Folder used as root for creation (null=rootFolderId): " + rootFolderId);
        System.out.println("Number of documents created: " + gen.getDocumentsInTotal());
        System.out.println("Number of folders created: " + gen.getFoldersInTotal());
        gen.printTimings();
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.repository.ObjectGenerator

            int docCount, boolean doCleanup) {

        MultiThreadedObjectGenerator.ObjectGeneratorRunner runner = MultiThreadedObjectGenerator
                .prepareForCreateDocument(getClientBindings(), repoId, documentType, contentSizeInKB, rootFolderId, docCount,
                        fContentKind, doCleanup);
        ObjectGenerator gen = runner.getObjectGenerator();
        String[] ids = runner.doCreateDocument();
        System.out.println();
        System.out.println("Result:");
        System.out.println("Document creation succeeded.");
        System.out.println("Folder used as root for creation: " + rootFolderId);
        System.out.println("Ids of created documents: ");
        if (null == ids) {
            System.out.println("<none>");
        } else {
            for (int i = 0; i < ids.length; i++) {
                System.out.println(ids[i]);
            }
        }
        gen.printTimings();
        gen.resetCounters();
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.repository.ObjectGenerator

    private void createFolders(String repoId, String folderType, String rootFolderId, int noFolders, boolean doCleanup) {

        MultiThreadedObjectGenerator.ObjectGeneratorRunner runner = MultiThreadedObjectGenerator
                .prepareForCreateFolder(getClientBindings(), repoId, folderType, rootFolderId, noFolders, doCleanup);
        ObjectGenerator gen = runner.getObjectGenerator();
        String[] ids = runner.doCreateFolder();
        System.out.println();
        System.out.println("Result:");
        System.out.println("Folder creation succeeded.");
        System.out.println("Ids of created folders: ");
        if (null == ids) {
            System.out.println("<none>");
        } else {
            for (int i = 0; i < ids.length; i++) {
                System.out.println(ids[i]);
            }
        }
        gen.printTimings();
        gen.resetCounters();
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.repository.ObjectGenerator

        System.out.println("Number of files: " + count);
        System.out.println("File name pattern: " + fileNamePattern);
        System.out.println("Kind of content: " + options.valueOf(fContentKindStr));
        System.out.println("Size of content (text only): " + contentSize);
       
        ObjectGenerator objGen = new ObjectGenerator(null, null, null, null, null, fContentKind);
        objGen.setContentSizeInKB(contentSize);
       
        InputStream is = null;
        FileOutputStream os = null;
       
        try {
            for (int i=0; i<count; i++) {
                String fileName = String.format(fileNamePattern, i);
                System.out.println("Generating file: " + fileName);
                if (contentSize > 0) {
                    switch (fContentKind) {
                    case StaticText:
                        contentStream = objGen.createContentStaticText();
                        break;
                    case LoremIpsumText:
                        contentStream =  objGen.createContentLoremIpsumText();
                        break;
                    case LoremIpsumHtml:
                        contentStream =  objGen.createContentLoremIpsumHtml();
                        break;
                    case ImageFractalJpeg:
                        contentStream =  objGen.createContentFractalimageJpeg();
                        break;
                    }
                }

                // write to a file:
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.repository.ObjectGenerator

                    contentKind = ObjectGenerator.CONTENT_KIND.ImageFractalJpeg;
                else
                    contentKind = ObjectGenerator.CONTENT_KIND.StaticText;
            }
            // Create a hierarchy of folders and fill it with some documents
            ObjectGenerator gen = new ObjectGenerator(objectFactory, svc, svc, svc, repositoryId, contentKind);

            gen.setNumberOfDocumentsToCreatePerFolder(docsPerLevel);

            // Set the type id for all created documents:
            gen.setDocumentTypeId(documentTypeId);

            // Set the type id for all created folders:
            gen.setFolderTypeId(folderTypeId);

            // Set contentSize
            gen.setContentSizeInKB(contentSizeKB);

            // set properties that need to be filled
            // set the properties the generator should fill with values for
            // documents:
            // Note: must be valid properties in configured document and folder
            // type

            List<String> propsToSet = readPropertiesToSetFromConfig(parameters,
                    ConfigConstants.FILLER_DOCUMENT_PROPERTY);
            if (null != propsToSet) {
                gen.setDocumentPropertiesToGenerate(propsToSet);
            }

            propsToSet = readPropertiesToSetFromConfig(parameters, ConfigConstants.FILLER_FOLDER_PROPERTY);
            if (null != propsToSet) {
                gen.setFolderPropertiesToGenerate(propsToSet);
            }

            // Simulate a runtime context with configuration parameters
            // Attach the CallContext to a thread local context that can be
            // accessed
            // from everywhere
            DummyCallContext ctx = new DummyCallContext();
            svc.setCallContext(ctx);

            // Build the tree
            RepositoryInfo rep = svc.getRepositoryInfo(repositoryId, null);
            String rootFolderId = rep.getRootFolderId();

            try {
                gen.createFolderHierachy(levels, childrenPerLevel, rootFolderId);
                // Dump the tree
                gen.dumpFolder(rootFolderId, "*");
            } catch (Exception e) {
                LOG.error("Could not create folder hierarchy with documents. " + e);
                e.printStackTrace();
            }
        } // if
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.repository.ObjectGenerator

    @Test
    public void testBuildFolderAndDocuments() {
        // Create a hierarchy of folders and fill it with some documents

        ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepSvc, fRepositoryId,
                ObjectGenerator.CONTENT_KIND.LoremIpsumText);
        int levels = 2; // create a hierarchy with two levels
        int childrenPerLevel = 2; // create two folders on each level

        gen.setNumberOfDocumentsToCreatePerFolder(1); // create one document in
        // each folder

        // Set the type id for all created documents:
        gen.setDocumentTypeId(TEST_DOCUMENT_TYPE_ID);

        // Set the type id for all created folders:
        gen.setFolderTypeId(TEST_FOLDER_TYPE_ID);

        // set the properties the generator should fill with values for
        // documents:
        // Note: must be valid properties in type TEST_DOCUMENT_TYPE_ID
        List<String> propsToSet = new ArrayList<String>();
        propsToSet.add(TEST_DOCUMENT_STRING_PROP_ID);
        gen.setDocumentPropertiesToGenerate(propsToSet);

        // set the properties the generator should fill with values for folders:
        // Note: must be valid properties in type TEST_FOLDER_TYPE_ID
        propsToSet = new ArrayList<String>();
        propsToSet.add(TEST_FOLDER_STRING_PROP_ID);
        gen.setFolderPropertiesToGenerate(propsToSet);

        // Build the tree
        try {
            gen.createFolderHierachy(levels, childrenPerLevel, fRootFolderId);
            // Dump the tree
            gen.dumpFolder(fRootFolderId, "*");
        } catch (Exception e) {
            fail("Could not create folder hierarchy with documents. " + e);
        }
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.repository.ObjectGenerator

    }

    @Test
    public void testDeleteTree() {
        log.info("starting testDeleteTree() ...");
        ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepSvc, fRepositoryId,
                ObjectGenerator.CONTENT_KIND.LoremIpsumText);
        String rootFolderId = createFolder();
        // Set the type id for all created documents:
        gen.setDocumentTypeId(InMemoryDocumentTypeDefinition.getRootDocumentType().getId());
        // Set the type id for all created folders:
        gen.setFolderTypeId(InMemoryFolderTypeDefinition.getRootFolderType().getId());
        gen.setNumberOfDocumentsToCreatePerFolder(2); // create two documents in
        // each folder
        gen.createFolderHierachy(1, 1, rootFolderId);
        try {
            fObjSvc.deleteTree(fRepositoryId, rootFolderId, null /* true */, UnfileObject.DELETE, true, null);
        } catch (Exception e) {
            fail("deleteTree failed unexpected. " + e);
        }
        log.info("Dumping folder, should only contain one empty folder under root");
        gen.dumpFolder(fRootFolderId, "*");

        // After that we should be not be able to get the root folder, because
        // it should be deleted
        try {
            fObjSvc.getObject(fRepositoryId, rootFolderId, "*", false, IncludeRelationships.NONE, null, false, false,
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.repository.ObjectGenerator

        // PropertyIds
        // .
        // CMIS_BASE_TYPE_ID
        // ;
        String rootFolderId = createFolder();
        ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepSvc, fRepositoryId,
                ObjectGenerator.CONTENT_KIND.LoremIpsumText);
        // Set the type id for all created documents:
        gen.setDocumentTypeId(InMemoryDocumentTypeDefinition.getRootDocumentType().getId());
        // Set the type id for all created folders:
        gen.setNumberOfDocumentsToCreatePerFolder(1); // create one document in
        // each folder
        gen.createFolderHierachy(3, 2, rootFolderId);
        gen.setFolderTypeId(InMemoryFolderTypeDefinition.getRootFolderType().getId());
        gen.dumpFolder(fRootFolderId, propertyFilter);
        Holder<String> holder = new Holder<String>();
        String sourceIdToMove = gen.getFolderId(rootFolderId, 2, 1);
        if (!isFolder) {
            sourceIdToMove = gen.getDocumentId(sourceIdToMove, 0);
        }
        holder.setValue(sourceIdToMove); // "/Folder_1/My Folder 0/My Folder 1");
        String sourceFolderId = getSourceFolder(sourceIdToMove);
        log.info("Id before moveObject: " + holder.getValue());
        fObjSvc.moveObject(fRepositoryId, holder, rootFolderId, sourceFolderId, null);
        log.info("Id after moveObject: " + holder.getValue());
        gen.dumpFolder(fRootFolderId, propertyFilter);

        List<ObjectParentData> result = fNavSvc.getObjectParents(fRepositoryId, holder.getValue(), null, Boolean.FALSE,
                IncludeRelationships.NONE, null, Boolean.FALSE, null);
        // check that new parent is set correctly
        String newParentId = result.get(0).getObject().getId();
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.repository.ObjectGenerator

        }
    }

    private int createFolderHierachy(int levels, int childrenPerLevel) {

        ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepSvc, fRepositoryId,
                ObjectGenerator.CONTENT_KIND.LoremIpsumText);
        gen.createFolderHierachy(levels, childrenPerLevel, fRootFolderId);
        int objCount = gen.getObjectsInTotal();
        return objCount;
    }
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.