issue #5 - Update pom.xml version to 0.2.0-beta.1-SNAPSHOT, enhance logging, and refine DNS batch record processing method.
This commit is contained in:
1 parent
deb6fcf445
commit
0eaca55e95
6 files changed
+80
-29
No files matched your search
@@ -6,6 +6,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||
|
||||
import codes.thischwa.cf.model.BatchEntry;
|
||||
import codes.thischwa.cf.model.RecordEntity;
|
||||
import codes.thischwa.cf.model.RecordType;
|
||||
import codes.thischwa.cf.model.ZoneEntity;
|
||||
@@ -157,6 +158,7 @@ public class CfClientTest {
|
||||
String sld1 = SLD_STR + "-1";
|
||||
String sld2 = SLD_STR + "-2";
|
||||
String sld3 = SLD_STR + "-3";
|
||||
String sld4 = SLD_STR + "-4";
|
||||
RecordEntity r1 = RecordEntity.build(sld1, RecordType.A, TTL, "130.0.0.1");
|
||||
RecordEntity r2 = RecordEntity.build(sld2, RecordType.A, TTL, "130.0.0.2");
|
||||
RecordEntity r3 = RecordEntity.build(sld3, RecordType.A, TTL, "130.0.0.3");
|
||||
@@ -167,8 +169,15 @@ public class CfClientTest {
|
||||
client.recordDeleteTypeIfExists(z, sld3, RecordType.A);
|
||||
|
||||
try {
|
||||
// test put
|
||||
client.recordBatch(z, 30, List.of(r1, r2, r3), null, null);
|
||||
// test pos
|
||||
BatchEntry batchEntry = client.recordBatch(z, List.of(r1, r2, r3), null, null, null);
|
||||
assertEquals(3, batchEntry.getPosts().size());
|
||||
RecordEntity batchedRec = batchEntry.getPosts().get(0);
|
||||
assertNotNull(batchedRec.getId());
|
||||
assertEquals(r1.getName(), batchedRec.getName());
|
||||
assertEquals(r1.getType(), batchedRec.getType());
|
||||
assertNotNull(batchedRec.getCreatedOn());
|
||||
|
||||
RecordEntity testRec = client.sldInfo(z, sld1, RecordType.A);
|
||||
assertEquals("130.0.0.1", testRec.getContent());
|
||||
testRec = client.sldInfo(z, sld2, RecordType.A);
|
||||
@@ -179,14 +188,20 @@ public class CfClientTest {
|
||||
// test patch
|
||||
r1 = client.sldInfo(z, sld1, RecordType.A);
|
||||
r1.setContent("130.1.0.1");
|
||||
client.recordBatch(z, 30, null, List.of(r1), null);
|
||||
client.recordBatch(z, null, null, List.of(r1), null);
|
||||
testRec = client.sldInfo(z, sld1, RecordType.A);
|
||||
assertEquals("130.1.0.1", testRec.getContent());
|
||||
|
||||
// test delete
|
||||
client.recordBatch(z, 30, null, null, List.of(r1));
|
||||
client.recordBatch(z, null, null, null, List.of(r1));
|
||||
assertThrows(CloudflareNotFoundException.class,
|
||||
() -> client.sldInfo(z, sld1, RecordType.A));
|
||||
|
||||
// test put
|
||||
r1 = RecordEntity.build(sld4, RecordType.A, TTL, "130.1.0.2");
|
||||
client.recordBatch(z, List.of(r1), null, null, null);
|
||||
testRec = client.sldInfo(z, sld4, RecordType.A);
|
||||
assertEquals("130.1.0.2", testRec.getContent());
|
||||
} finally {
|
||||
client.recordDeleteTypeIfExists(z, sld1, RecordType.A);
|
||||
client.recordDeleteTypeIfExists(z, sld2, RecordType.A);
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
|
||||
<appender name="current"
|
||||
class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%t] %-5level %logger{50} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<appender name="current"
|
||||
class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%t] %-5level %logger{50} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.apache.hc.client5.http" level="info" />
|
||||
<logger name="org.apache.hc.client5.http" level="info"/>
|
||||
<logger name="codes.thischwa.cf.CfBasicHttpClient" level="trace"/>
|
||||
|
||||
<root level="debug">
|
||||
<appender-ref ref="current"/>
|
||||
</root>
|
||||
<root level="debug">
|
||||
<appender-ref ref="current"/>
|
||||
</root>
|
||||
</configuration>
|
||||
Reference in new issue
Block a user