Search in sources :

Example 1 with LogbackListAppender

use of com.vip.saturn.job.executor.utils.LogbackListAppender in project Saturn by vipshop.

the class JsonParseObjectTest method test_E_lessFieldReturnCode.

/**
 * 少returnCode,默认为0
 */
@Test
public void test_E_lessFieldReturnCode() throws Exception {
    LogbackListAppender logbackListAppender = new LogbackListAppender();
    logbackListAppender.addToLogger(ScriptJobRunner.class);
    logbackListAppender.start();
    SaturnJobReturn saturnJobReturn = readSaturnJobReturn("/SaturnJobReturnLessFieldReturnCode");
    SaturnJobReturn expect = new SaturnJobReturn(0, "hello world", 200);
    HashMap<String, String> prop = new HashMap();
    prop.put("key", "value");
    expect.setProp(prop);
    assertThat(logbackListAppender.getLastMessage()).isNull();
    assertThat(saturnJobReturn).isNotNull().isEqualToComparingFieldByField(expect);
}
Also used : SaturnJobReturn(com.vip.saturn.job.SaturnJobReturn) LogbackListAppender(com.vip.saturn.job.executor.utils.LogbackListAppender) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 2 with LogbackListAppender

use of com.vip.saturn.job.executor.utils.LogbackListAppender in project Saturn by vipshop.

the class JsonParseObjectTest method test_A_normal.

@Test
public void test_A_normal() throws Exception {
    LogbackListAppender logbackListAppender = new LogbackListAppender();
    logbackListAppender.addToLogger(ScriptJobRunner.class);
    logbackListAppender.start();
    SaturnJobReturn saturnJobReturn = readSaturnJobReturn("/SaturnJobReturnNormal");
    SaturnJobReturn expect = new SaturnJobReturn(500, "hello world", 200);
    HashMap<String, String> prop = new HashMap();
    prop.put("key", "value");
    expect.setProp(prop);
    assertThat(logbackListAppender.getLastMessage()).isNull();
    assertThat(saturnJobReturn).isNotNull().isEqualToComparingFieldByField(expect);
}
Also used : SaturnJobReturn(com.vip.saturn.job.SaturnJobReturn) LogbackListAppender(com.vip.saturn.job.executor.utils.LogbackListAppender) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 3 with LogbackListAppender

use of com.vip.saturn.job.executor.utils.LogbackListAppender in project Saturn by vipshop.

the class JsonParseObjectTest method test_D_lessFieldProp.

/**
 * 少prop,默认为空
 */
@Test
public void test_D_lessFieldProp() throws Exception {
    LogbackListAppender logbackListAppender = new LogbackListAppender();
    logbackListAppender.addToLogger(ScriptJobRunner.class);
    logbackListAppender.start();
    SaturnJobReturn saturnJobReturn = readSaturnJobReturn("/SaturnJobReturnLessFieldProp");
    SaturnJobReturn expect = new SaturnJobReturn(500, "hello world", 200);
    assertThat(logbackListAppender.getLastMessage()).isNull();
    assertThat(saturnJobReturn).isNotNull().isEqualToComparingFieldByField(expect);
}
Also used : SaturnJobReturn(com.vip.saturn.job.SaturnJobReturn) LogbackListAppender(com.vip.saturn.job.executor.utils.LogbackListAppender) Test(org.junit.Test)

Example 4 with LogbackListAppender

use of com.vip.saturn.job.executor.utils.LogbackListAppender in project Saturn by vipshop.

the class JsonParseObjectTest method test_F_lessFieldReturnMsg.

/**
 * 少returnMsg,默认为空
 */
@Test
public void test_F_lessFieldReturnMsg() throws Exception {
    LogbackListAppender logbackListAppender = new LogbackListAppender();
    logbackListAppender.addToLogger(ScriptJobRunner.class);
    logbackListAppender.start();
    SaturnJobReturn saturnJobReturn = readSaturnJobReturn("/SaturnJobReturnLessFieldReturnMsg");
    SaturnJobReturn expect = new SaturnJobReturn(500, null, 200);
    HashMap<String, String> prop = new HashMap();
    prop.put("key", "value");
    expect.setProp(prop);
    assertThat(logbackListAppender.getLastMessage()).isNull();
    assertThat(saturnJobReturn).isNotNull().isEqualToComparingFieldByField(expect);
}
Also used : SaturnJobReturn(com.vip.saturn.job.SaturnJobReturn) LogbackListAppender(com.vip.saturn.job.executor.utils.LogbackListAppender) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 5 with LogbackListAppender

use of com.vip.saturn.job.executor.utils.LogbackListAppender in project Saturn by vipshop.

the class JsonParseObjectTest method test_H_blank.

/**
 * 没有内容
 */
@Test
public void test_H_blank() throws Exception {
    LogbackListAppender logbackListAppender = new LogbackListAppender();
    logbackListAppender.addToLogger(ScriptJobRunner.class);
    logbackListAppender.start();
    SaturnJobReturn saturnJobReturn = readSaturnJobReturn("/SaturnJobReturnBlank");
    assertThat(logbackListAppender.getLastMessage()).isNull();
    assertThat(saturnJobReturn).isNull();
}
Also used : SaturnJobReturn(com.vip.saturn.job.SaturnJobReturn) LogbackListAppender(com.vip.saturn.job.executor.utils.LogbackListAppender) Test(org.junit.Test)

Aggregations

SaturnJobReturn (com.vip.saturn.job.SaturnJobReturn)9 LogbackListAppender (com.vip.saturn.job.executor.utils.LogbackListAppender)9 Test (org.junit.Test)9 HashMap (java.util.HashMap)6