Search in sources :

Example 1 with Assertion

use of org.junit.contrib.java.lang.system.Assertion in project YCSB by brianfrankcooper.

the class IntegrationTest method testDeleteOpsBenchmarkSuccess.

//All delete operations during benchmark are executed successfully with an HTTP OK status.
@Test
public void testDeleteOpsBenchmarkSuccess() throws InterruptedException {
    exit.expectSystemExit();
    exit.checkAssertionAfterwards(new Assertion() {

        @Override
        public void checkAssertion() throws Exception {
            List<String> results = Utils.read(RESULTS_FILEPATH);
            assertEquals(true, results.contains("[DELETE], Return=OK, 1"));
            Utils.delete(RESULTS_FILEPATH);
        }
    });
    Client.main(getArgs(TRACE_FILEPATH, 0, 0, 0, 1));
}
Also used : Assertion(org.junit.contrib.java.lang.system.Assertion) List(java.util.List) LifecycleException(org.apache.catalina.LifecycleException) ServletException(javax.servlet.ServletException) DBException(com.yahoo.ycsb.DBException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) Test(org.junit.Test)

Example 2 with Assertion

use of org.junit.contrib.java.lang.system.Assertion in project YCSB by brianfrankcooper.

the class IntegrationTest method testInsertOpsBenchmarkFailure.

//All read operations during benchmark are executed with an HTTP 500 error.
@Test
public void testInsertOpsBenchmarkFailure() throws InterruptedException {
    exit.expectSystemExit();
    exit.checkAssertionAfterwards(new Assertion() {

        @Override
        public void checkAssertion() throws Exception {
            List<String> results = Utils.read(RESULTS_FILEPATH);
            assertEquals(true, results.contains("[INSERT], Return=ERROR, 1"));
            Utils.delete(RESULTS_FILEPATH);
        }
    });
    Client.main(getArgs(ERROR_TRACE_FILEPATH, 0, 1, 0, 0));
}
Also used : Assertion(org.junit.contrib.java.lang.system.Assertion) List(java.util.List) LifecycleException(org.apache.catalina.LifecycleException) ServletException(javax.servlet.ServletException) DBException(com.yahoo.ycsb.DBException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) Test(org.junit.Test)

Example 3 with Assertion

use of org.junit.contrib.java.lang.system.Assertion in project YCSB by brianfrankcooper.

the class IntegrationTest method testReadOpsBenchmarkSuccess.

// All read operations during benchmark are executed successfully with an HTTP OK status.
@Test
public void testReadOpsBenchmarkSuccess() throws InterruptedException {
    exit.expectSystemExit();
    exit.checkAssertionAfterwards(new Assertion() {

        @Override
        public void checkAssertion() throws Exception {
            List<String> results = Utils.read(RESULTS_FILEPATH);
            assertEquals(true, results.contains("[READ], Return=OK, 1"));
            Utils.delete(RESULTS_FILEPATH);
        }
    });
    Client.main(getArgs(TRACE_FILEPATH, 1, 0, 0, 0));
}
Also used : Assertion(org.junit.contrib.java.lang.system.Assertion) List(java.util.List) LifecycleException(org.apache.catalina.LifecycleException) ServletException(javax.servlet.ServletException) DBException(com.yahoo.ycsb.DBException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) Test(org.junit.Test)

Example 4 with Assertion

use of org.junit.contrib.java.lang.system.Assertion in project YCSB by brianfrankcooper.

the class IntegrationTest method testDeleteOpsBenchmarkFailure.

//All read operations during benchmark are executed with an HTTP 500 error.
@Test
public void testDeleteOpsBenchmarkFailure() throws InterruptedException {
    exit.expectSystemExit();
    exit.checkAssertionAfterwards(new Assertion() {

        @Override
        public void checkAssertion() throws Exception {
            List<String> results = Utils.read(RESULTS_FILEPATH);
            assertEquals(true, results.contains("[DELETE], Return=ERROR, 1"));
            Utils.delete(RESULTS_FILEPATH);
        }
    });
    Client.main(getArgs(ERROR_TRACE_FILEPATH, 0, 0, 0, 1));
}
Also used : Assertion(org.junit.contrib.java.lang.system.Assertion) List(java.util.List) LifecycleException(org.apache.catalina.LifecycleException) ServletException(javax.servlet.ServletException) DBException(com.yahoo.ycsb.DBException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) Test(org.junit.Test)

Example 5 with Assertion

use of org.junit.contrib.java.lang.system.Assertion in project YCSB by brianfrankcooper.

the class IntegrationTest method testUpdateOpsBenchmarkFailure.

//All read operations during benchmark are executed with an HTTP 500 error.
@Test
public void testUpdateOpsBenchmarkFailure() throws InterruptedException {
    exit.expectSystemExit();
    exit.checkAssertionAfterwards(new Assertion() {

        @Override
        public void checkAssertion() throws Exception {
            List<String> results = Utils.read(RESULTS_FILEPATH);
            assertEquals(true, results.contains("[UPDATE], Return=ERROR, 1"));
            Utils.delete(RESULTS_FILEPATH);
        }
    });
    Client.main(getArgs(ERROR_TRACE_FILEPATH, 0, 0, 1, 0));
}
Also used : Assertion(org.junit.contrib.java.lang.system.Assertion) List(java.util.List) LifecycleException(org.apache.catalina.LifecycleException) ServletException(javax.servlet.ServletException) DBException(com.yahoo.ycsb.DBException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) Test(org.junit.Test)

Aggregations

IOException (java.io.IOException)9 Test (org.junit.Test)9 Assertion (org.junit.contrib.java.lang.system.Assertion)9 DBException (com.yahoo.ycsb.DBException)8 FileNotFoundException (java.io.FileNotFoundException)8 List (java.util.List)8 ServletException (javax.servlet.ServletException)8 LifecycleException (org.apache.catalina.LifecycleException)8 LocalizedMessage (com.puppycrawl.tools.checkstyle.api.LocalizedMessage)1