Examples of LumifyApi


Examples of io.lumify.web.clientapi.LumifyApi

        lumifyApi.logout();
    }

    private void undoAll() throws IOException, ApiException {
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);
        assertUndoAll(lumifyApi, 34);
        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        assertThumbnailRoute();
        resolveAndUnresolveDetectedObject();
    }

    private void importImageAndPublishAsUser1() throws ApiException, IOException {
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);
        addUserAuth(lumifyApi, USERNAME_TEST_USER_1, "auth1");

        InputStream imageResourceStream = UploadImageFileIntegrationTest.class.getResourceAsStream("/io/lumify/it/sampleImage.jpg");
        ClientApiArtifactImportResponse artifact = lumifyApi.getVertexApi().importFiles(
                new VertexApiExt.FileForImport("auth1", "sampleImage.jpg", imageResourceStream));
        assertEquals(1, artifact.getVertexIds().size());
        artifactVertexId = artifact.getVertexIds().get(0);
        assertNotNull(artifactVertexId);

        lumifyTestCluster.processGraphPropertyQueue();

        ClientApiElement vertex = lumifyApi.getVertexApi().getByVertexId(artifactVertexId);
        boolean foundTesseractText = false;
        for (ClientApiProperty prop : vertex.getProperties()) {
            LOGGER.info(prop.toString());
            if (LumifyProperties.TEXT.getPropertyName().equals(prop.getName()) || MediaLumifyProperties.VIDEO_TRANSCRIPT.getPropertyName().equals(prop.getName())) {
                String highlightedText = lumifyApi.getVertexApi().getHighlightedText(artifactVertexId, prop.getKey());
                LOGGER.info("highlightedText: %s: %s", prop.getKey(), highlightedText);
                if (prop.getKey().startsWith(TesseractGraphPropertyWorker.TEXT_PROPERTY_KEY)) {
                    assertTrue("invalid tesseract text", highlightedText.contains("WORLD SERIES GAME 7"));
                    foundTesseractText = true;
                }
            }
        }
        assertTrue("could not find TesseractText", foundTesseractText);

        assertPublishAll(lumifyApi, 41);

        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

    private void assertRawRoute() throws ApiException, IOException {
        LOGGER.info("assertRawRoute");
        byte[] expected = IOUtils.toByteArray(UploadVideoFileIntegrationTest.class.getResourceAsStream("/io/lumify/it/shortVideo.mp4"));

        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);

        byte[] found = IOUtils.toByteArray(lumifyApi.getVertexApi().getRaw(artifactVertexId));
        assertArrayEquals(expected, found);

        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        lumifyApi.logout();
    }

    private void assertRawRoutePlayback() throws ApiException, IOException {
        LOGGER.info("assertRawRoutePlayback");
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);

        byte[] found = IOUtils.toByteArray(lumifyApi.getVertexApi().getRawForPlayback(artifactVertexId, MediaLumifyProperties.MIME_TYPE_VIDEO_MP4));
        assertTrue(found.length > 0);

        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        lumifyApi.logout();
    }

    private void assertPosterFrameRoute() throws ApiException, IOException {
        LOGGER.info("assertPosterFrameRoute");
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);

        InputStream in = lumifyApi.getVertexApi().getPosterFrame(artifactVertexId, 100);
        BufferedImage img = ImageIO.read(in);
        assertEquals(100, img.getWidth());
        assertEquals(66, img.getHeight());

        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        lumifyApi.logout();
    }

    private void assertVideoPreviewRoute() throws IOException, ApiException {
        LOGGER.info("assertVideoPreviewRoute");
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);

        InputStream in = lumifyApi.getVertexApi().getVideoPreview(artifactVertexId, 100);
        BufferedImage img = ImageIO.read(in);
        assertEquals(2000, img.getWidth());
        assertEquals(66, img.getHeight());

        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        lumifyApi.logout();
    }

    private void resolveTermsAsUser1() throws ApiException {
        LOGGER.info("resolveTermsAsUser1");
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);

        String propertyKey = "io.lumify.subrip.SubRipTranscriptGraphPropertyWorker";
        int videoFrameIndex = 0;
        int mentionStart = "".length();
        int mentionEnd = mentionStart + "Salam".length();
        lumifyApi.getVertexApi().resolveVideoTranscriptTerm(artifactVertexId, propertyKey, videoFrameIndex, mentionStart, mentionEnd, "Salam", CONCEPT_TEST_PERSON, "auth1");

        videoFrameIndex = 2;
        mentionStart = "appalling brutality what we know is that\nthree ".length();
        mentionEnd = mentionStart + "British".length();
        lumifyApi.getVertexApi().resolveVideoTranscriptTerm(artifactVertexId, propertyKey, videoFrameIndex, mentionStart, mentionEnd, "Great Britain", CONCEPT_TEST_PERSON, "auth1");

        lumifyTestCluster.processGraphPropertyQueue();

        String highlightedText = lumifyApi.getVertexApi().getHighlightedText(artifactVertexId, propertyKey);
        LOGGER.info(highlightedText);
        assertTrue("missing highlighting for Salam", highlightedText.contains(">Salam<"));
        assertTrue("missing highlighting for British", highlightedText.contains("three <span") && highlightedText.contains(">British<"));

        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        testGeoSearch();
        testSetTitleAndCheckConfidence();
    }

    private void testOntology() throws ApiException {
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);

        ClientApiOntology ontology = lumifyApi.getOntologyApi().get();

        boolean foundPersonConcept = false;
        for (ClientApiOntology.Concept concept : ontology.getConcepts()) {
            if (concept.getId().equals("http://lumify.io/test#person")) {
                foundPersonConcept = true;
                assertEquals("invalid title formula", "prop('http://lumify.io/test#firstName') + ' ' + prop('http://lumify.io/test#lastName')", concept.getTitleFormula());
                assertEquals("invalid sub-title formula", "prop('http://lumify.io/test#firstName') || ''", concept.getSubtitleFormula());
                assertEquals("invalid time formula", "prop('http://lumify.io/test#birthDate') || ''", concept.getTimeFormula());
            }
        }
        assertTrue("could not find http://lumify.io/test#person", foundPersonConcept);

        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        lumifyApi.logout();
    }

    public void importArtifactAsUser1() throws ApiException, IOException {
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);
        addUserAuth(lumifyApi, USERNAME_TEST_USER_1, "auth1");
        addUserAuth(lumifyApi, USERNAME_TEST_USER_1, "auth2");
        workspaceId = lumifyApi.getCurrentWorkspaceId();

        ClientApiArtifactImportResponse artifact = lumifyApi.getVertexApi().importFile("auth1", "test.txt", new ByteArrayInputStream(FILE_CONTENTS.getBytes()));
        assertEquals(1, artifact.getVertexIds().size());
        artifactVertexId = artifact.getVertexIds().get(0);
        assertNotNull(artifactVertexId);

        lumifyTestCluster.processGraphPropertyQueue();

        assertArtifactCorrect(lumifyApi, true, "auth1");

        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        lumifyApi.logout();
    }

    private void assertUser1CanSeeInSearch() throws ApiException {
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);

        ClientApiVertexSearchResponse searchResults = lumifyApi.getVertexApi().vertexSearch("*");
        LOGGER.debug("searchResults: %s", searchResults.toString());
        assertEquals(1, searchResults.getVertices().size());
        ClientApiVertex searchResult = searchResults.getVertices().get(0);
        assertEquals(artifactVertexId, searchResult.getId());

        lumifyApi.logout();
    }
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.