Search in sources :

Example 1 with StaxBuilderTest

use of com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest in project databus by linkedin.

the class TestParser method sortMultipleSourcesCheck.

/**
   * Test to see if all the updates within a given transaction are clubbed to together by source, and is sorted by source.
   */
@Test
public void sortMultipleSourcesCheck() throws Exception {
    SortCheckCallback callback = new SortCheckCallback();
    StaxBuilderTest test = new StaxBuilderTest(actualXmlDataDir + "sortMultipleSources.xml", service, callback);
    test.processXml();
}
Also used : StaxBuilderTest(com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest) StaxBuilderTest(com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest) Test(org.testng.annotations.Test)

Example 2 with StaxBuilderTest

use of com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest in project databus by linkedin.

the class TestParser method missingTokensCheck.

/**
   * Missing tokens fields, this should terminate the parser
   */
@Test
public void missingTokensCheck() throws Exception {
    BasicOperationsCheckCallback callback = new BasicOperationsCheckCallback();
    try {
        StaxBuilderTest test = new StaxBuilderTest(actualXmlDataDir + "missingtokens.xml", service, callback);
        test.processXml();
        Assert.fail("Test has not detected failure on missing tokens");
    } catch (DatabusException e) {
        LOG.info("Caught databus exception, verifying if it's for missing tokens..");
        String error = e.getMessage();
        String expected = "The current state is : columns(ENDELEMENT) the expected state was: [tokens(STARTELEMENT)]. The next state found was: dbupdate(ENDELEMENT)";
        Assert.assertEquals(error, expected);
    }
}
Also used : DatabusException(com.linkedin.databus2.core.DatabusException) StaxBuilderTest(com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest) StaxBuilderTest(com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest) Test(org.testng.annotations.Test)

Example 3 with StaxBuilderTest

use of com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest in project databus by linkedin.

the class TestParser method nullTransactionsTest.

/**
   *  Checks if the parser it able to advance SCNs when there are no events for the current source
   */
@Test
public void nullTransactionsTest() throws Exception {
    BasicOperationsCheckCallback callback = new BasicOperationsCheckCallback();
    StaxBuilderTest test = new StaxBuilderTest(actualXmlDataDir + "nullTransactions.xml", service, callback);
    test.processXml();
}
Also used : StaxBuilderTest(com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest) StaxBuilderTest(com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest) Test(org.testng.annotations.Test)

Example 4 with StaxBuilderTest

use of com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest in project databus by linkedin.

the class TestParser method formattingTest.

/**
   *  Check if the parser is able to construct event if there spaces, new lines between elements/tags
   */
@Test
public void formattingTest() throws Exception {
    BasicOperationsCheckCallback callback = new BasicOperationsCheckCallback();
    StaxBuilderTest test = new StaxBuilderTest(actualXmlDataDir + "extraspaces.xml", service, callback);
    test.processXml();
}
Also used : StaxBuilderTest(com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest) StaxBuilderTest(com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest) Test(org.testng.annotations.Test)

Example 5 with StaxBuilderTest

use of com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest in project databus by linkedin.

the class TestParser method nullFieldsCheck.

/**
   * Test for null/empty fields, this should not terminate the parser. The test will verify is the field returns null
   */
@Test
public void nullFieldsCheck() throws Exception {
    NullFieldsCallback callback = new NullFieldsCallback();
    StaxBuilderTest test = new StaxBuilderTest(actualXmlDataDir + "nullfields.xml", service, callback);
    test.processXml();
}
Also used : StaxBuilderTest(com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest) StaxBuilderTest(com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest) Test(org.testng.annotations.Test)

Aggregations

StaxBuilderTest (com.linkedin.databus2.ggParser.staxparser.StaxBuilderTest)9 Test (org.testng.annotations.Test)9 DatabusException (com.linkedin.databus2.core.DatabusException)2