use of io.cucumber.java.en.Given in project java-algorand-sdk by algorand.
the class TealSign method seed_for_private_key.
@Given("base64 encoded private key {string}")
public void seed_for_private_key(String key) throws GeneralSecurityException {
byte[] seed = Encoder.decodeFromBase64(key);
shared.account = new Account(seed);
}
use of io.cucumber.java.en.Given in project efm-integrasjonspunkt by felleslosninger.
the class NextMoveMessageOutSteps method iPostTheFollowingMessage.
@Given("^I POST the following message:$")
public void iPostTheFollowingMessage(String body) throws IOException {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
this.response = testRestTemplate.exchange("/api/messages/out", HttpMethod.POST, new HttpEntity<>(body, headers), String.class);
if (response.getStatusCode() == HttpStatus.OK) {
StandardBusinessDocument sbd = objectMapper.readValue(response.getBody(), StandardBusinessDocument.class);
messageOutHolder.getOrCalculate(Message::new).setSbd(sbd);
}
}
use of io.cucumber.java.en.Given in project efm-integrasjonspunkt by felleslosninger.
the class NoarkExchangeWebServiceSteps method iCallTheNoarkExchangeWebService.
@Given("^I call the noarkExchange WebService$")
public void iCallTheNoarkExchangeWebService() throws IOException {
// Data to access the web service
URL wsdlDocumentLocation = new URL(String.format("http://localhost:%d/noarkExchange?wsdl", port));
String namespaceURI = "http://www.arkivverket.no/Noark/Exchange";
String servicePart = "noarkExchange";
String portName = "NoarkExchangePort";
QName serviceQN = new QName(namespaceURI, servicePart);
QName portQN = new QName(namespaceURI, portName);
// Creates a service instance
Service service = Service.create(wsdlDocumentLocation, serviceQN);
SOAPport soapPort = service.getPort(portQN, SOAPport.class);
PutMessageResponseType putMessageResponseType = soapPort.putMessage(getMessageRequestType());
assertThat(putMessageResponseType.getResult().getType()).isEqualTo("OK");
}
use of io.cucumber.java.en.Given in project sdc by onap.
the class StepsTenantIsolation method record_status_is.
@Given("^Record status is (.*)$")
public void record_status_is(String status) throws Throwable {
if (!cassandraUp) {
return;
}
Either<OperationalEnvironmentEntry, CassandraOperationStatus> eitherResult;
final OperationalEnvironmentEntry entryMock = Mockito.mock(OperationalEnvironmentEntry.class);
switch(status) {
case "FOUND_IN_PROGRESS":
when(entryMock.getStatus()).thenReturn(EnvironmentStatusEnum.IN_PROGRESS.getName());
eitherResult = Either.left(entryMock);
break;
case "FOUND_COMPLETED":
when(entryMock.getStatus()).thenReturn(EnvironmentStatusEnum.COMPLETED.getName());
eitherResult = Either.left(entryMock);
break;
case "FOUND_FAILED":
when(entryMock.getStatus()).thenReturn(EnvironmentStatusEnum.FAILED.getName());
eitherResult = Either.left(entryMock);
break;
case "NOT_FOUND":
eitherResult = Either.right(CassandraOperationStatus.NOT_FOUND);
break;
default:
throw new NotImplementedException();
}
when(operationalEnvironmentDao.get(operationalEnvironmentId)).thenReturn(eitherResult);
when(operationalEnvironmentDao.save(Mockito.any(OperationalEnvironmentEntry.class))).thenReturn(CassandraOperationStatus.OK);
}
use of io.cucumber.java.en.Given in project sdc by onap.
the class StepsTenantIsolation method ueb_service_status_is.
@SuppressWarnings("unchecked")
@Given("^UEB service status is (.*)$")
public void ueb_service_status_is(String status) throws Throwable {
Either<ApiCredential, CambriaErrorResponse> response;
switch(status) {
case "UP":
ApiCredential apiCredential = Mockito.mock(ApiCredential.class);
when(apiCredential.getApiKey()).thenReturn("MockAPIKey");
when(apiCredential.getApiSecret()).thenReturn("MockSecretKey");
response = Either.left(apiCredential);
break;
case "DOWN":
CambriaErrorResponse cambriaError = Mockito.mock(CambriaErrorResponse.class);
response = Either.right(cambriaError);
break;
default:
throw new NotImplementedException();
}
when(cambriaHandler.createUebKeys(Mockito.anyList())).thenReturn(response);
}
Aggregations