Search in sources :

Example 31 with Given

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);
}
Also used : Account(com.algorand.algosdk.account.Account) Given(io.cucumber.java.en.Given)

Example 32 with Given

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);
    }
}
Also used : StandardBusinessDocument(no.difi.meldingsutveksling.domain.sbdh.StandardBusinessDocument) Given(io.cucumber.java.en.Given)

Example 33 with Given

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");
}
Also used : QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) Given(io.cucumber.java.en.Given)

Example 34 with Given

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);
}
Also used : NotImplementedException(org.apache.commons.lang3.NotImplementedException) OperationalEnvironmentEntry(org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry) CassandraOperationStatus(org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus) Given(io.cucumber.java.en.Given)

Example 35 with Given

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);
}
Also used : ApiCredential(com.att.nsa.apiClient.credentials.ApiCredential) NotImplementedException(org.apache.commons.lang3.NotImplementedException) Given(io.cucumber.java.en.Given)

Aggregations

Given (io.cucumber.java.en.Given)251 ReadSettingsHelper.getString (org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString)27 File (java.io.File)19 ArrayList (java.util.ArrayList)13 CitrusResource (com.consol.citrus.annotations.CitrusResource)12 CitrusRuntimeException (com.consol.citrus.exceptions.CitrusRuntimeException)11 Transactional (org.springframework.transaction.annotation.Transactional)11 IOException (java.io.IOException)10 HashMap (java.util.HashMap)10 ExpandedAccountId (com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId)9 Map (java.util.Map)9 Citrus (com.consol.citrus.Citrus)8 TestCaseRunner (com.consol.citrus.TestCaseRunner)8 CitrusFramework (com.consol.citrus.annotations.CitrusFramework)8 TestContext (com.consol.citrus.context.TestContext)8 Before (io.cucumber.java.Before)8 Scenario (io.cucumber.java.Scenario)8 Date (java.util.Date)8 Ssld (org.opensmartgridplatform.domain.core.entities.Ssld)8 Resource (org.springframework.core.io.Resource)8