Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ jobs:
needs: get-branch-name
uses: ./.github/workflows/run_cedar_java_reusable.yml
with:
cedar_policy_ref: "refs/heads/main" # use the latest commit on main
cedar_policy_ref: ${{ needs.get-branch-name.outputs.branch_name }} # use the same branch of cedar-policy
cedar_java_ref: "${{ github.href }}" # use the current PR's commit
13 changes: 12 additions & 1 deletion CedarJava/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Changelog

## Unreleased
## 4.10.0
* Pinned to `cedar-policy 4.10.0`

## 4.9.0
* Pinned to `cedar-policy 4.9.1`
* Improve toCedarExpr() correctness and add CedarStrings utility [#351](https://github.com/cedar-policy/cedar-java/pull/351)
* Add PolicySet and Schema caching [#350](https://github.com/cedar-policy/cedar-java/pull/350)
* Optimize JNI performance and fix Decimal validation [#349](https://github.com/cedar-policy/cedar-java/pull/349)
* Bugfix: EntityIdentifier equals implementation [#352](https://github.com/cedar-policy/cedar-java/pull/352)

## 4.8.0
* Pinned to `cedar-policy 4.8.2`
* Added Schema conversion APIs [#325](https://github.com/cedar-policy/cedar-java/pull/325)
* Added Level Validation [#327](https://github.com/cedar-policy/cedar-java/pull/327)
* Added DateTime extension support [#328](https://github.com/cedar-policy/cedar-java/pull/328)
Expand Down
6 changes: 3 additions & 3 deletions CedarJava/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def ZigVersion = '0.11'
tasks.register('validateZigVersion') {
group = 'Build'
description = 'Validates that the correct zig version is installed'

doLast {
def output = new ByteArrayOutputStream()
exec {
Expand All @@ -162,7 +162,7 @@ tasks.register('validateZigVersion') {
def version = output.toString().trim()
println "Detected Zig version: ${version}"
if (!version.startsWith(ZigVersion)) {
throw new GradleException("Zig version must be ${ZigVersion} but found: ${version}")
throw new GradleException("Zig version must be ${ZigVersion} but found: ${version}")
}
println "Zig version validation successful"
}
Expand Down Expand Up @@ -324,7 +324,7 @@ publishing {
from components.java
groupId = 'com.cedarpolicy'
artifactId = 'cedar-java'
version = '3.1.2'
version = '4.10.0'

artifacts {
jar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

package com.cedarpolicy.value;


import com.cedarpolicy.loader.LibraryLoader;

/**
* Class representing Entity Identifiers.
* All strings are valid Entity Identifiers
*/
public final class EntityIdentifier {

private String id;

static {
Expand Down Expand Up @@ -54,8 +54,6 @@ public String toString() {
@Override
public boolean equals(Object o) {
if (o == null) {
return true;
} else if (o == this) {
return false;
} else {
try {
Expand All @@ -76,7 +74,5 @@ protected String getId() {
return id;
}


private static native String getEntityIdentifierRepr(EntityIdentifier id);

}
52 changes: 49 additions & 3 deletions CedarJava/src/test/java/com/cedarpolicy/EntityIdTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

package com.cedarpolicy;

import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.*;

import com.cedarpolicy.value.EntityIdentifier;
import net.jqwik.api.Property;

import net.jqwik.api.ForAll;
import net.jqwik.api.Property;
import org.junit.jupiter.api.Test;

public class EntityIdTests {

Expand All @@ -32,4 +32,50 @@ void anyString(@ForAll String s) {
assertTrue(asStr.length() >= s.length());
}

@Test
void equalsSameId() {
EntityIdentifier a = new EntityIdentifier("alice");
EntityIdentifier b = new EntityIdentifier("alice");
assertEquals(a, b);
}

@Test
void equalsSameInstance() {
EntityIdentifier a = new EntityIdentifier("alice");
assertEquals(a, a);
}

@Test
void notEqualsDifferentId() {
EntityIdentifier a = new EntityIdentifier("alice");
EntityIdentifier b = new EntityIdentifier("bob");
assertNotEquals(a, b);
}

@Test
void notEqualsNull() {
EntityIdentifier a = new EntityIdentifier("alice");
assertNotEquals(a, null);
}

@Test
void notEqualsDifferentType() {
EntityIdentifier a = new EntityIdentifier("alice");
assertNotEquals(a, "alice");
}

@Test
void equalsEmptyStrings() {
EntityIdentifier a = new EntityIdentifier("");
EntityIdentifier b = new EntityIdentifier("");
assertEquals(a, b);
}

@Test
void equalsIsSymmetric() {
EntityIdentifier a = new EntityIdentifier("test");
EntityIdentifier b = new EntityIdentifier("test");
assertEquals(a, b);
assertEquals(b, a);
}
}
10 changes: 5 additions & 5 deletions CedarJavaFFI/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Java FFI for Cedar (from the cedar-policy crate)."
edition = "2021"


version = "4.0.0"
version = "4.10.0"

[dependencies]
serde = { version = "1.0", features = ["derive", "rc"] }
Expand All @@ -32,11 +32,11 @@ jni = { version = "0.21.1", features = ["invocation"] }
crate_type = ["cdylib"]

[dependencies.cedar-policy]
version = "4.0.0"
version = "4.10.0"
git = "https://github.com/cedar-policy/cedar"
branch = "main"
branch = "release/4.10.x"

[dependencies.cedar-policy-formatter]
version = "4.0.0"
version = "4.10.0"
git = "https://github.com/cedar-policy/cedar"
branch = "main"
branch = "release/4.10.x"
Loading