IP Intelligence services for 51Degrees Pipeline

fiftyone.ipintelligence.examples.shared.KeyHelper Class Reference

Static Public Member Functions

static String requireTestResourceKey (String asksFor, String... products)
 The resource key for a test that calls the live cloud service, from SHARED_RESOURCE_KEY_NAMES and then the names getOrSetTestResourceKey() reads.
static String getOrSetTestResourceKey ()
 Obtain a resource key either from environment variable or from a property.
static String getOrSetTestResourceKey (boolean shouldThrow)
static String getOrSetTestResourceKey (String value, boolean shouldThrow)
static String getOrSetTestResourceKey (String value)
static String getOrSetResourceKey (String value, String variableName, String errorMessage, boolean shouldThrow)
 Obtain a resource key from the passed argument, from environment variable or from a property.
static String getOrSetSuperResourceKey (String value, String variablename)
static String getOrSetSuperResourceKey (String value, String variablename, boolean shouldThrow)

Static Public Attributes

static final String RESOURCE_KEY_VARIABLE = "_51DEGREES_RESOURCE_KEY"
 Aligned name of the environment variable or system property which may hold the resource key.
static final String RESOURCE_KEY_ENV_VAR = "51DEGREES_RESOURCE_KEY"
 The old name of RESOURCE_KEY_VARIABLE, read only when that one is not set.
static final String TEST_RESOURCE_KEY = "TestResourceKey"
static final List< String > SHARED_RESOURCE_KEY_NAMES
 The names every cloud test reads a resource key from first, before the names its own example reads.

Member Function Documentation

◆ getOrSetResourceKey()

String fiftyone.ipintelligence.examples.shared.KeyHelper.getOrSetResourceKey ( String value,
String variableName,
String errorMessage,
boolean shouldThrow )
static

Obtain a resource key from the passed argument, from environment variable or from a property.

The aligned RESOURCE_KEY_VARIABLE name is checked first, then the deprecated RESOURCE_KEY_ENV_VAR, then the passed variable name. Store as System Property under the passed variable name.

◆ requireTestResourceKey()

String fiftyone.ipintelligence.examples.shared.KeyHelper.requireTestResourceKey ( String asksFor,
String... products )
static

The resource key for a test that calls the live cloud service, from SHARED_RESOURCE_KEY_NAMES and then the names getOrSetTestResourceKey() reads.

Fails the test when there is none, because a cloud test that passes without a key has called nothing.

Parameters
asksForwhat the test asks the service for
productsthe products the key has to carry
Returns
the resource key

Member Data Documentation

◆ RESOURCE_KEY_ENV_VAR

final String fiftyone.ipintelligence.examples.shared.KeyHelper.RESOURCE_KEY_ENV_VAR = "51DEGREES_RESOURCE_KEY"
static

The old name of RESOURCE_KEY_VARIABLE, read only when that one is not set.

Deprecated
use RESOURCE_KEY_VARIABLE, and set the variable it names in place of this one.

◆ RESOURCE_KEY_VARIABLE

final String fiftyone.ipintelligence.examples.shared.KeyHelper.RESOURCE_KEY_VARIABLE = "_51DEGREES_RESOURCE_KEY"
static

Aligned name of the environment variable or system property which may hold the resource key.

This name is checked first, before the legacy TEST_RESOURCE_KEY name.

◆ SHARED_RESOURCE_KEY_NAMES

final List<String> fiftyone.ipintelligence.examples.shared.KeyHelper.SHARED_RESOURCE_KEY_NAMES
static
Initial value:
=
Collections.unmodifiableList(Arrays.asList(
"_51DEGREES_RESOURCE_KEY",
"_51DEGREES_RESOURCE_KEY_BESPOKE"))

The names every cloud test reads a resource key from first, before the names its own example reads.