Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Testing fixes and package renaming #45

Merged
merged 4 commits into from
Sep 29, 2023
Merged
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ management API. After that all interaction with the feature flags happens using
```java
package com.spotify.confidence.openfeature;

import dev.openfeature.contrib.providers.confidence.ConfidenceFeatureProvider;
import com.spotify.confidence.ConfidenceFeatureProvider;
import dev.openfeature.sdk.Client;
import dev.openfeature.sdk.MutableContext;
import dev.openfeature.sdk.OpenFeatureAPI;
Expand Down
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
<scope>test</scope>
<version>3.24.2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
<version>${jupiter.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.openfeature.contrib.providers.confidence;
package com.spotify.confidence;

import com.google.common.base.Strings;
import com.google.protobuf.Struct;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.openfeature.contrib.providers.confidence;
package com.spotify.confidence;

import com.google.protobuf.Struct;
import com.google.protobuf.util.Values;
Expand Down Expand Up @@ -34,12 +34,13 @@ private static Value from(com.google.protobuf.Value value, FlagSchema schema) {
case NUMBER_VALUE:
switch (schema.getSchemaTypeCase()) {
case INT_SCHEMA:
final long intVal = (long) value.getNumberValue();
final int intVal = (int) value.getNumberValue();
if (intVal != value.getNumberValue()) {
throw new ParseError(
String.format("%s value should be an int64, but it is a double", mismatchPrefix));
String.format(
"%s value should be an int, but it is a double/long", mismatchPrefix));
}
return new Value(value.getNumberValue());
return new Value(intVal);
case DOUBLE_SCHEMA:
return new Value(value.getNumberValue());
default:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.openfeature.contrib.providers.confidence;
package com.spotify.confidence;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
Expand Down Expand Up @@ -160,7 +160,7 @@ static void before() throws IOException {
channel = InProcessChannelBuilder.forName(serverName).directExecutor().build();

final FeatureProvider featureProvider =
new ConfidenceFeatureProvider(
new com.spotify.confidence.ConfidenceFeatureProvider(
"fake-secret", FlagResolverServiceGrpc.newBlockingStub(channel));

final OpenFeatureAPI api = OpenFeatureAPI.getInstance();
Expand Down Expand Up @@ -196,7 +196,9 @@ public void inconsistentTargetKey() {
DEFAULT_VALUE,
new MutableContext(
"my-targeting-key-1",
Map.of(ConfidenceFeatureProvider.TARGETING_KEY, new Value("my-targeting-key-2"))));
Map.of(
com.spotify.confidence.ConfidenceFeatureProvider.TARGETING_KEY,
new Value("my-targeting-key-2"))));

assertThat(evaluationDetails.getValue()).isEqualTo(DEFAULT_VALUE);
assertThat(evaluationDetails.getErrorCode()).isEqualTo(ErrorCode.INVALID_CONTEXT);
Expand Down