fix: getState now mandatory on EventProvider (#531)

* fix: getState mandatory on EventProvider

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>

* fixup: update test class

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>

* Update src/test/java/dev/openfeature/sdk/EventProviderTest.java

Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>

---------

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
This commit is contained in:
Todd Baert 2023-08-04 15:45:25 -04:00 committed by GitHub
parent 8789f90d33
commit 37fd2be673
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 3 deletions

View File

@ -16,6 +16,12 @@ import dev.openfeature.sdk.internal.TriConsumer;
*/
public abstract class EventProvider implements FeatureProvider {
/**
* {@inheritDoc}
*/
@Override
public abstract ProviderState getState();
private TriConsumer<EventProvider, ProviderEvent, ProviderEventDetails> onEmit = null;
/**

View File

@ -31,7 +31,7 @@ public interface FeatureProvider {
* if they have special initialization needed prior being called for flag
* evaluation.
* <p>
* It is ok, if the method is expensive as it is executed in the background. All
* It is ok if the method is expensive as it is executed in the background. All
* runtime exceptions will be
* caught and logged.
* </p>
@ -46,7 +46,7 @@ public interface FeatureProvider {
* Providers can overwrite this method, if they have special shutdown actions
* needed.
* <p>
* It is ok, if the method is expensive as it is executed in the background. All
* It is ok if the method is expensive as it is executed in the background. All
* runtime exceptions will be
* caught and logged.
* </p>
@ -57,7 +57,11 @@ public interface FeatureProvider {
/**
* Returns a representation of the current readiness of the provider.
* Providers which do not implement this method are assumed to be ready immediately.
* If the provider needs to be initialized, it should return {@link ProviderState#NOT_READY}.
* If the provider is in an error state, it should return {@link ProviderState#ERROR}.
* If the provider is functioning normally, it should return {@link ProviderState#READY}.
*
* <p><i>Providers which do not implement this method are assumed to be ready immediately.</i></p>
*
* @return ProviderState
*/

View File

@ -121,6 +121,11 @@ class EventProviderTest {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getObjectEvaluation'");
}
@Override
public ProviderState getState() {
return ProviderState.READY;
}
}
@SuppressWarnings("unchecked")