Search in sources :

Example 46 with ConstraintViolationException

use of javax.validation.ConstraintViolationException in project apex-malhar by apache.

the class ApplicationTest method testApplication.

@Test
@Ignore
public void testApplication() throws IOException, Exception {
    try {
        LocalMode lma = LocalMode.newInstance();
        Configuration conf = new Configuration(false);
        conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties-SimpleJdbcToHDFSApp.xml"));
        lma.prepareDAG(new JdbcHDFSApp(), conf);
        LocalMode.Controller lc = lma.getController();
        // runs for 10 seconds and quits
        lc.run(10000);
    } catch (ConstraintViolationException e) {
        Assert.fail("constraint violations: " + e.getConstraintViolations());
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) LocalMode(com.datatorrent.api.LocalMode) ConstraintViolationException(javax.validation.ConstraintViolationException) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 47 with ConstraintViolationException

use of javax.validation.ConstraintViolationException in project apex-malhar by apache.

the class ApplicationTest method testApplication.

@Test
public void testApplication() throws Exception {
    try {
        // delete output file if it exists
        File file = new File(FILE_PATH);
        file.delete();
        // write messages to Kafka topic
        writeToTopic();
        // run app asynchronously; terminate after results are checked
        LocalMode.Controller lc = asyncRun();
        // check for presence of output file
        chkOutput();
        // compare output lines to input
        compare();
        lc.shutdown();
    } catch (ConstraintViolationException e) {
        Assert.fail("constraint violations: " + e.getConstraintViolations());
    }
}
Also used : LocalMode(com.datatorrent.api.LocalMode) ConstraintViolationException(javax.validation.ConstraintViolationException) File(java.io.File) Test(org.junit.Test)

Example 48 with ConstraintViolationException

use of javax.validation.ConstraintViolationException in project apex-malhar by apache.

the class JdbcOperatorTest method testApplication.

@Test
public void testApplication() throws Exception {
    try {
        LocalMode lma = LocalMode.newInstance();
        Configuration conf = new Configuration(false);
        conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties-JdbcToJdbcApp.xml"));
        lma.prepareDAG(new JdbcToJdbcApp(), conf);
        LocalMode.Controller lc = lma.getController();
        lc.runAsync();
        // wait for records to be added to table
        Thread.sleep(5000);
        Assert.assertEquals("Events in store", 10, getNumOfEventsInStore());
        dropTable();
    } catch (ConstraintViolationException e) {
        Assert.fail("constraint violations: " + e.getConstraintViolations());
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) LocalMode(com.datatorrent.api.LocalMode) ConstraintViolationException(javax.validation.ConstraintViolationException) Test(org.junit.Test)

Example 49 with ConstraintViolationException

use of javax.validation.ConstraintViolationException in project apex-malhar by apache.

the class ApplicationTest method testApplication.

@Test
public void testApplication() throws IOException, Exception {
    try {
        createTopics();
        // run app asynchronously; terminate after results are checked
        Configuration conf = getConfig();
        LocalMode lma = LocalMode.newInstance();
        lma.prepareDAG(new Application(), conf);
        ValidationToFile validationToFile = (ValidationToFile) lma.getDAG().getOperatorMeta("validationToFile").getOperator();
        LocalMode.Controller lc = lma.getController();
        lc.runAsync();
        // waits for the validation application to be done before shutting it down and checking its output
        int count = 1;
        int maxSleepRounds = 300;
        while (!validationToFile.validationDone) {
            logger.info("Sleeping ....");
            Thread.sleep(500);
            if (count > maxSleepRounds) {
                fail("validationDone flag did not get set to true in ValidationToFile operator");
            }
            count++;
        }
        lc.shutdown();
        checkOutput();
    } catch (ConstraintViolationException e) {
        fail("constraint violations: " + e.getConstraintViolations());
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) LocalMode(com.datatorrent.api.LocalMode) ConstraintViolationException(javax.validation.ConstraintViolationException) Test(org.junit.Test)

Example 50 with ConstraintViolationException

use of javax.validation.ConstraintViolationException in project apex-malhar by apache.

the class ApplicationTest method testApplication.

@Test
public void testApplication() throws IOException, Exception {
    try {
        LocalMode lma = LocalMode.newInstance();
        Configuration conf = new Configuration(false);
        conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml"));
        lma.prepareDAG(new Application(), conf);
        LocalMode.Controller lc = lma.getController();
        // runs for 30 seconds and quits
        lc.run(10 * 1000);
    } catch (ConstraintViolationException e) {
        Assert.fail("constraint violations: " + e.getConstraintViolations());
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) LocalMode(com.datatorrent.api.LocalMode) ConstraintViolationException(javax.validation.ConstraintViolationException) Test(org.junit.Test)

Aggregations

ConstraintViolationException (javax.validation.ConstraintViolationException)87 Test (org.junit.Test)67 LocalMode (com.datatorrent.api.LocalMode)35 Configuration (org.apache.hadoop.conf.Configuration)34 File (java.io.File)16 ConstraintViolation (javax.validation.ConstraintViolation)15 Session (org.hibernate.Session)11 Transaction (org.hibernate.Transaction)11 LogicalPlan (com.datatorrent.stram.plan.logical.LogicalPlan)9 Map (java.util.Map)9 BigDecimal (java.math.BigDecimal)7 HashMap (java.util.HashMap)7 Set (java.util.Set)6 StramLocalCluster (com.datatorrent.stram.StramLocalCluster)5 ConfigApiTest (com.sun.enterprise.configapi.tests.ConfigApiTest)5 HashSet (java.util.HashSet)5 ValidationException (javax.validation.ValidationException)5 Validator (javax.validation.Validator)5 Response (javax.ws.rs.core.Response)5 Path (org.apache.hadoop.fs.Path)5