Search in sources :

Example 6 with LogbackListAppender

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

the class JsonParseObjectTest method test_I_trim.

@Test
public void test_I_trim() throws Exception {
    LogbackListAppender logbackListAppender = new LogbackListAppender();
    logbackListAppender.addToLogger(ScriptJobRunner.class);
    logbackListAppender.start();
    SaturnJobReturn saturnJobReturn = readSaturnJobReturn("/SaturnJobReturnTrim");
    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 7 with LogbackListAppender

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

the class JsonParseObjectTest method test_B_overFields.

@Test
public void test_B_overFields() throws Exception {
    LogbackListAppender logbackListAppender = new LogbackListAppender();
    logbackListAppender.addToLogger(ScriptJobRunner.class);
    logbackListAppender.start();
    SaturnJobReturn saturnJobReturn = readSaturnJobReturn("/SaturnJobReturnMoreFields");
    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 8 with LogbackListAppender

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

the class JsonParseObjectTest method test_C_lessFieldErrorGroup.

/**
 * 少errorGroup,默认为200
 */
@Test
public void test_C_lessFieldErrorGroup() throws Exception {
    LogbackListAppender logbackListAppender = new LogbackListAppender();
    logbackListAppender.addToLogger(ScriptJobRunner.class);
    logbackListAppender.start();
    SaturnJobReturn saturnJobReturn = readSaturnJobReturn("/SaturnJobReturnLessFieldErrorGroup");
    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 9 with LogbackListAppender

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

the class JsonParseObjectTest method test_G_NoFields.

/**
 * 少全部字段,只有{}
 */
@Test
public void test_G_NoFields() throws Exception {
    LogbackListAppender logbackListAppender = new LogbackListAppender();
    logbackListAppender.addToLogger(ScriptJobRunner.class);
    logbackListAppender.start();
    SaturnJobReturn saturnJobReturn = readSaturnJobReturn("/SaturnJobReturnNoFields");
    SaturnJobReturn expect = new SaturnJobReturn();
    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)

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