Device detection services for 51Degrees Pipeline

fiftyone.devicedetection.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 TEST_RESOURCE_KEY.
static String requireResourceKey (List< String > exampleNames, String asksFor, String... products)
 The resource key for a test that calls the live cloud service, from SHARED_RESOURCE_KEY_NAMES and then the given names.
static String answeredWithout (String thing, String reason, String... products)
 The message for a value the cloud answered without.
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 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

◆ answeredWithout()

String fiftyone.devicedetection.examples.shared.KeyHelper.answeredWithout ( String thing,
String reason,
String... products )
static

The message for a value the cloud answered without.

Parameters
thingthe property or element that has no value
reasonthe reason the cloud gave, or null
productsthe products a key needs for the value
Returns
the message

◆ getOrSetResourceKey()

String fiftyone.devicedetection.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.

Store as System Property TEST_RESOURCE_KEY

◆ requireResourceKey()

String fiftyone.devicedetection.examples.shared.KeyHelper.requireResourceKey ( List< String > exampleNames,
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 given names.

Parameters
exampleNamesthe names the example reads, in the order it reads them
asksForwhat the test asks the service for
productsthe products the key has to carry
Returns
the resource key

◆ requireTestResourceKey()

String fiftyone.devicedetection.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 TEST_RESOURCE_KEY.

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

◆ SHARED_RESOURCE_KEY_NAMES

final List<String> fiftyone.devicedetection.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.