Package com.bluetangstudio.searchcloud.client.model

Examples of com.bluetangstudio.searchcloud.client.model.Document


            URI.create("http://localhost:" + port), "apikey"
        );

        UserModelId modelId = new UserModelId(new UserId("test"), "testGetDocument");
        DocumentId docId = new DocumentId(10);
        Document document = client.getDocument(new GetDocumentRequest(modelId, docId));

        Assert.assertNotNull(document);
        Assert.assertEquals(document.getId(), docId);
    }
View Full Code Here


*/
public class SaveDocumentRequestBuilderTest extends RequestBuilderTestBase {

    @Test
    public void buildHttpUriRequest() {
        SaveDocumentRequest save = new SaveDocumentRequest("SaveDocumentRequestBuilderTest", new Document(1));
        setTrackingVariables(save);

        SaveDocumentRequestBuilder builder = new SaveDocumentRequestBuilder();
        HttpUriRequest httpUriRequest = builder.build(save);
        Assert.assertEquals(httpUriRequest.getClass(), HttpPut.class);
View Full Code Here

    public void testUpdateDocument() throws IOException, ServiceException {

        RestSearchCloudClient<Document> client = new RestSearchCloudClient<Document>(new DefaultHttpClientFactory(), getUri(), "apikey");

        String modelId = "test_UpdateDocument";
        Document document = new Document(10);

        client.updateDocument(new UpdateDocumentRequest(modelId, document));

    }
View Full Code Here

                mockedHttpResponse.getEntity();
                result = new StringEntity("1");;
            }
        };

        Assert.assertEquals(client.saveDocument(new SaveDocumentRequest(modelId, new Document(10))), 1);
    }
View Full Code Here

    @Test
    public void testUpdateDocument() throws IOException, ServiceException {

        RestSearchCloudClient client = buildMockRestSearchCloudClient();
        String modelId = "test_UpdateDocument";
        client.updateDocument(new UpdateDocumentRequest(modelId, new Document(10)));

    }
View Full Code Here

    public void testGetDocument() throws IOException, ServiceException {

        RestSearchCloudClient<Document> client = new RestSearchCloudClient<Document>(new DefaultHttpClientFactory(), getUri(), "apikey");

        String modelId = "test_GetDocument";
        Document document = client.getDocument(new GetDocumentRequest(modelId, 10));

        Assert.assertNotNull(document);
        Assert.assertEquals(document.getId(), new Integer(10));
    }
View Full Code Here

    public Document get(@PathParam("modelId") String modelId, @PathParam("docId") Integer docId) {

        Assert.assertNotNull(modelId);
        Assert.assertNotNull(docId);

        return new Document(docId);
    }
View Full Code Here

        Assert.assertTrue(start >= 0);
        Assert.assertTrue(count > 0);

        List<Document> documents = new ArrayList<Document>();
        for (int j = start; j < (start + count); j++) {
            documents.add(new Document(j));
        }

        return documents;
    }
View Full Code Here

        RestSearchCloudClient client = new RestSearchCloudClient(new DefaultHttpClientFactory(), getUri(), "apikey");

        String modelId = "test_SaveDocument";

        Document document = new Document(10);
        document.addString("title", "test");
        Integer documentId = client.saveDocument(new SaveDocumentRequest(modelId, document));
        Assert.assertNotNull(documentId);
        Assert.assertEquals(documentId, new Integer(10));

    }
View Full Code Here

    public void testSaveDocumentWithoutId() throws IOException, ServiceException {

        RestSearchCloudClient client = new RestSearchCloudClient(new DefaultHttpClientFactory(), getUri(), "apikey");

        String modelId = "test_SaveDocument";
        Document document = new Document();
        document.addString("title", "test");
        Integer documentId = client.saveDocument(new SaveDocumentRequest(modelId, document));
        Assert.assertNotNull(documentId);

    }
View Full Code Here

TOP

Related Classes of com.bluetangstudio.searchcloud.client.model.Document

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.