Compare commits
16 Commits
0a47bb6338
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 7446dcc659 | |||
| 42e06245e1 | |||
| 36d44ed7a4 | |||
| 68846b6676 | |||
| a651d478b0 | |||
| 3c480f19f8 | |||
| 32a35781b5 | |||
| 59111ea53c | |||
| 982a95451d | |||
| be2fb5d89e | |||
| d213f72138 | |||
| 824bcf060d | |||
| dbedcdfe16 | |||
| 87b39fca7b | |||
| d052555ba7 | |||
| dfa2753619 |
@@ -25,6 +25,9 @@ runs:
|
||||
mkdir -p reports
|
||||
python3 - <<'EOF'
|
||||
import glob, xml.etree.ElementTree as ET
|
||||
from datetime import datetime, timezone
|
||||
|
||||
generated_at = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S UTC")
|
||||
|
||||
# --- JUnit ---
|
||||
files = glob.glob("junit-short/*.xml")
|
||||
@@ -78,6 +81,7 @@ runs:
|
||||
# --- Markdown zusammenbauen ---
|
||||
md = (
|
||||
"# Test Report\n\n"
|
||||
f"_Generated on {generated_at}_\n\n"
|
||||
f"**{overall}**\n\n"
|
||||
"## Test Results\n\n"
|
||||
"| | Tests | Passed | Failed | Skipped |\n"
|
||||
|
||||
@@ -11,3 +11,4 @@
|
||||
/info.txt
|
||||
cf.yml
|
||||
/docs/apidocs/javadoc.sh
|
||||
/.claude/settings.local.json
|
||||
|
||||
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
SOFTWARE.
|
||||
@@ -6,7 +6,7 @@ This project provides a java client for minimalistic access to the Cloudflare AP
|
||||
managing DNS settings such as creating, updating and deleting DNS records.
|
||||
|
||||
If you encounter any bugs or find missing features, feel free to report them on
|
||||
the [Gitea Issues page](https://git.mein-gateway.de/thischwa/CloudflareDNS-java/issues).
|
||||
the [GitHub Issues page](https://github.com/th-schwarz/CloudflareDNS-java/issues).
|
||||
|
||||
---
|
||||
|
||||
@@ -18,7 +18,7 @@ This guide comes without any warranty. Use at your own risk. The author is not r
|
||||
|
||||
## Get It
|
||||
|
||||
The project has its own maven repository. Follow the instructions on the latest [package](https://git.mein-gateway.de/thischwa/-/packages) to add the repository to your project.
|
||||
The project has its own maven repository. Follow the instructions on the latest [package](https://git.mein-gateway.de/thischwa/-/packages/maven/codes.thischwa:cloudflaredns) to add the repository to your project.
|
||||
|
||||
## Changelog
|
||||
|
||||
@@ -37,7 +37,8 @@ The API provides two styles for working with DNS records:
|
||||
2. **Fluent API**: Chainable method calls for more readable code
|
||||
|
||||
The following text focuses on the basic methods. For further information, take a look at
|
||||
the [javadoc of the CfDnsClient](https://cloudflaredns-java-f4ee3a.gitlab.io/apidocs/codes/thischwa/cf/CfDnsClient.html).
|
||||
the \
|
||||
[](https://javadoc.mein-gateway.de/CloudflareDNS-java/index.html)
|
||||
|
||||
### Instantiation of `CfDnsClient`
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
- 0.5.0-SNAPSHOT:
|
||||
- moved the project to git.mein-gateway.de
|
||||
- replaced sonarqube with own actions
|
||||
- migrate to jackson 3.x
|
||||
- 0.4.0:
|
||||
- fixed some paging issues
|
||||
- **Breaking Change**: renamed `client.zone().record()` to `client.zone().getRecord()`
|
||||
|
||||
@@ -10,12 +10,14 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<issueManagement>
|
||||
<url>https://git.mein-gateway.de/thischwa/CloudflareDNS-java/issues</url>
|
||||
<system>Gitea Issues</system>
|
||||
<url>https://github.com/th-schwarz/CloudflareDNS-java/issues</url>
|
||||
<system>GitHub Issues</system>
|
||||
</issueManagement>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<file.encoding>UTF-8</file.encoding>
|
||||
<project.build.sourceEncoding>${file.encoding}</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>${file.encoding}</project.reporting.outputEncoding>
|
||||
@@ -34,14 +36,13 @@
|
||||
<linkXRef>false</linkXRef>
|
||||
|
||||
<!-- 3rd party dependencies -->
|
||||
<jackson.version>2.21.1</jackson.version>
|
||||
<httpclient5.version>5.5.1</httpclient5.version>
|
||||
<lombok.version>1.18.36</lombok.version>
|
||||
<slf4j.version>2.0.17</slf4j.version>
|
||||
<logback-classic.version>1.5.25</logback-classic.version>
|
||||
<jackson.version>3.2.1</jackson.version>
|
||||
<httpclient5.version>5.6.2</httpclient5.version>
|
||||
<lombok.version>1.18.46</lombok.version>
|
||||
<slf4j.version>2.0.18</slf4j.version>
|
||||
<logback-classic.version>1.5.38</logback-classic.version>
|
||||
<junit5.version>5.14.2</junit5.version>
|
||||
<mockito-junit5.version>5.21.0</mockito-junit5.version>
|
||||
|
||||
<mockito-junit5.version>5.23.0</mockito-junit5.version>
|
||||
<lombok-maven-plugin.version>1.18.20.0</lombok-maven-plugin.version>
|
||||
</properties>
|
||||
|
||||
@@ -94,19 +95,14 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<groupId>tools.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>24.0.1</version>
|
||||
<version>26.1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -135,7 +131,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.13.0</version>
|
||||
<version>3.14.1</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
@@ -145,7 +141,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.11.2</version>
|
||||
<version>3.12.0</version>
|
||||
<configuration>
|
||||
<failOnError>false</failOnError>
|
||||
<failOnWarnings>false</failOnWarnings>
|
||||
@@ -199,7 +195,7 @@
|
||||
<!-- generates the code coverage report for sonar cube -->
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.13</version>
|
||||
<version>0.8.15</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>prepare-agent</id>
|
||||
@@ -224,7 +220,7 @@
|
||||
<!-- to export test summary -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.5.3</version>
|
||||
<version>3.5.6</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
@@ -258,7 +254,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.4.2</version>
|
||||
<version>3.5.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-delomboked-sources</id>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Test Report
|
||||
|
||||
_Generated on 2026-08-05 15:43:07 UTC_
|
||||
|
||||
**✅ All tests passed**
|
||||
|
||||
## Test Results
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package codes.thischwa.cf;
|
||||
|
||||
import codes.thischwa.cf.model.AbstractResponse;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.hc.client5.http.classic.methods.HttpDelete;
|
||||
@@ -20,6 +18,8 @@ import org.apache.hc.core5.http.io.entity.EntityUtils;
|
||||
import org.apache.hc.core5.http.io.entity.StringEntity;
|
||||
import org.apache.hc.core5.http.message.BasicClassicHttpRequest;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import tools.jackson.core.JacksonException;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* Abstract base class for creating HTTP clients to interact with the Cloudflare API. Provides
|
||||
@@ -96,7 +96,7 @@ abstract class CfBasicHttpClient {
|
||||
throw new CloudflareApiException(
|
||||
request.getMethod() + " request failed with status code: " + result.statusCode);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
} catch (JacksonException e) {
|
||||
log.error("JSON parsing error for request to {}", logUri, e);
|
||||
throw new CloudflareApiException("Error processing JSON response", e);
|
||||
} catch (Exception e) {
|
||||
@@ -182,7 +182,7 @@ abstract class CfBasicHttpClient {
|
||||
log.trace("Request methode [{}] payload: {}", request.getMethod(), jsonPayload);
|
||||
request.setEntity(new StringEntity(jsonPayload,
|
||||
ContentType.APPLICATION_JSON));
|
||||
} catch (JsonProcessingException e) {
|
||||
} catch (JacksonException e) {
|
||||
throw new CloudflareApiException("Error serializing JSON payload", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package codes.thischwa.cf;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import tools.jackson.databind.DeserializationFeature;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
import tools.jackson.databind.PropertyNamingStrategies;
|
||||
import tools.jackson.databind.json.JsonMapper;
|
||||
|
||||
/**
|
||||
* The JsonConf class provides a utility method for initializing and configuring a shared
|
||||
@@ -16,11 +16,11 @@ class JsonConf {
|
||||
}
|
||||
|
||||
static ObjectMapper initObjectMapper() {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.registerModule(new JavaTimeModule());
|
||||
mapper.setDefaultPropertyInclusion(JsonInclude.Include.NON_NULL);
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
|
||||
return mapper;
|
||||
return JsonMapper.builder()
|
||||
.changeDefaultPropertyInclusion(
|
||||
incl -> incl.withValueInclusion(JsonInclude.Include.NON_NULL))
|
||||
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
|
||||
.propertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,18 +11,18 @@ import codes.thischwa.cf.model.RecordMultipleResponse;
|
||||
import codes.thischwa.cf.model.RecordSingleResponse;
|
||||
import codes.thischwa.cf.model.ResponseResultInfo;
|
||||
import codes.thischwa.cf.model.ZoneMultipleResponse;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import tools.jackson.core.JacksonException;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
|
||||
public class ObjectMapperTest {
|
||||
|
||||
private final ObjectMapper mapper = JsonConf.initObjectMapper();
|
||||
|
||||
@Test
|
||||
void testObjectMapper() throws IOException {
|
||||
void testObjectMapper() {
|
||||
ZoneMultipleResponse resp =
|
||||
mapper.readValue(this.getClass().getResourceAsStream("/zone-list-response.json"),
|
||||
ZoneMultipleResponse.class);
|
||||
@@ -30,7 +30,7 @@ public class ObjectMapperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testErrorResponse() throws IOException {
|
||||
void testErrorResponse() {
|
||||
List<Class<? extends AbstractResponse>> respClasses =
|
||||
List.of(RecordSingleResponse.class, RecordMultipleResponse.class, ZoneMultipleResponse.class, BatchResponse.class);
|
||||
respClasses.forEach(this::assertErrorResponse);
|
||||
@@ -46,7 +46,7 @@ public class ObjectMapperTest {
|
||||
assertFalse(resultInfo.isSuccess());
|
||||
assertEquals(1, resultInfo.getErrors().size());
|
||||
assertEquals(81053, resultInfo.getErrors().get(0).getCode());
|
||||
} catch (IOException e) {
|
||||
} catch (JacksonException e) {
|
||||
fail("fail for " + clazz + ": " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user