Search in sources :

Example 36 with Given

use of io.cucumber.java.en.Given in project Selenium_Jan_2022 by TestLeafPages.

the class StepDefinition method openBrowser.

@Given("Open the chrome browser")
public void openBrowser() {
    WebDriverManager.chromedriver().setup();
    driver = new ChromeDriver();
    driver.manage().window().maximize();
    driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
}
Also used : ChromeDriver(org.openqa.selenium.chrome.ChromeDriver) Given(io.cucumber.java.en.Given)

Example 37 with Given

use of io.cucumber.java.en.Given in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class ConnectorSteps method a_connector.

@Given("^a Connector with:$")
public void a_connector(Map<String, String> entry) {
    final Long drv = Long.parseLong(entry.getOrDefault(ConnectorContext.COS_DEPLOYMENT_RESOURCE_VERSION, "1"));
    final Long crv = Long.parseLong(entry.getOrDefault(ConnectorContext.COS_CONNECTOR_RESOURCE_VERSION, "1"));
    final String connectorId = entry.getOrDefault(ConnectorContext.COS_CONNECTOR_ID, uid());
    final String deploymentId = entry.getOrDefault(ConnectorContext.COS_DEPLOYMENT_ID, uid());
    final String clusterId = ctx.clusterId();
    var connector = new ManagedConnectorBuilder().withMetadata(new ObjectMetaBuilder().addToLabels(Resources.LABEL_CLUSTER_ID, clusterId).addToLabels(Resources.LABEL_CONNECTOR_ID, connectorId).addToLabels(Resources.LABEL_DEPLOYMENT_ID, deploymentId).addToLabels(Resources.LABEL_OPERATOR_TYPE, entry.get(ConnectorContext.OPERATOR_TYPE)).withName(Connectors.generateConnectorId(deploymentId)).build()).withSpec(new ManagedConnectorSpecBuilder().withClusterId(clusterId).withConnectorId(connectorId).withDeploymentId(deploymentId).withDeployment(new DeploymentSpecBuilder().withConnectorResourceVersion(crv).withConnectorTypeId(entry.get(ConnectorContext.CONNECTOR_TYPE_ID)).withDeploymentResourceVersion(drv).withKafka(new KafkaSpecBuilder().withUrl(entry.getOrDefault("kafka.bootstrap", "kafka.acme.com:443")).build()).withDesiredState(entry.get(ConnectorContext.DESIRED_STATE)).withSecret(Connectors.generateConnectorId(deploymentId) + "-" + drv).build()).withOperatorSelector(new OperatorSelectorBuilder().withId(entry.get(ConnectorContext.OPERATOR_ID)).withType(entry.get(ConnectorContext.OPERATOR_TYPE)).withVersion(entry.get(ConnectorContext.OPERATOR_VERSION)).build()).build()).build();
    var secret = new SecretBuilder().withMetadata(new ObjectMetaBuilder().addToLabels(Resources.LABEL_OPERATOR_TYPE, entry.get(ConnectorContext.OPERATOR_TYPE)).withName(connector.getMetadata().getName() + "-" + connector.getSpec().getDeployment().getDeploymentResourceVersion()).build()).withData(new HashMap<>()).addToData(Secrets.SECRET_ENTRY_SERVICE_ACCOUNT, Secrets.toBase64(Serialization.asJson(Serialization.jsonMapper().createObjectNode().put("client_id", entry.getOrDefault("kafka.client.id", uid())).put("client_secret", entry.getOrDefault("kafka.client.secret", Secrets.toBase64(uid())))))).build();
    ctx.connector(connector);
    ctx.secret(secret);
}
Also used : SecretBuilder(io.fabric8.kubernetes.api.model.SecretBuilder) DeploymentSpecBuilder(org.bf2.cos.fleetshard.api.DeploymentSpecBuilder) ManagedConnectorBuilder(org.bf2.cos.fleetshard.api.ManagedConnectorBuilder) KafkaSpecBuilder(org.bf2.cos.fleetshard.api.KafkaSpecBuilder) ManagedConnectorSpecBuilder(org.bf2.cos.fleetshard.api.ManagedConnectorSpecBuilder) ObjectMetaBuilder(io.fabric8.kubernetes.api.model.ObjectMetaBuilder) OperatorSelectorBuilder(org.bf2.cos.fleetshard.api.OperatorSelectorBuilder) Given(io.cucumber.java.en.Given)

Example 38 with Given

use of io.cucumber.java.en.Given in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class ManagedConnectorOperatorSteps method a_managedConnectorOperator.

@Given("^a ManagedConnectorOperator with:$")
public void a_managedConnectorOperator(Map<String, String> entry) {
    final String operatorId = entry.getOrDefault("operator.id", uid());
    final String operatorType = entry.get("operator.type");
    final String operatorVersion = entry.get("operator.version");
    final String operatorRuntime = entry.get("operator.runtime");
    var connector = new ManagedConnectorOperatorBuilder().withMetadata(new ObjectMetaBuilder().withName(operatorId).addToLabels(Resources.LABEL_OPERATOR_TYPE, operatorType).addToLabels(Resources.LABEL_OPERATOR_VERSION, operatorVersion).build()).withSpec(new ManagedConnectorOperatorSpecBuilder().withVersion(operatorVersion).withType(operatorType).withRuntime(operatorRuntime).build()).build();
    ctx.managedConnectorOperator(connector);
}
Also used : ManagedConnectorOperatorBuilder(org.bf2.cos.fleetshard.api.ManagedConnectorOperatorBuilder) ObjectMetaBuilder(io.fabric8.kubernetes.api.model.ObjectMetaBuilder) ManagedConnectorOperatorSpecBuilder(org.bf2.cos.fleetshard.api.ManagedConnectorOperatorSpecBuilder) Given(io.cucumber.java.en.Given)

Example 39 with Given

use of io.cucumber.java.en.Given in project open-smart-grid-platform by OSGP.

the class BundledSetAdministrativeStatusSteps method theBundleRequestContainsASetAdministrativeStatusAction.

@Given("^the bundle request contains a set administrative status action$")
public void theBundleRequestContainsASetAdministrativeStatusAction() throws Throwable {
    final SetAdministrativeStatusRequest action = new SetAdministrativeStatusRequestBuilder().withDefaults().build();
    this.addActionToBundleRequest(action);
}
Also used : SetAdministrativeStatusRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.SetAdministrativeStatusRequest) SetAdministrativeStatusRequestBuilder(org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.SetAdministrativeStatusRequestBuilder) Given(io.cucumber.java.en.Given)

Example 40 with Given

use of io.cucumber.java.en.Given in project open-smart-grid-platform by OSGP.

the class BundledSetPushSetupAlarmSteps method theBundleRequestContainsASetPushSetupAlarmAction.

@Given("^the bundle request contains a set push setup alarm action with parameters$")
public void theBundleRequestContainsASetPushSetupAlarmAction(final Map<String, String> parameters) throws Throwable {
    final SetPushSetupAlarmRequest action = new SetPushSetupAlarmRequestBuilder().fromParameterMap(parameters).build();
    this.addActionToBundleRequest(action);
}
Also used : SetPushSetupAlarmRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.SetPushSetupAlarmRequest) SetPushSetupAlarmRequestBuilder(org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.SetPushSetupAlarmRequestBuilder) 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