Package com.datasift.client.core

Examples of com.datasift.client.core.Validation


     * validation was successful or not
     */
    public FutureData<Validation> validate(String csdl) {
        FutureData<Validation> future = new FutureData<Validation>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(VALIDATE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new Validation(), config)))
                .form("csdl", csdl);
        applyConfig(request).execute();
        return future;
    }
View Full Code Here


     * validation was successful or not
     */
    public FutureData<Validation> validate(String csdl) {
        FutureData<Validation> future = new FutureData<Validation>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(VALIDATE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new Validation(), config)))
                .form("csdl", csdl);
        performRequest(future, request);
        return future;
    }
View Full Code Here

//        detail.put("detail", detailData);
    }

    @Test
    public void testIfUserCanValidateCSDL() {
        Validation validation = datasift.validate(csdl).sync();
        assertTrue(validation.isSuccessful());

//        DateTime actualDate = validation.getCreatedAt();
//        float actualDpu = validation.getDpu();
//
//        assertEquals(createdAt.getMillis(), actualDate.getMillis());
View Full Code Here

    @Test(expected = DataSiftException.class)
    public void testInvalidCSDL() {
        final DataSiftConfig config = new DataSiftConfig("zcourts", "this-is-wrong");
        final DataSiftClient client = new DataSiftClient(config);
        final String csdl = "twitter.media exists";
        final Validation validation = client.validate(csdl).sync();
        Assert.assertFalse(validation.isValid());
    }
View Full Code Here

        Stream stream = Stream.fromString("13e9347e7da32f19fcdb08e297019d2e");
        Dpu dpu = datasift.dpu(stream).sync();

        Balance balance = datasift.balance().sync();
        //synchronously validate a CSDL
        Validation validation = datasift.validate(csdl).sync();
        if (!validation.isSuccessful()) {
            //if true an exception may have caused the request to fail, inspect the cause if available
            if (validation.failureCause() != null) { //may not be an exception
                validation.failureCause().printStackTrace();
            }
            return;
        }
        System.out.println(validation);
        if (validation.isSuccessful()) {
            //we now know it's valid so asynchronously compile the CSDL and obtain a stream
            FutureData<Stream> compiledStream = datasift.compile(csdl);
            compiledStream.onData(new FutureResponse<Stream>() {
                public void apply(Stream data) {
                    System.out.println(data);
View Full Code Here

        final DataSiftClient datasift = new DataSiftClient(config);
        String csdl = "interaction.content contains \"some string\"";
        //both sync and async processing are supported by calling "sync" on any FutureDate object

        //synchronously validate a CSDL
        Validation validation = datasift.core().validate(csdl).sync();
        if (validation.hasFailed()) {
            //if true an exception may have caused the request to fail, inspect the cause if available
            if (validation.failureCause() != null) { //may not be an exception
                validation.failureCause().printStackTrace();
            }
            return;
        }
        System.out.println(validation);
        if (validation.isSuccessful()) {
            //we now know it's valid so asynchronously compile the CSDL and obtain a stream
            FutureData<Stream> stream = datasift.core().compile(csdl);
            FutureData<Dpu> dpus = datasift.core().dpu(stream);
            dpus.onData(new FutureResponse<Dpu>() {
                public void apply(Dpu data) {
View Full Code Here

     * validation was successful or not
     */
    public FutureData<Validation> validate(String csdl) {
        FutureData<Validation> future = new FutureData<Validation>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(VALIDATE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new Validation(), config)))
                .form("csdl", csdl);
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

        Stream stream = Stream.fromString("13e9347e7da32f19fcdb08e297019d2e");
        Dpu dpu = datasift.dpu(stream).sync();

        Balance balance = datasift.balance().sync();
        //synchronously validate a CSDL
        Validation validation = datasift.validate(csdl).sync();
        if (!validation.isSuccessful()) {
            //if true an exception may have caused the request to fail, inspect the cause if available
            if (validation.failureCause() != null) { //may not be an exception
                validation.failureCause().printStackTrace();
            }
            return;
        }
        System.out.println(validation);
        if (validation.isSuccessful()) {
            //we now know it's valid so asynchronously compile the CSDL and obtain a stream
            FutureData<Stream> compiledStream = datasift.compile(csdl);
            compiledStream.onData(new FutureResponse<Stream>() {
                public void apply(Stream data) {
                    System.out.println(data);
View Full Code Here

     * validation was successful or not
     */
    public FutureData<Validation> validate(String csdl) {
        FutureData<Validation> future = new FutureData<Validation>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(VALIDATE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new Validation(), config)))
                .form("csdl", csdl);
        performRequest(future, request);
        return future;
    }
View Full Code Here

TOP

Related Classes of com.datasift.client.core.Validation

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.