initial from moneta

This commit is contained in:
rdavidek 2026-03-14 14:10:31 +01:00
parent 6f9048407d
commit 7d0a1b953f
244 changed files with 1642 additions and 2778 deletions

View File

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cz.moneta.demo</groupId>
<artifactId>messaging-connection-demo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kafka.version>3.7.1</kafka.version>
<confluent.version>7.6.1</confluent.version>
<ibm.mq.version>9.4.2.0</ibm.mq.version>
<jakarta.jms.version>3.1.0</jakarta.jms.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>${kafka.version}</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-avro-serializer</artifactId>
<version>${confluent.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>com.ibm.mq.allclient</artifactId>
<version>${ibm.mq.version}</version>
</dependency>
<dependency>
<groupId>jakarta.jms</groupId>
<artifactId>jakarta.jms-api</artifactId>
<version>${jakarta.jms.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>confluent</id>
<name>Confluent Maven Repository</name>
<url>https://packages.confluent.io/maven/</url>
</repository>
</repositories>
</project>

View File

@ -1,69 +0,0 @@
package cz.moneta.demo;
import com.ibm.msg.client.jms.JmsConnectionFactory;
import com.ibm.msg.client.jms.JmsFactoryFactory;
import com.ibm.msg.client.wmq.WMQConstants;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.common.serialization.StringSerializer;
import javax.jms.JMSContext;
import java.util.Properties;
public class MessagingConnectionApp {
public static KafkaProducer<String, String> createKafkaConnection(String bootstrapServers,
String apiKey,
String apiSecret) {
Properties kafkaProps = new Properties();
kafkaProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
kafkaProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
kafkaProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
kafkaProps.put("security.protocol", "SASL_SSL");
kafkaProps.put("sasl.mechanism", "PLAIN");
kafkaProps.put("sasl.jaas.config",
String.format("org.apache.kafka.common.security.plain.PlainLoginModule required username=\"%s\" password=\"%s\";",
apiKey, apiSecret));
return new KafkaProducer<>(kafkaProps);
}
public static JMSContext createMqConnection(String host,
int port,
String channel,
String queueManager,
String user,
String password) throws Exception {
JmsFactoryFactory factoryFactory = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);
JmsConnectionFactory connectionFactory = factoryFactory.createConnectionFactory();
connectionFactory.setStringProperty(WMQConstants.WMQ_HOST_NAME, host);
connectionFactory.setIntProperty(WMQConstants.WMQ_PORT, port);
connectionFactory.setStringProperty(WMQConstants.WMQ_CHANNEL, channel);
connectionFactory.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, queueManager);
connectionFactory.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
connectionFactory.setStringProperty(WMQConstants.USERID, user);
connectionFactory.setStringProperty(WMQConstants.PASSWORD, password);
return connectionFactory.createContext(user, password, JMSContext.AUTO_ACKNOWLEDGE);
}
public static void main(String[] args) throws Exception {
String kafkaBootstrap = System.getProperty("kafka.bootstrap", "localhost:9092");
String kafkaApiKey = System.getProperty("kafka.apiKey", "api-key");
String kafkaApiSecret = System.getProperty("kafka.apiSecret", "api-secret");
String mqHost = System.getProperty("mq.host", "localhost");
int mqPort = Integer.parseInt(System.getProperty("mq.port", "1414"));
String mqChannel = System.getProperty("mq.channel", "DEV.APP.SVRCONN");
String mqQueueManager = System.getProperty("mq.queueManager", "QM1");
String mqUser = System.getProperty("mq.user", "app");
String mqPassword = System.getProperty("mq.password", "pass");
try (KafkaProducer<String, String> kafkaProducer = createKafkaConnection(kafkaBootstrap, kafkaApiKey, kafkaApiSecret);
JMSContext mqContext = createMqConnection(mqHost, mqPort, mqChannel, mqQueueManager, mqUser, mqPassword)) {
System.out.println("Kafka connection created: " + (kafkaProducer != null));
System.out.println("IBM MQ connection created: " + (mqContext != null));
}
}
}

View File

@ -29,10 +29,6 @@
<commons-beanutils.version>1.9.3</commons-beanutils.version>
<commons-configuration.version>1.6</commons-configuration.version>
<cxf.version>4.0.3</cxf.version>
<kafka.version>3.7.1</kafka.version>
<confluent.version>7.6.1</confluent.version>
<ibm.mq.version>9.4.5.0</ibm.mq.version>
<jakarta.jms.version>3.1.0</jakarta.jms.version>
</properties>
<dependencies>
@ -270,48 +266,6 @@
<version>${appium-java-client.version}</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>${kafka.version}</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-avro-serializer</artifactId>
<version>${confluent.version}</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-client</artifactId>
<version>${confluent.version}</version>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>1.11.3</version>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>com.ibm.mq.allclient</artifactId>
<version>${ibm.mq.version}</version>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>javax.jms-api</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>jakarta.jms</groupId>
<artifactId>jakarta.jms-api</artifactId>
<version>${jakarta.jms.version}</version>
</dependency>
<!-- Used for Web Services connector -->
<dependency>
<groupId>org.apache.cxf</groupId>
@ -404,23 +358,6 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.9.0</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@ -454,23 +391,16 @@
<repository>
<snapshots><enabled>false</enabled></snapshots>
<releases><enabled>true</enabled></releases>
<id>confluent</id>
<name>Confluent Hub</name>
<url>https://packages.confluent.io/maven/</url>
<id>central</id>
<name>libs-release</name>
<url>https://artifactory-aws.ux.mbid.cz/artifactory/libs-release</url>
</repository>
<repository>
<snapshots><enabled>false</enabled></snapshots>
<releases><enabled>true</enabled></releases>
<id>mcentral</id>
<name>Maven Central</name>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<snapshots><enabled>false</enabled></snapshots>
<releases><enabled>true</enabled></releases>
<id>mvnrepo</id>
<name>MVN Repository</name>
<url>https://mvnrepository.com/artifact/</url>
<snapshots><enabled>true</enabled></snapshots>
<releases><enabled>false</enabled></releases>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://artifactory-aws.ux.mbid.cz/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>

View File

@ -1,264 +0,0 @@
package cz.moneta.test.harness.connectors.messaging;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import javax.jms.BytesMessage;
import javax.jms.JMSConsumer;
import javax.jms.JMSContext;
import javax.jms.JMSException;
import javax.jms.JMSProducer;
import javax.jms.Message;
import javax.jms.Queue;
import javax.jms.QueueBrowser;
import javax.jms.TextMessage;
import com.ibm.mq.jms.MQConnectionFactory;
import com.ibm.msg.client.wmq.WMQConstants;
import cz.moneta.test.harness.connectors.Connector;
import cz.moneta.test.harness.exception.MessagingTimeoutException;
import cz.moneta.test.harness.messaging.model.MessageContentType;
import cz.moneta.test.harness.messaging.model.MqMessageFormat;
import cz.moneta.test.harness.messaging.model.ReceivedMessage;
public class IbmMqConnector implements Connector {
private static final Charset EBCDIC_870 = Charset.forName("IBM870");
private static final Charset UTF_8 = StandardCharsets.UTF_8;
private final MQConnectionFactory connectionFactory;
private final String user;
private final String password;
private final Object contextLock = new Object();
private volatile JMSContext jmsContext;
public IbmMqConnector(String host,
int port,
String channel,
String queueManager,
String user,
String password,
String keystorePath,
String keystorePassword,
String cipherSuite) {
this.user = user;
this.password = password;
try {
if (keystorePath != null && !keystorePath.isBlank()) {
System.setProperty("javax.net.ssl.keyStore", keystorePath);
System.setProperty("javax.net.ssl.trustStore", keystorePath);
if (keystorePassword != null) {
System.setProperty("javax.net.ssl.keyStorePassword", keystorePassword);
System.setProperty("javax.net.ssl.trustStorePassword", keystorePassword);
}
}
connectionFactory = new MQConnectionFactory();
connectionFactory.setHostName(host);
connectionFactory.setPort(port);
connectionFactory.setQueueManager(queueManager);
connectionFactory.setChannel(channel);
connectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
if (user != null && !user.isBlank()) {
connectionFactory.setStringProperty(WMQConstants.USERID, user);
}
if (password != null && !password.isBlank()) {
connectionFactory.setStringProperty(WMQConstants.PASSWORD, password);
}
if (cipherSuite != null && !cipherSuite.isBlank()) {
connectionFactory.setSSLCipherSuite(cipherSuite);
}
} catch (Exception e) {
throw new IllegalStateException("Failed to initialize IBM MQ connection factory", e);
}
}
public void send(String queueName,
String payload,
MqMessageFormat format,
Map<String, String> properties) {
switch (Objects.requireNonNull(format, "format")) {
case JSON, XML -> sendTextMessage(queueName, payload, properties);
case EBCDIC_870 -> sendBytesMessage(queueName, payload, EBCDIC_870, 870, properties);
case UTF8_1208 -> sendBytesMessage(queueName, payload, UTF_8, 1208, properties);
}
}
public ReceivedMessage receive(String queueName,
String messageSelector,
MqMessageFormat expectedFormat,
Duration timeout) {
JMSContext context = getContext();
Queue queue = context.createQueue("queue:///" + queueName);
try (JMSConsumer consumer = messageSelector == null || messageSelector.isBlank()
? context.createConsumer(queue)
: context.createConsumer(queue, messageSelector)) {
Message message = consumer.receive(Optional.ofNullable(timeout).orElse(Duration.ofSeconds(30)).toMillis());
if (message == null) {
throw new MessagingTimeoutException("Timeout waiting for IBM MQ message from queue: " + queueName);
}
return toReceivedMessage(message, queueName, expectedFormat);
}
}
public List<ReceivedMessage> browse(String queueName,
Predicate<ReceivedMessage> filter,
MqMessageFormat expectedFormat,
Duration timeout) {
long timeoutMillis = Optional.ofNullable(timeout).orElse(Duration.ofSeconds(30)).toMillis();
long deadline = System.currentTimeMillis() + timeoutMillis;
long backoff = 100;
JMSContext context = getContext();
Queue queue = context.createQueue("queue:///" + queueName);
while (System.currentTimeMillis() < deadline) {
List<ReceivedMessage> matched = new ArrayList<>();
try (QueueBrowser browser = context.createBrowser(queue)) {
Enumeration<?> messages = browser.getEnumeration();
while (messages.hasMoreElements()) {
Message message = (Message) messages.nextElement();
ReceivedMessage receivedMessage = toReceivedMessage(message, queueName, expectedFormat);
if (filter == null || filter.test(receivedMessage)) {
matched.add(receivedMessage);
}
}
} catch (JMSException e) {
throw new IllegalStateException("Failed to browse IBM MQ queue: " + queueName, e);
}
if (!matched.isEmpty()) {
return matched;
}
try {
TimeUnit.MILLISECONDS.sleep(backoff);
} catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
break;
}
backoff = Math.min(backoff * 2, 1000);
}
throw new MessagingTimeoutException("Timeout waiting for IBM MQ message from queue: " + queueName);
}
@Override
public void close() {
JMSContext context = jmsContext;
if (context != null) {
context.close();
}
}
private void sendTextMessage(String queueName, String payload, Map<String, String> properties) {
JMSContext context = getContext();
JMSProducer producer = context.createProducer();
TextMessage message = context.createTextMessage(payload);
applyProperties(message, properties);
producer.send(context.createQueue("queue:///" + queueName), message);
}
private void sendBytesMessage(String queueName,
String payload,
Charset charset,
int ccsid,
Map<String, String> properties) {
try {
JMSContext context = getContext();
JMSProducer producer = context.createProducer();
BytesMessage message = context.createBytesMessage();
message.writeBytes(Optional.ofNullable(payload).orElse("").getBytes(charset));
message.setIntProperty(WMQConstants.JMS_IBM_CHARACTER_SET, ccsid);
applyProperties(message, properties);
producer.send(context.createQueue("queue:///" + queueName), message);
} catch (JMSException e) {
throw new IllegalStateException("Failed to send bytes message to IBM MQ queue: " + queueName, e);
}
}
private void applyProperties(Message message, Map<String, String> properties) {
Optional.ofNullable(properties).orElseGet(Collections::emptyMap)
.forEach((key, value) -> {
try {
message.setStringProperty(key, String.valueOf(value));
} catch (JMSException e) {
throw new IllegalStateException("Failed to set JMS property: " + key, e);
}
});
}
private ReceivedMessage toReceivedMessage(Message message, String queueName, MqMessageFormat format) {
try {
Map<String, String> headers = new LinkedHashMap<>();
Enumeration<?> names = message.getPropertyNames();
while (names.hasMoreElements()) {
String name = String.valueOf(names.nextElement());
headers.put(name, String.valueOf(message.getObjectProperty(name)));
}
String body = decodeMessage(message, format);
MessageContentType contentType = resolveContentType(message, format);
return new ReceivedMessage(body, contentType, headers, message.getJMSTimestamp(), queueName);
} catch (JMSException e) {
throw new IllegalStateException("Failed to decode IBM MQ message", e);
}
}
private MessageContentType resolveContentType(Message message, MqMessageFormat expectedFormat) {
if (message instanceof TextMessage) {
return expectedFormat == MqMessageFormat.XML ? MessageContentType.XML : MessageContentType.JSON;
}
if (expectedFormat == MqMessageFormat.XML) {
return MessageContentType.XML;
}
if (expectedFormat == MqMessageFormat.JSON) {
return MessageContentType.JSON;
}
return MessageContentType.RAW_TEXT;
}
private String decodeMessage(Message jmsMessage, MqMessageFormat format) {
try {
if (jmsMessage instanceof TextMessage textMessage) {
return textMessage.getText();
}
if (jmsMessage instanceof BytesMessage bytesMessage) {
byte[] data = new byte[(int) bytesMessage.getBodyLength()];
bytesMessage.readBytes(data);
Charset charset = switch (format) {
case EBCDIC_870 -> EBCDIC_870;
case UTF8_1208, JSON, XML -> UTF_8;
};
return new String(data, charset);
}
return "";
} catch (Exception e) {
throw new IllegalStateException("Failed to decode JMS message", e);
}
}
private JMSContext getContext() {
JMSContext current = jmsContext;
if (current == null) {
synchronized (contextLock) {
current = jmsContext;
if (current == null) {
jmsContext = current = connectionFactory.createContext(user, password, JMSContext.AUTO_ACKNOWLEDGE);
}
}
}
return current;
}
}

View File

@ -1,353 +0,0 @@
package cz.moneta.test.harness.connectors.messaging;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import cz.moneta.test.harness.connectors.Connector;
import cz.moneta.test.harness.exception.MessagingTimeoutException;
import cz.moneta.test.harness.messaging.model.MessageContentType;
import cz.moneta.test.harness.messaging.model.ReceivedMessage;
import io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient;
import io.confluent.kafka.serializers.AbstractKafkaSchemaSerDeConfig;
import io.confluent.kafka.serializers.KafkaAvroDeserializer;
import io.confluent.kafka.serializers.KafkaAvroDeserializerConfig;
import io.confluent.kafka.serializers.KafkaAvroSerializer;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericRecord;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.header.Header;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Base64;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
public class KafkaConnector implements Connector {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private final Properties producerProps = new Properties();
private final Properties consumerProps = new Properties();
private final CachedSchemaRegistryClient schemaRegistryClient;
private volatile KafkaProducer<String, GenericRecord> producer;
private final Object producerLock = new Object();
public KafkaConnector(String bootstrapServers,
String apiKey,
String apiSecret,
String schemaRegistryUrl,
String schemaRegistryApiKey,
String schemaRegistryApiSecret) {
String jaasConfig = String.format("org.apache.kafka.common.security.plain.PlainLoginModule required username=\"%s\" password=\"%s\";",
apiKey,
apiSecret);
String schemaRegistryAuth = schemaRegistryApiKey + ":" + schemaRegistryApiSecret;
producerProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
producerProps.put("security.protocol", "SASL_SSL");
producerProps.put("sasl.mechanism", "PLAIN");
producerProps.put("sasl.jaas.config", jaasConfig);
producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, KafkaAvroSerializer.class.getName());
producerProps.put(AbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, schemaRegistryUrl);
producerProps.put(AbstractKafkaSchemaSerDeConfig.BASIC_AUTH_CREDENTIALS_SOURCE, "USER_INFO");
producerProps.put(AbstractKafkaSchemaSerDeConfig.USER_INFO_CONFIG, schemaRegistryAuth);
producerProps.put("auto.register.schemas", "false");
consumerProps.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
consumerProps.put("security.protocol", "SASL_SSL");
consumerProps.put("sasl.mechanism", "PLAIN");
consumerProps.put("sasl.jaas.config", jaasConfig);
consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, KafkaAvroDeserializer.class.getName());
consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "latest");
consumerProps.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "false");
consumerProps.put(KafkaAvroDeserializerConfig.SPECIFIC_AVRO_READER_CONFIG, "false");
consumerProps.put(AbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, schemaRegistryUrl);
consumerProps.put(AbstractKafkaSchemaSerDeConfig.BASIC_AUTH_CREDENTIALS_SOURCE, "USER_INFO");
consumerProps.put(AbstractKafkaSchemaSerDeConfig.USER_INFO_CONFIG, schemaRegistryAuth);
this.schemaRegistryClient = new CachedSchemaRegistryClient(schemaRegistryUrl, 128);
}
public void send(String topic, String key, String jsonPayload, Map<String, String> headers) {
Objects.requireNonNull(topic, "topic");
Schema schema = getSchemaForTopic(topic);
GenericRecord record = jsonToAvro(jsonPayload, schema);
ProducerRecord<String, GenericRecord> producerRecord = new ProducerRecord<>(topic, key, record);
Optional.ofNullable(headers).orElseGet(HashMap::new)
.forEach((headerKey, headerValue) -> producerRecord.headers()
.add(headerKey, String.valueOf(headerValue).getBytes(StandardCharsets.UTF_8)));
try {
getProducer().send(producerRecord).get(30, TimeUnit.SECONDS);
} catch (Exception e) {
throw new IllegalStateException("Failed to send Kafka message to topic: " + topic, e);
}
}
public List<ReceivedMessage> receive(String topic,
Predicate<ReceivedMessage> filter,
Duration timeout) {
long timeoutMillis = Optional.ofNullable(timeout).orElse(Duration.ofSeconds(30)).toMillis();
long deadline = System.currentTimeMillis() + timeoutMillis;
long backoff = 100;
try (KafkaConsumer<String, Object> consumer = createConsumer()) {
List<TopicPartition> partitions = consumer.partitionsFor(topic).stream()
.map(info -> new TopicPartition(topic, info.partition()))
.toList();
consumer.assign(partitions);
consumer.seekToEnd(partitions);
while (System.currentTimeMillis() < deadline) {
ConsumerRecords<String, Object> records = consumer.poll(Duration.ofMillis(100));
if (!records.isEmpty()) {
for (ConsumerRecord<String, Object> record : records) {
ReceivedMessage message = toReceivedMessage(record);
if (filter == null || filter.test(message)) {
return List.of(message);
}
}
backoff = 100;
continue;
}
TimeUnit.MILLISECONDS.sleep(backoff);
backoff = Math.min(backoff * 2, 1000);
}
} catch (MessagingTimeoutException e) {
throw e;
} catch (Exception e) {
throw new IllegalStateException("Failed to receive Kafka message from topic: " + topic, e);
}
throw new MessagingTimeoutException("Timeout waiting for Kafka message from topic: " + topic);
}
public Map<TopicPartition, Long> saveOffsets(String topic) {
try (KafkaConsumer<String, Object> consumer = createConsumer()) {
List<TopicPartition> partitions = consumer.partitionsFor(topic).stream()
.map(info -> new TopicPartition(topic, info.partition()))
.toList();
consumer.assign(partitions);
consumer.seekToEnd(partitions);
Map<TopicPartition, Long> offsets = new HashMap<>();
partitions.forEach(partition -> offsets.put(partition, consumer.position(partition)));
return offsets;
}
}
@Override
public void close() {
KafkaProducer<String, GenericRecord> current = producer;
if (current != null) {
current.close(Duration.ofSeconds(5));
}
}
private KafkaProducer<String, GenericRecord> getProducer() {
KafkaProducer<String, GenericRecord> current = producer;
if (current == null) {
synchronized (producerLock) {
current = producer;
if (current == null) {
producer = current = new KafkaProducer<>(producerProps);
}
}
}
return current;
}
private KafkaConsumer<String, Object> createConsumer() {
Properties properties = new Properties();
properties.putAll(consumerProps);
properties.put(ConsumerConfig.GROUP_ID_CONFIG, "harness-" + UUID.randomUUID());
return new KafkaConsumer<>(properties);
}
private ReceivedMessage toReceivedMessage(ConsumerRecord<String, Object> record) {
String body = convertValueToJson(record.value());
Map<String, String> headers = new LinkedHashMap<>();
for (Header header : record.headers()) {
headers.put(header.key(), new String(header.value(), StandardCharsets.UTF_8));
}
return new ReceivedMessage(body,
MessageContentType.JSON,
headers,
record.timestamp(),
record.topic());
}
private String convertValueToJson(Object value) {
try {
if (value instanceof GenericRecord genericRecord) {
return avroToJson(genericRecord);
}
if (value instanceof CharSequence) {
return value.toString();
}
return OBJECT_MAPPER.writeValueAsString(value);
} catch (Exception e) {
throw new IllegalStateException("Failed to convert Kafka payload to JSON", e);
}
}
private Schema getSchemaForTopic(String topic) {
String subject = topic + "-value";
try {
// Get all versions and use the latest one
java.util.List<Integer> versions = schemaRegistryClient.getAllVersions(subject);
int latestVersion = versions.get(versions.size() - 1);
io.confluent.kafka.schemaregistry.client.rest.entities.Schema confluentSchema =
schemaRegistryClient.getByVersion(subject, latestVersion, false);
String schemaString = confluentSchema.getSchema();
return new Schema.Parser().parse(schemaString);
} catch (Exception e) {
throw new IllegalStateException("Failed to get schema for subject: " + subject, e);
}
}
private String avroToJson(GenericRecord record) {
try {
return OBJECT_MAPPER.writeValueAsString(convertAvroObject(record));
} catch (Exception e) {
throw new IllegalStateException("Failed to convert Avro record to JSON", e);
}
}
private GenericRecord jsonToAvro(String jsonPayload, Schema schema) {
try {
JsonNode root = OBJECT_MAPPER.readTree(jsonPayload);
Object converted = convertJsonNode(root, schema);
return (GenericRecord) converted;
} catch (Exception e) {
throw new IllegalStateException("Failed to convert JSON payload to Avro", e);
}
}
private Object convertJsonNode(JsonNode node, Schema schema) {
return switch (schema.getType()) {
case RECORD -> {
GenericData.Record record = new GenericData.Record(schema);
schema.getFields().forEach(field -> record.put(field.name(),
convertJsonNode(node.path(field.name()), field.schema())));
yield record;
}
case ARRAY -> {
List<Object> values = new ArrayList<>();
node.forEach(item -> values.add(convertJsonNode(item, schema.getElementType())));
yield values;
}
case MAP -> {
Map<String, Object> map = new HashMap<>();
node.fields().forEachRemaining(entry -> map.put(entry.getKey(),
convertJsonNode(entry.getValue(), schema.getValueType())));
yield map;
}
case UNION -> resolveUnion(node, schema);
case ENUM -> new GenericData.EnumSymbol(schema, node.asText());
case FIXED -> {
byte[] fixedBytes = toBytes(node);
yield new GenericData.Fixed(schema, fixedBytes);
}
case STRING -> node.isNull() ? null : node.asText();
case INT -> node.isNull() ? null : node.asInt();
case LONG -> node.isNull() ? null : node.asLong();
case FLOAT -> node.isNull() ? null : (float) node.asDouble();
case DOUBLE -> node.isNull() ? null : node.asDouble();
case BOOLEAN -> node.isNull() ? null : node.asBoolean();
case BYTES -> ByteBuffer.wrap(toBytes(node));
case NULL -> null;
};
}
private Object resolveUnion(JsonNode node, Schema unionSchema) {
if (node == null || node.isNull()) {
return null;
}
IllegalStateException lastException = null;
for (Schema candidate : unionSchema.getTypes()) {
if (candidate.getType() == Schema.Type.NULL) {
continue;
}
try {
Object value = convertJsonNode(node, candidate);
if (GenericData.get().validate(candidate, value)) {
return value;
}
} catch (Exception e) {
lastException = new IllegalStateException("Failed to resolve union type", e);
}
}
if (lastException != null) {
throw lastException;
}
throw new IllegalStateException("Cannot resolve union for node: " + node);
}
private byte[] toBytes(JsonNode node) {
if (node.isBinary()) {
try {
return node.binaryValue();
} catch (Exception ignored) {
// fallback to textual representation
}
}
String text = node.asText();
try {
return Base64.getDecoder().decode(text);
} catch (Exception ignored) {
return text.getBytes(StandardCharsets.UTF_8);
}
}
private Object convertAvroObject(Object value) {
if (value == null) {
return null;
}
if (value instanceof GenericRecord record) {
Map<String, Object> jsonObject = new LinkedHashMap<>();
record.getSchema().getFields().forEach(field -> jsonObject.put(field.name(), convertAvroObject(record.get(field.name()))));
return jsonObject;
}
if (value instanceof GenericData.Array<?> array) {
List<Object> values = new ArrayList<>(array.size());
array.forEach(item -> values.add(convertAvroObject(item)));
return values;
}
if (value instanceof Map<?, ?> map) {
Map<String, Object> values = new LinkedHashMap<>();
map.forEach((key, item) -> values.put(String.valueOf(key), convertAvroObject(item)));
return values;
}
if (value instanceof ByteBuffer byteBuffer) {
ByteBuffer duplicate = byteBuffer.duplicate();
byte[] bytes = new byte[duplicate.remaining()];
duplicate.get(bytes);
return Base64.getEncoder().encodeToString(bytes);
}
return value;
}
}

View File

@ -55,4 +55,5 @@ public class CaGwEndpoint implements RestEndpoint {
public StoreAccessor getStore() {
return store;
}
}

View File

@ -1,125 +0,0 @@
package cz.moneta.test.harness.endpoints.messaging;
import cz.moneta.test.harness.connectors.VaultConnector;
import cz.moneta.test.harness.connectors.messaging.IbmMqConnector;
import cz.moneta.test.harness.constants.HarnessConfigConstants;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.Endpoint;
import cz.moneta.test.harness.messaging.model.MqMessageFormat;
import cz.moneta.test.harness.messaging.model.ReceivedMessage;
import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Predicate;
public class IbmMqEndpoint implements Endpoint {
private static final String CONFIG_HOST = "endpoints.imq-first-vision.host";
private static final String CONFIG_PORT = "endpoints.imq-first-vision.port";
private static final String CONFIG_CHANNEL = "endpoints.imq-first-vision.channel";
private static final String CONFIG_QUEUE_MANAGER = "endpoints.imq-first-vision.queue-manager";
private static final String CONFIG_KEYSTORE_PATH = "endpoints.imq-first-vision.keystore.path";
private static final String CONFIG_KEYSTORE_PASSWORD = "endpoints.imq-first-vision.keystore.password";
private static final String CONFIG_VAULT_PATH = "vault.path.messaging.ibmmq";
private static final String CONFIG_USERNAME = "endpoints.imq-first-vision.username";
private static final String CONFIG_PASSWORD = "endpoints.imq-first-vision.password";
private static final String CONFIG_SSL_CYPHER_SUITES = "endpoints.imq-first-vision.ssl-cipher-suite";
private final StoreAccessor store;
private volatile IbmMqConnector connector;
private final Object connectorLock = new Object();
public IbmMqEndpoint(StoreAccessor store) {
this.store = store;
}
public void send(String queueName,
String payload,
MqMessageFormat format,
Map<String, String> properties) {
getConnector().send(queueName, payload, format, properties);
}
public ReceivedMessage receive(String queueName,
String messageSelector,
MqMessageFormat expectedFormat,
Duration timeout) {
return getConnector().receive(queueName, messageSelector, expectedFormat, timeout);
}
public List<ReceivedMessage> browse(String queueName,
Predicate<ReceivedMessage> filter,
MqMessageFormat expectedFormat,
Duration timeout) {
return getConnector().browse(queueName, filter, expectedFormat, timeout);
}
@Override
public void close() {
IbmMqConnector current = connector;
if (current != null) {
current.close();
}
}
private IbmMqConnector getConnector() {
IbmMqConnector current = connector;
if (current == null) {
synchronized (connectorLock) {
current = connector;
if (current == null) {
current = createConnector();
connector = current;
}
}
}
return current;
}
private IbmMqConnector createConnector() {
String host = requireConfig(CONFIG_HOST);
int port = Integer.parseInt(requireConfig(CONFIG_PORT));
String channel = requireConfig(CONFIG_CHANNEL);
String queueManager = requireConfig(CONFIG_QUEUE_MANAGER);
String username = resolveSecret(CONFIG_USERNAME, "username");
String password = resolveSecret(CONFIG_PASSWORD, "password");
String keystorePath = store.getConfig(CONFIG_KEYSTORE_PATH);
String keystorePassword = store.getConfig(CONFIG_KEYSTORE_PASSWORD);
String sslCipherSuites = store.getConfig(CONFIG_SSL_CYPHER_SUITES);
return new IbmMqConnector(host, port, channel, queueManager, username, password, keystorePath, keystorePassword, sslCipherSuites);
}
private String resolveSecret(String localConfigKey, String vaultKey) {
return Optional.ofNullable(store.getConfig(localConfigKey))
.or(() -> readFromVault(vaultKey))
.orElseThrow(() -> new IllegalStateException("Missing messaging secret: " + localConfigKey));
}
private Optional<String> readFromVault(String key) {
String path = store.getConfig(CONFIG_VAULT_PATH);
if (path == null || path.isBlank()) {
return Optional.empty();
}
String basePath = store.getConfig("vault.path.base");
String resolvedPath = path.startsWith("/") || basePath == null || basePath.isBlank()
? path
: basePath + "/" + path;
return createVaultConnector().flatMap(vault -> vault.getValue(resolvedPath, key));
}
private Optional<VaultConnector> createVaultConnector() {
return Optional.ofNullable(store.getConfig(HarnessConfigConstants.VAULT_URL_CONFIG))
.flatMap(url -> Optional.ofNullable(store.getConfig(HarnessConfigConstants.VAULT_USERNAME_CONFIG))
.flatMap(username -> Optional.ofNullable(store.getConfig(HarnessConfigConstants.VAULT_PASSWORD_CONFIG))
.map(password -> new VaultConnector(url, username, password))));
}
private String requireConfig(String key) {
return Optional.ofNullable(store.getConfig(key))
.orElseThrow(() -> new IllegalStateException("Missing required config: " + key));
}
}

View File

@ -1,119 +0,0 @@
package cz.moneta.test.harness.endpoints.messaging;
import cz.moneta.test.harness.connectors.VaultConnector;
import cz.moneta.test.harness.connectors.messaging.KafkaConnector;
import cz.moneta.test.harness.constants.HarnessConfigConstants;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.Endpoint;
import cz.moneta.test.harness.messaging.model.ReceivedMessage;
import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Predicate;
public class KafkaEndpoint implements Endpoint {
private static final String CONFIG_BOOTSTRAP_SERVERS = "messaging.kafka.bootstrap-servers";
private static final String CONFIG_SCHEMA_REGISTRY_URL = "messaging.kafka.schema-registry-url";
private static final String CONFIG_VAULT_PATH = "vault.path.messaging.kafka";
private static final String CONFIG_API_KEY = "messaging.kafka.api-key";
private static final String CONFIG_API_SECRET = "messaging.kafka.api-secret";
private static final String CONFIG_SCHEMA_REGISTRY_API_KEY = "messaging.kafka.schema-registry-api-key";
private static final String CONFIG_SCHEMA_REGISTRY_API_SECRET = "messaging.kafka.schema-registry-api-secret";
private static final String VAULT_API_KEY = "apiKey";
private static final String VAULT_API_SECRET = "apiSecret";
private static final String VAULT_SCHEMA_REGISTRY_API_KEY = "schemaRegistryApiKey";
private static final String VAULT_SCHEMA_REGISTRY_API_SECRET = "schemaRegistryApiSecret";
private final StoreAccessor store;
private volatile KafkaConnector connector;
private final Object connectorLock = new Object();
public KafkaEndpoint(StoreAccessor store) {
this.store = store;
}
public void send(String topic, String key, String payload, Map<String, String> headers) {
getConnector().send(topic, key, payload, headers);
}
public ReceivedMessage receive(String topic, Predicate<ReceivedMessage> filter, Duration timeout) {
List<ReceivedMessage> messages = getConnector().receive(topic, filter, timeout);
return messages.isEmpty() ? null : messages.get(0);
}
@Override
public void close() {
KafkaConnector current = connector;
if (current != null) {
current.close();
}
}
private KafkaConnector getConnector() {
KafkaConnector current = connector;
if (current == null) {
synchronized (connectorLock) {
current = connector;
if (current == null) {
current = createConnector();
connector = current;
}
}
}
return current;
}
private KafkaConnector createConnector() {
String bootstrapServers = requireConfig(CONFIG_BOOTSTRAP_SERVERS);
String schemaRegistryUrl = requireConfig(CONFIG_SCHEMA_REGISTRY_URL);
String apiKey = resolveSecret(CONFIG_API_KEY, VAULT_API_KEY);
String apiSecret = resolveSecret(CONFIG_API_SECRET, VAULT_API_SECRET);
String schemaRegistryApiKey = resolveSecret(CONFIG_SCHEMA_REGISTRY_API_KEY, VAULT_SCHEMA_REGISTRY_API_KEY);
String schemaRegistryApiSecret = resolveSecret(CONFIG_SCHEMA_REGISTRY_API_SECRET, VAULT_SCHEMA_REGISTRY_API_SECRET);
return new KafkaConnector(
bootstrapServers,
apiKey,
apiSecret,
schemaRegistryUrl,
schemaRegistryApiKey,
schemaRegistryApiSecret
);
}
private String resolveSecret(String localConfigKey, String vaultKey) {
return Optional.ofNullable(store.getConfig(localConfigKey))
.or(() -> readFromVault(vaultKey))
.orElseThrow(() -> new IllegalStateException("Missing messaging secret: " + localConfigKey));
}
private Optional<String> readFromVault(String key) {
String path = store.getConfig(CONFIG_VAULT_PATH);
if (path == null || path.isBlank()) {
return Optional.empty();
}
String basePath = store.getConfig("vault.path.base");
String resolvedPath = path.startsWith("/") || basePath == null || basePath.isBlank()
? path
: basePath + "/" + path;
return createVaultConnector().flatMap(vault -> vault.getValue(resolvedPath, key));
}
private Optional<VaultConnector> createVaultConnector() {
return Optional.ofNullable(store.getConfig(HarnessConfigConstants.VAULT_URL_CONFIG))
.flatMap(url -> Optional.ofNullable(store.getConfig(HarnessConfigConstants.VAULT_USERNAME_CONFIG))
.flatMap(username -> Optional.ofNullable(store.getConfig(HarnessConfigConstants.VAULT_PASSWORD_CONFIG))
.map(password -> new VaultConnector(url, username, password))));
}
private String requireConfig(String key) {
return Optional.ofNullable(store.getConfig(key))
.orElseThrow(() -> new IllegalStateException("Missing required config: " + key));
}
}

View File

@ -1,130 +0,0 @@
package cz.moneta.test.harness.endpoints.messaging;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.Endpoint;
import cz.moneta.test.harness.exception.MessagingTimeoutException;
import cz.moneta.test.harness.messaging.model.Destination;
import cz.moneta.test.harness.messaging.model.MqMessageFormat;
import cz.moneta.test.harness.messaging.model.Queue;
import cz.moneta.test.harness.messaging.model.ReceivedMessage;
import cz.moneta.test.harness.messaging.model.Topic;
import java.time.Duration;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Predicate;
public class MessagingEndpoint implements Endpoint {
private final StoreAccessor store;
private volatile KafkaEndpoint kafkaEndpoint;
private volatile IbmMqEndpoint ibmMqEndpoint;
private final Object endpointLock = new Object();
public MessagingEndpoint(StoreAccessor store) {
this.store = store;
}
public void send(String destinationName,
String key,
String payload,
MqMessageFormat formatOverride,
Map<String, String> headers) {
Destination destination = resolveDestination(destinationName);
if (destination instanceof Topic topic) {
getKafkaEndpoint().send(topic.getTopicName(), key, payload, headers);
return;
}
Queue queue = (Queue) destination;
MqMessageFormat format = Optional.ofNullable(formatOverride).orElse(queue.getFormat());
getIbmMqEndpoint().send(queue.getQueueName(), payload, format, headers);
}
public ReceivedMessage receive(String destinationName,
Predicate<ReceivedMessage> filter,
Duration timeout,
MqMessageFormat formatOverride) {
Destination destination = resolveDestination(destinationName);
if (destination instanceof Topic topic) {
return getKafkaEndpoint().receive(topic.getTopicName(), filter, timeout);
}
Queue queue = (Queue) destination;
MqMessageFormat format = Optional.ofNullable(formatOverride).orElse(queue.getFormat());
List<ReceivedMessage> messages = getIbmMqEndpoint().browse(queue.getQueueName(), filter, format, timeout);
if (messages.isEmpty()) {
throw new MessagingTimeoutException("No IBM MQ message found for destination: " + destinationName);
}
return messages.get(0);
}
public Destination resolveDestination(String destinationName) {
String prefix = "messaging.destination." + destinationName + ".";
String type = Optional.ofNullable(store.getConfig(prefix + "type"))
.map(v -> v.toLowerCase(Locale.ROOT))
.orElseThrow(() -> new IllegalStateException("Missing destination config: " + prefix + "type"));
return switch (type) {
case "kafka" -> {
String topic = requireConfig(prefix + "topic");
yield new Topic(destinationName, topic);
}
case "ibmmq" -> {
String queue = requireConfig(prefix + "queue");
String format = store.getConfig(prefix + "format", MqMessageFormat.JSON.name().toLowerCase(Locale.ROOT));
yield new Queue(destinationName, queue, MqMessageFormat.fromConfig(format, MqMessageFormat.JSON));
}
default -> throw new IllegalStateException("Unsupported destination type '" + type + "' for destination: " + destinationName);
};
}
@Override
public void close() {
KafkaEndpoint kafka = kafkaEndpoint;
if (kafka != null) {
kafka.close();
}
IbmMqEndpoint mq = ibmMqEndpoint;
if (mq != null) {
mq.close();
}
}
private KafkaEndpoint getKafkaEndpoint() {
KafkaEndpoint current = kafkaEndpoint;
if (current == null) {
synchronized (endpointLock) {
current = kafkaEndpoint;
if (current == null) {
current = new KafkaEndpoint(store);
kafkaEndpoint = current;
}
}
}
return current;
}
private IbmMqEndpoint getIbmMqEndpoint() {
IbmMqEndpoint current = ibmMqEndpoint;
if (current == null) {
synchronized (endpointLock) {
current = ibmMqEndpoint;
if (current == null) {
current = new IbmMqEndpoint(store);
ibmMqEndpoint = current;
}
}
}
return current;
}
private String requireConfig(String key) {
return Optional.ofNullable(store.getConfig(key))
.filter(v -> !Objects.equals(v.trim(), ""))
.orElseThrow(() -> new IllegalStateException("Missing required config: " + key));
}
}

View File

@ -0,0 +1,51 @@
package cz.moneta.test.harness.endpoints.payment_engine;
import cz.moneta.test.harness.connectors.rest.RestConnector;
import cz.moneta.test.harness.connectors.rest.SimpleRestConnector;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.RestEndpoint;
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.core.GenericType;
import org.apache.commons.lang3.tuple.Pair;
import java.util.Map;
import java.util.Optional;
public class PaeMqEndpoint implements RestEndpoint {
private RestConnector restConnector;
private StoreAccessor store;
public PaeMqEndpoint(StoreAccessor store) {
this.store = store;
String endpointName = "endpoints.pae-mq.url";
this.restConnector = Optional.ofNullable(store.getConfig(endpointName))
.map(url -> new SimpleRestConnector(url, "PaeMqServerLogger"))
.orElseThrow(() -> new IllegalStateException("You need to configure " + endpointName + " to work with PAE IBM MQ server"));
}
@Override
public <T> Pair<Integer, T> get(String path, Map<String, Object> properties, Class<T> responseType, Map<String, Object> headers) {
return restConnector.get(path, properties, new GenericType<>(responseType), headers);
}
@Override
public <T> Pair<Integer, T> post(String path, Entity<?> request, Class<T> responseType, Map<String, Object> headers, boolean rawResponse) {
return restConnector.post(path, request, new GenericType<>(responseType), headers);
}
@Override
public <T> Pair<Integer, T> delete(String path, Map<String, Object> properties, Class<T> responseType, Map<String, Object> headers) {
return restConnector.delete(path, properties, new GenericType<>(responseType), headers);
}
@Override
public <T> Pair<Integer, T> patch(String path, Entity<?> request, Class<T> responseType, Map<String, Object> headers, boolean rawResponse) {
return restConnector.patch(path, request, new GenericType<>(responseType), headers);
}
@Override
public StoreAccessor getStore() {
return store;
}
}

View File

@ -1,8 +0,0 @@
package cz.moneta.test.harness.exception;
public class MessagingTimeoutException extends HarnessException {
public MessagingTimeoutException(String message) {
super(message);
}
}

View File

@ -1,22 +0,0 @@
package cz.moneta.test.harness.messaging.model;
import java.util.Objects;
public abstract class Destination {
private final String name;
private final String type;
protected Destination(String name, String type) {
this.name = Objects.requireNonNull(name, "name");
this.type = Objects.requireNonNull(type, "type");
}
public String getName() {
return name;
}
public String getType() {
return type;
}
}

View File

@ -1,7 +0,0 @@
package cz.moneta.test.harness.messaging.model;
public enum MessageContentType {
JSON,
XML,
RAW_TEXT
}

View File

@ -1,18 +0,0 @@
package cz.moneta.test.harness.messaging.model;
import java.util.Locale;
import java.util.Optional;
public enum MqMessageFormat {
JSON,
XML,
EBCDIC_870,
UTF8_1208;
public static MqMessageFormat fromConfig(String value, MqMessageFormat defaultValue) {
return Optional.ofNullable(value)
.map(v -> v.toUpperCase(Locale.ROOT).replace('-', '_'))
.map(MqMessageFormat::valueOf)
.orElse(defaultValue);
}
}

View File

@ -1,23 +0,0 @@
package cz.moneta.test.harness.messaging.model;
import java.util.Objects;
public class Queue extends Destination {
private final String queueName;
private final MqMessageFormat format;
public Queue(String name, String queueName, MqMessageFormat format) {
super(name, "ibmmq");
this.queueName = Objects.requireNonNull(queueName, "queueName");
this.format = Objects.requireNonNull(format, "format");
}
public String getQueueName() {
return queueName;
}
public MqMessageFormat getFormat() {
return format;
}
}

View File

@ -1,167 +0,0 @@
package cz.moneta.test.harness.messaging.model;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.MissingNode;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import org.apache.commons.lang3.StringUtils;
import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import java.io.StringReader;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
public class ReceivedMessage {
private static final Pattern ARRAY_NODE_PATTERN = Pattern.compile("(.*?)\\[([0-9]*?)\\]");
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
private static final XmlMapper XML_MAPPER = new XmlMapper();
private final String body;
private final MessageContentType contentType;
private final Map<String, String> headers;
private final long timestamp;
private final String source;
public ReceivedMessage(String body,
MessageContentType contentType,
Map<String, String> headers,
long timestamp,
String source) {
this.body = Optional.ofNullable(body).orElse("");
this.contentType = Objects.requireNonNull(contentType, "contentType");
this.headers = Collections.unmodifiableMap(new LinkedHashMap<>(Optional.ofNullable(headers).orElseGet(Collections::emptyMap)));
this.timestamp = timestamp;
this.source = Optional.ofNullable(source).orElse("");
}
public JsonNode extractJson(String path) {
JsonNode root = readJsonLikeNode();
return extractNode(path, root);
}
public String extractXml(String xpathExpression) {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
factory.setNamespaceAware(false);
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader(body)));
XPath xpath = XPathFactory.newInstance().newXPath();
xpath.setNamespaceContext(new EmptyNamespaceContext());
return String.valueOf(xpath.evaluate(xpathExpression, document, XPathConstants.STRING));
} catch (Exception e) {
throw new IllegalStateException("Failed to extract xml value for expression: " + xpathExpression, e);
}
}
public String extract(String expression) {
return switch (contentType) {
case JSON -> extractJson(expression).asText();
case XML -> extractXml(expression);
case RAW_TEXT -> body;
};
}
public <T> T mapTo(Class<T> type) {
try {
return switch (contentType) {
case JSON -> JSON_MAPPER.readValue(body, type);
case XML -> XML_MAPPER.readValue(body, type);
case RAW_TEXT -> {
if (String.class.equals(type)) {
yield type.cast(body);
}
throw new IllegalStateException("RAW_TEXT can only be mapped to String");
}
};
} catch (Exception e) {
throw new IllegalStateException("Failed to map message body", e);
}
}
public String getBody() {
return body;
}
public MessageContentType getContentType() {
return contentType;
}
public Map<String, String> getHeaders() {
return headers;
}
public long getTimestamp() {
return timestamp;
}
public String getSource() {
return source;
}
private JsonNode readJsonLikeNode() {
try {
return switch (contentType) {
case JSON -> JSON_MAPPER.readTree(body);
case XML -> XML_MAPPER.readTree(body.getBytes());
case RAW_TEXT -> {
if (StringUtils.isBlank(body)) {
yield MissingNode.getInstance();
}
yield JSON_MAPPER.readTree(body);
}
};
} catch (Exception e) {
throw new IllegalStateException("Unable to parse message as JSON-like content", e);
}
}
private static JsonNode extractNode(String path, JsonNode rootNode) {
return Arrays.stream(path.split("\\."))
.filter(StringUtils::isNotEmpty)
.reduce(rootNode,
(r, p) -> {
Matcher matcher = ARRAY_NODE_PATTERN.matcher(p);
if (matcher.find()) {
return r.path(matcher.group(1)).path(Integer.parseInt(matcher.group(2)));
}
return r.path(p);
},
(j1, j2) -> j1);
}
private static final class EmptyNamespaceContext implements NamespaceContext {
@Override
public String getNamespaceURI(String prefix) {
return XMLConstants.NULL_NS_URI;
}
@Override
public String getPrefix(String namespaceURI) {
return "";
}
@Override
public Iterator<String> getPrefixes(String namespaceURI) {
return Collections.emptyIterator();
}
}
}

View File

@ -1,17 +0,0 @@
package cz.moneta.test.harness.messaging.model;
import java.util.Objects;
public class Topic extends Destination {
private final String topicName;
public Topic(String name, String topicName) {
super(name, "kafka");
this.topicName = Objects.requireNonNull(topicName, "topicName");
}
public String getTopicName() {
return topicName;
}
}

View File

@ -1,193 +0,0 @@
package cz.moneta.test.harness.support.messaging;
import cz.moneta.test.harness.endpoints.messaging.MessagingEndpoint;
import cz.moneta.test.harness.messaging.model.MqMessageFormat;
import cz.moneta.test.harness.messaging.model.ReceivedMessage;
import cz.moneta.test.harness.support.util.FileReader;
import cz.moneta.test.harness.support.util.Template;
import org.junit.jupiter.api.Assertions;
import java.time.Duration;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
public final class MessagingRequest {
private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30);
private final MessagingEndpoint endpoint;
private String destinationName;
private String key;
private String payload;
private Duration timeout = DEFAULT_TIMEOUT;
private final Map<String, String> headers = new LinkedHashMap<>();
private MqMessageFormat formatOverride;
private Predicate<ReceivedMessage> receiveFilter;
private ReceivedMessage receivedMessage;
private boolean receivePending;
private Mode mode = Mode.UNSET;
private MessagingRequest(MessagingEndpoint endpoint) {
this.endpoint = endpoint;
}
public static MessagingRequest builder(MessagingEndpoint endpoint) {
return new MessagingRequest(endpoint);
}
public MessagingRequest to(String destinationName) {
this.destinationName = destinationName;
this.mode = Mode.SEND;
resetReceiveState();
return this;
}
public MessagingRequest from(String destinationName) {
this.destinationName = destinationName;
this.mode = Mode.RECEIVE;
resetReceiveState();
return this;
}
public MessagingRequest withKey(String key) {
this.key = key;
return this;
}
public MessagingRequest withPayload(String payload) {
this.payload = payload;
return this;
}
public MessagingRequest withPayloadFromTemplate(Template template) {
this.payload = template.render();
return this;
}
public MessagingRequest withPayloadFromFile(String path) {
this.payload = FileReader.readFileFromResources(path);
return this;
}
public MessagingRequest withHeader(String key, String value) {
this.headers.put(key, value);
return this;
}
public MessagingRequest withTraceparent(String value) {
return withHeader("traceparent", value);
}
public MessagingRequest withRequestID(String value) {
return withHeader("requestID", value);
}
public MessagingRequest withActivityID(String value) {
return withHeader("activityID", value);
}
public MessagingRequest withSourceCodebookId(String value) {
return withHeader("sourceCodebookId", value);
}
public MessagingRequest asJson() {
this.formatOverride = MqMessageFormat.JSON;
return this;
}
public MessagingRequest asXml() {
this.formatOverride = MqMessageFormat.XML;
return this;
}
public MessagingRequest asEbcdic() {
this.formatOverride = MqMessageFormat.EBCDIC_870;
return this;
}
public MessagingRequest asUtf8() {
this.formatOverride = MqMessageFormat.UTF8_1208;
return this;
}
public MessagingRequest withTimeout(long value, TimeUnit unit) {
this.timeout = Duration.ofMillis(unit.toMillis(value));
if (receivePending && receivedMessage == null) {
doReceive();
}
return this;
}
public MessagingRequest send() {
ensureMode(Mode.SEND);
if (payload == null) {
throw new IllegalStateException("Message payload must be provided before send()");
}
endpoint.send(destinationName, key, payload, formatOverride, headers);
return this;
}
public MessagingRequest receiveWhere(Predicate<ReceivedMessage> filter) {
ensureMode(Mode.RECEIVE);
this.receiveFilter = filter;
this.receivePending = true;
this.receivedMessage = null;
return this;
}
public MessagingRequest andAssertFieldValue(String expression, String expectedValue) {
ReceivedMessage message = getReceivedMessage();
Assertions.assertEquals(expectedValue,
message.extract(expression),
String.format("Unexpected message field value for '%s'. Message body: %s", expression, message.getBody()));
return this;
}
public String extract(String expression) {
return getReceivedMessage().extract(expression);
}
public ReceivedMessage getReceivedMessage() {
ensureMode(Mode.RECEIVE);
if (receivedMessage == null) {
doReceive();
}
return receivedMessage;
}
private void doReceive() {
if (!receivePending) {
receiveFilter = msg -> true;
receivePending = true;
}
receivedMessage = endpoint.receive(
destinationName,
Optional.ofNullable(receiveFilter).orElse(msg -> true),
timeout,
formatOverride
);
receivePending = false;
}
private void ensureMode(Mode requiredMode) {
if (this.mode != requiredMode) {
throw new IllegalStateException("Messaging request is not in " + requiredMode + " mode");
}
}
private void resetReceiveState() {
this.receiveFilter = null;
this.receivedMessage = null;
this.receivePending = false;
}
private enum Mode {
UNSET,
SEND,
RECEIVE
}
}

View File

@ -14,7 +14,7 @@ public class Template {
}
public Template(String templateString) {
this.template = new ST(templateString, '$', '$');
this.template = new ST(templateString);
}
public Template set(String variable, String value) {

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
<fileset name="all" enabled="true" check-config-name="Google Checks" local="false">
<file-match-pattern match-pattern="." include-pattern="true"/>
</fileset>
</fileset-config>

View File

@ -1,301 +1,239 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>cz.moneta.test</groupId>
<artifactId>tests</artifactId>
<version>2.28-SNAPSHOT</version>
<properties>
<harness.version>7.55-SNAPSHOT</harness.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.platform.version>1.5.1</junit.platform.version>
<ibm.mq.version>9.4.5.0</ibm.mq.version>
</properties>
<dependencies>
<dependency>
<groupId>cz.moneta.test</groupId>
<artifactId>harness</artifactId>
<version>${harness.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>com.ibm.mq.allclient</artifactId>
<version>${ibm.mq.version}</version>
</dependency>
<!-- StringTemplate -->
<dependency>
<groupId>org.antlr</groupId>
<artifactId>ST4</artifactId>
<version>4.3.4</version>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>javax.jms-api</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc_auth</artifactId>
<version>8.2.0.x86</version>
<type>dll</type>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>15.0</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-reporting</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-console</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.26</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>Moneta Artifactory</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.9.0</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/lib</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<argLine>
--add-opens
java.base/java.lang.invoke=ALL-UNNAMED
-Dhttp.proxyHost=wsa-aws.mbid.cz
-Dhttp.proxyPort=8008
-Dhttps.proxyHost=wsa-aws.mbid.cz
-Dhttps.proxyPort=8008
-Dhttp.nonProxyHosts="elasticclusterawscoord*|elasticclusterawsingest*|jenkinslivex*|cbltstx|vault|vault.svc.k8s.moneta-containers.net|selenium-hub.svc.k8s.moneta-containers.net|jira*|d000*|x000*|l000*|digdev*|r000|spii-live-significant|mbczvl1dl0ihat3.ux.mbid.cz|mbczvl1dl0ihet3.ux.mbid.cz|wso2-fve-gw.ux.mbid.cz|wso2eifve.lb.mbid.cz|wso2eippe.lb.mbid.cz|wso2-ppe-gw.ux.mbid.cz|mbczvl0bl0enin3.ux.mbid.cz|wso2-tst1-gw.ux.mbid.cz|wso2eitst1.lb.mbid.cz|wso2-edu-gw.ux.mbid.cz|mbczvl0bl0enin5.ux.mbid.cz|mbczvl1dl0enin6.ux.mbid.cz|wso2api01-wso2-02.ux.mbid.cz|api-szr.tst.moneta-containers.net|api-szr.ppe.moneta-containers.net|docker1|mbczvl1dl0mockt.ux.mbid.cz|api.tst.moneta-containers.net|api.ppe.moneta-containers.net"</argLine>
<includes>
<include>
cz.moneta.test.sandbox.demo.HarnessDemoTest.java</include>
</includes>
<trimStackTrace>false</trimStackTrace>
<useFile>false</useFile>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
<id>confluent</id>
<name>Confluent Hub</name>
<url>https://packages.confluent.io/maven/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
<id>mcentral</id>
<name>Maven Central</name>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
<id>mvnrepo</id>
<name>MVN Repository</name>
<url>https://mvnrepository.com/artifact/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>
https://artifactory-aws.ux.mbid.cz/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>
https://artifactory-aws.ux.mbid.cz/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>build.package</id>
<activation>
<property>
<name>build.package</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>
cz.moneta.test.testrunner.TestRunner</mainClass>
</manifest>
</archive>
<descriptors>
<descriptor>src/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>
https://artifactory-aws.ux.mbid.cz/artifactory/libs-release</url>
</repository>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>
https://artifactory-aws.ux.mbid.cz/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>
https://artifactory-aws.ux.mbid.cz/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>
https://artifactory-aws.ux.mbid.cz/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>cz.moneta.test</groupId>
<artifactId>tests</artifactId>
<version>2.29-SNAPSHOT</version>
<properties>
<harness.version>7.55.820</harness.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.platform.version>1.5.1</junit.platform.version>
</properties>
<dependencies>
<dependency>
<groupId>cz.moneta.test</groupId>
<artifactId>harness</artifactId>
<version>${harness.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc_auth</artifactId>
<version>8.2.0.x86</version>
<type>dll</type>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>15.0</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-reporting</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-console</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.26</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>Moneta Artifactory</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<argLine>--add-opens java.base/java.lang.invoke=ALL-UNNAMED -Dhttp.proxyHost=wsa-aws.mbid.cz -Dhttp.proxyPort=8008 -Dhttps.proxyHost=wsa-aws.mbid.cz -Dhttps.proxyPort=8008
-Dhttp.nonProxyHosts="elasticclusterawscoord*|elasticclusterawsingest*|jenkinslivex*|cbltstx|vault|vault.svc.k8s.moneta-containers.net|selenium-hub.svc.k8s.moneta-containers.net|jira*|d000*|x000*|l000*|digdev*|r000|spii-live-significant|mbczvl1dl0ihat3.ux.mbid.cz|mbczvl1dl0ihet3.ux.mbid.cz|wso2-fve-gw.ux.mbid.cz|wso2eifve.lb.mbid.cz|wso2eippe.lb.mbid.cz|wso2-ppe-gw.ux.mbid.cz|mbczvl0bl0enin3.ux.mbid.cz|wso2-tst1-gw.ux.mbid.cz|wso2eitst1.lb.mbid.cz|wso2-edu-gw.ux.mbid.cz|mbczvl0bl0enin5.ux.mbid.cz|mbczvl1dl0enin6.ux.mbid.cz|wso2api01-wso2-02.ux.mbid.cz|api-szr.tst.moneta-containers.net|api-szr.ppe.moneta-containers.net|docker1|mbczvl1dl0mockt.ux.mbid.cz|api.tst.moneta-containers.net|api.ppe.moneta-containers.net"</argLine>
<includes>
<include>cz.moneta.test.sandbox.demo.HarnessDemoTest.java</include>
</includes>
<trimStackTrace>false</trimStackTrace>
<useFile>false</useFile>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>https://artifactory-aws.ux.mbid.cz/artifactory/libs-release</url>
</repository>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://artifactory-aws.ux.mbid.cz/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>https://artifactory-aws.ux.mbid.cz/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>https://artifactory-aws.ux.mbid.cz/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>build.package</id>
<activation>
<property>
<name>build.package</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>cz.moneta.test.testrunner.TestRunner</mainClass>
</manifest>
</archive>
<descriptors>
<descriptor>src/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>https://artifactory-aws.ux.mbid.cz/artifactory/libs-release</url>
</repository>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://artifactory-aws.ux.mbid.cz/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>https://artifactory-aws.ux.mbid.cz/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>https://artifactory-aws.ux.mbid.cz/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</project>

View File

@ -7,7 +7,7 @@ import cz.moneta.test.dsl.auto.smartauto.setman.SmartAutoSetman;
import cz.moneta.test.dsl.broadcom.Broadcom;
import cz.moneta.test.dsl.brokerportal.BrokerPortal;
import cz.moneta.test.dsl.caapi.CaApiBuilder;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.CaGw;
import cz.moneta.test.dsl.cashman.Cashman;
import cz.moneta.test.dsl.cebia.Cebia;
import cz.moneta.test.dsl.demo.Spirits;
@ -25,7 +25,6 @@ import cz.moneta.test.dsl.ib.Ib;
import cz.moneta.test.dsl.ilods.Ilods;
import cz.moneta.test.dsl.kasanova.Kasanova;
import cz.moneta.test.dsl.mobile.smartbanking.home.Sb;
import cz.moneta.test.dsl.messaging.Messaging;
import cz.moneta.test.dsl.monetaapiportal.MonetaApiPortal;
import cz.moneta.test.dsl.monetaportal.MonetaPortal;
import cz.moneta.test.dsl.mwf.IHub;
@ -111,8 +110,8 @@ public class Harness extends BaseStoreAccessor {
return new CaApiBuilder(this);
}
public CaGwBuilder withCaGw() {
return new CaGwBuilder(this);
public CaGw withCaGw() {
return new CaGw(this);
}
@Deprecated
@ -283,10 +282,6 @@ public class Harness extends BaseStoreAccessor {
return new Cashman(this);
}
public Messaging withMessaging() {
return new Messaging(this);
}
private void initGenerators() {
addGenerator(RC, new RcGenerator());
addGenerator(FIRST_NAME, new FirstNameGenerator());

View File

@ -47,7 +47,7 @@ public interface NewCalculationPage extends SmartAutoFlow<NewCalculationPage>, S
String VEHICLE_REGISTRATION_DATE_CHOOSE_BUTTON = "//button//span[contains(text(), 'Vybrat')]";
String VEHICLE_FINANCE_PRODUCT = "(//DIV//p//span[contains(text(), 'Vyberte záznam ...')])[1]";
String VEHICLE_FINANCE_PRODUCT_CHOOSE_BUTTON_DEFAULT = "(//div/h3[contains(text(), '%s')])/..//following-sibling::div//button//span[contains(text(), 'Vybrat')][1]/..";
String VEHICLE_CAR_INSURANCE = "//span[contains(text(),'Povinné ručení')]/following-sibling::div/div[contains(text(),'Vyberte záznam ...')][1]";
String VEHICLE_CAR_INSURANCE = "//h4/following-sibling::div/div[contains(text(),'Vyberte záznam ...')][1]";
String VEHICLE_CAR_ACCIDENT_INSURANCE = "(//DIV//p//span[contains(text(), 'Vyberte záznam ...')])[1]";
String VEHICLE_CAR_BENEFITS = "(//DIV//p//span[contains(text(), 'Vyberte záznam ...')])[1]";
String VEHICLE_CAR_BENEFITS_OPTION_DEFAULT = "(//label//span[contains(text(), '%s')])[1]/..";
@ -75,6 +75,7 @@ public interface NewCalculationPage extends SmartAutoFlow<NewCalculationPage>, S
String VEHICLE_CAR_INSURANCE_VEHICLE_SECOND_FUEL_TYPE_CHOOSE = "//label[contains(.,'Palivo')]/../div/ul/li[contains(.,'%s')]";
String VEHICLE_CAR_INSURANCE_VEHICLE_SEARCH_NO_VIN = "//button[contains(.,'Vyhledat')]";
String VEHICLE_CAR_INSURANCE_VEHICLE_VOLUME_AGRO = "//label[contains(.,'Objem')]/following-sibling::div/div/input";
String VEHICLE_CAR_INSURANCE_VEHICLE_NUMBER_OF_SEATS = "//label[contains(.,'Počet sedadel')]/following-sibling::div/div/input";
String VEHICLE_CAR_INSURANCE_VEHICLE_POWER_AGRO = "//label[contains(.,'Výkon')]/following-sibling::div/div/input";
String VEHICLE_CAR_INSURANCE_VEHICLE_WEIGHT_AGRO = "//label[contains(.,'Hmotnost')]/following-sibling::div/div/input";
String VEHICLE_CAR_INSURANCE_VEHICLE_FUEL_AGRO = "//label[contains(.,'Palivo')]/following-sibling::div/button";
@ -84,7 +85,8 @@ public interface NewCalculationPage extends SmartAutoFlow<NewCalculationPage>, S
String VEHICLE_CAR_INSURANCE_INSURANCE_HAV_FIELD_CHOOSE_DEFAULT = "//h4[contains(.,'Havarijní pojištění')]/../../../../div[2]/div[2]/div/div/section/div/div/div/button";
String VEHICLE_CAR_INSURANCE_INSURANCE_POV_FIELD_DEFAULT = "//h4[contains(.,'Povinné ručení')]/../../../../div[2]/div[1]/div/div[1]/section/h4/button/span[2]";
String VEHICLE_CAR_INSURANCE_INSURANCE_POV_FIELD_CHOOSE_DEFAULT = "//h4[contains(.,'Povinné ručení')]/../../../../div[2]/div[1]/div/div/section/div/div/div/button";
String VEHICLE_CAR_INSURANCE_INSURANCE_CHOOSE = "//section[@data-testid='Tabs']/div[2]/div[3]/div/div[3]/div/div/button[contains(.,'Vybrat')]";
String VEHICLE_CAR_INSURANCE_INSURANCE_CHOOSE = "//section[@data-testid='Collapse']//button[contains(text(),'Vybrat')]";
String VEHICLE_CAR_INSURANCE_INSURANCE_CLOSE = "/html/body/aside[1]/div/div/div[2]/div/div/button[contains(text(),'Zavřít')]";
String CREATE_APPLICATION = "//span[contains(text(), 'Vytvořit žádost')]/parent::button";
String DIV_CLICK_BLOCKER = "//div[@class='_21KP5GbzHYNm19YwGmWy0r']";
String DIV_CLICK_BLOCKER_2 = "//div[@class='_3Lp0XIzdhx1ktbMqO92O8T']";
@ -251,8 +253,8 @@ public interface NewCalculationPage extends SmartAutoFlow<NewCalculationPage>, S
@TypeInto(value = VEHICLE_CAR_INSURANCE_CUSTOMER_NATIONALITY, clear = true)
NewCalculationPage typeVehicleInsuranceCustomerNationality(String nationality);
@Wait(VEHICLE_CAR_INSURANCE_CUSTOMER_NATIONALITY_FIELD)
@Click(value = VEHICLE_CAR_INSURANCE_CUSTOMER_NATIONALITY_FIELD)
@Wait(value = VEHICLE_CAR_INSURANCE_CUSTOMER_NATIONALITY_FIELD)
@Click(value = VEHICLE_CAR_INSURANCE_CUSTOMER_NATIONALITY_FIELD, jsClick = true)
NewCalculationPage clickVehicleInsuranceCustomerNationality();
@Wait(VEHICLE_CAR_INSURANCE_CUSTOMER_ADDRESS)
@ -271,9 +273,12 @@ public interface NewCalculationPage extends SmartAutoFlow<NewCalculationPage>, S
@TypeInto(value = VEHICLE_CAR_INSURANCE_VEHICLE_VOLUME_AGRO)
NewCalculationPage typeVehicleInsuranceVehicleVolume(String volume);
@Wait(VEHICLE_CAR_INSURANCE_VEHICLE_TAB)
@TypeInto(value = VEHICLE_CAR_INSURANCE_VEHICLE_NUMBER_OF_SEATS)
NewCalculationPage typeVehicleInsuranceVehicleNumberOfSeats(String numberOfSeats);
@Wait(VEHICLE_CAR_INSURANCE_VEHICLE_TAB)
@TypeInto(value = VEHICLE_CAR_INSURANCE_VEHICLE_POWER_AGRO)
@TypeInto(value = VEHICLE_CAR_INSURANCE_VEHICLE_POWER_AGRO, andWait = @Wait(explicitWaitSeconds = 2))
NewCalculationPage typeVehicleInsuranceVehiclePower(String power);
@Wait(VEHICLE_CAR_INSURANCE_VEHICLE_TAB)
@ -345,6 +350,10 @@ public interface NewCalculationPage extends SmartAutoFlow<NewCalculationPage>, S
@Click(value = VEHICLE_CAR_INSURANCE_INSURANCE_CHOOSE,jsClick = true)
NewCalculationPage clickVehicleInsuranceInsuranceChoose();
@Wait(value = VEHICLE_CAR_INSURANCE_INSURANCE_CLOSE, waitSecondsForElement = 30)
@Click(value = VEHICLE_CAR_INSURANCE_INSURANCE_CLOSE,jsClick = true)
NewCalculationPage clickVehicleInsuranceInsuranceClose();
@Wait(value = {DIV_CLICK_BLOCKER, DIV_CLICK_BLOCKER_2}, until = Until.GONE, waitSecondsForElement = 30)
@Wait(value = VEHICLE_CAR_ACCIDENT_INSURANCE, waitSecondsForElement = 30)
@Click(value = VEHICLE_CAR_ACCIDENT_INSURANCE, andWait = @Wait(value = CommonElements.MODAL, waitSecondsForElement = 30))

View File

@ -14,7 +14,7 @@ public interface OthersPage extends SmartAutoFlow<OthersPage> {
String ACCOUNT_NUMBER = "//input[@name='sign.bankContactC2C.accountNumber']";
String BANK_CODE = "//span[contains(text(), 'Kód banky')]/../../..//input";
String BUTTON = "//button[contains(text(), '%s')]";
String APPROVAL_MESSAGE = "//span[contains(text(), 'Zpráva pro schvalovatele')]/../../../textarea";
String APPROVAL_MESSAGE = "//h6[contains(text(), 'Zpráva pro schvalovatele')]/../../../div/div/span/textarea";
String VEHICLE_PAGE = "//span[contains(text(), 'Předmět')]";
String DUPLICATE_APPLICATION = "//span[contains(text(), 'Duplikovat')]";
String CALCULATION_NAME = "//input[@name='calculationName']";

View File

@ -13,7 +13,7 @@ import static cz.moneta.test.dsl.auto.smartauto.QueuePage.*;
waitSecondsForElement = 40)
public interface QueuePage extends SmartAutoFlow<QueuePage>, StoreAccessor, CalendarAccessor {
String HEADING_SEND_APPLICATIONS = "//span[contains(text(), 'Odeslané žádosti')]";
String HEADING_SEND_APPLICATIONS = "//h1[contains(text(), 'Odeslané žádosti')]";
String FIRST_APPLICATION = "//div/div/div/button/i";
String DATE_FROM = "//label[contains(., 'Datum od')]/following-sibling::div/button";
String DATE_TO = "//label[contains(., 'Datum do')]/following-sibling::div/button";

View File

@ -6,11 +6,11 @@ import cz.moneta.test.harness.support.web.*;
public interface SavedCalculationsPage extends SmartAutoFlow<SavedCalculationsPage>, StoreAccessor, CalendarAccessor {
String HEADING_SAVED_CALCULATIONS = "//h1/span[contains(text(), 'Kalkulace')]";
String FIRST_APPLICATION_DIV = "//h2/../div[1]/div/";
String CALCULATION_NAME = FIRST_APPLICATION_DIV + "div/div[1]";
String CALCULATION_STATUS = FIRST_APPLICATION_DIV + "/span/span[contains(text(), 'Rozpracovaná žádost')]";
String CALCULATION_DATE = FIRST_APPLICATION_DIV + "div/div[5]";
String HEADING_SAVED_CALCULATIONS = "//h1[contains(text(), 'Kalkulace')]";
String FIRST_APPLICATION_DIV = "/html/body/div[1]/div[1]/div/div/div[1]/div[2]/div[1]/div/div[1]";
String CALCULATION_NAME = FIRST_APPLICATION_DIV + "/div[2]/div[contains(text(), 'TestDuplikace')]";
String CALCULATION_STATUS = FIRST_APPLICATION_DIV + "//span[contains(text(), 'Rozpracovaná žádost')]";
String CALCULATION_DATE = FIRST_APPLICATION_DIV + "/div[3]/div[2]";
String DATE_FROM = "//label[contains(., 'Datum od')]/following-sibling::div/button";
String DATE_TO = "//label[contains(., 'Datum do')]/following-sibling::div/button";
String SEARCH_BUTTON = "//button[@testid='bbutton' and span[text()='Zobrazit']]";

View File

@ -31,7 +31,7 @@ public interface VehiclePage extends SmartAutoFlow<VehiclePage>, StoreAccessor {
String SEATS = "//input[@name='vehicle.specificCar.sittingPlaceNr']";
String FUEL = "(//span[contains(text(), 'Palivo')])[2]/../..//following-sibling::div//input[@value='%s']";
String MILEAGE = "//input[@name='vehicle.specificCar.travel']";
String IMPORT_VEHICLE = "//span[contains(text(), 'Vozidlo z dovozu')]/../../../div/div/span/button/span[contains(text(), '%s')]";
String IMPORT_VEHICLE = "//span[contains(text(), 'Vozidlo z dovozu')]/../../../div/div/div/span/button//span[contains(text(), '%s')]/..";
String DEALER_IS_OWNER = "//span[contains(text(), 'Dealer je majitelem vozidla')]/../../..//span[contains(text(), '%s')]/..";
String DESCRIPTION = "//textarea[@name='vehicle.specificCar.description']";
String OTHERS_PAGE = "//span[contains(text(), 'Ostatní')]";
@ -130,10 +130,10 @@ public interface VehiclePage extends SmartAutoFlow<VehiclePage>, StoreAccessor {
@TypeInto(value = DESCRIPTION, andWait = @Wait(value = LOADER_DIV, until = Until.GONE))
VehiclePage typeDescription(String description);
@Click(IMPORT_VEHICLE)
@Click(value = IMPORT_VEHICLE, jsClick = true)
VehiclePage clickImportVehicle(ImportVehicle importVehicle);
@Click(DEALER_IS_OWNER)
@Click(value = DEALER_IS_OWNER,jsClick = true)
VehiclePage clickDealerIsOwner(DealerIsOwner dealerIsOwner);
@Click(value = OTHERS_PAGE, jsClick = true)

View File

@ -23,8 +23,8 @@ public interface ForBillingPage extends SmartAutoFlow<ForBillingPage> {
String FROM_DATE_TEXT = "//span[contains(text(), 'Od data')]";
String TO_DATE_TEXT = "//span[contains(text(), 'Do data')]";
String COMMISSIONS_CREDIT_NOTES_TEXT = "//span[contains(text(), 'Provize/Dobropis')]";
String FILTER_TITLE = "//span[contains(text(), 'Filtr')]";
String BILLING_COMMISSIONS_TITLE = "//span[contains(text(), 'Provize k fakturaci')]";
String FILTER_TITLE = "//h6[contains(text(), 'Filtr')]";
String BILLING_COMMISSIONS_TITLE = "//h6[contains(text(), 'Fakturace')]";
String RESET_BUTTON = "//span[contains(text(), 'Resetovat')]";
String SEARCH_BUTTON = "//span[contains(text(), 'Vyhledat')]";
String INVOICE_BUTTON = "//span[contains(text(), 'Vyfakturovat')]";

View File

@ -25,7 +25,7 @@ public interface DashboardPage extends SmartAutoFlow<DashboardPage> {
String TOTAL_AVAILABLE_LIMIT_TEXT = "//span[contains(text(), 'Volný limit')]";
String FOR_PAYMENT_TEXT = "//span[contains(text(), 'K úhradě')]";
String OVERDUE_PAYMENT_TEXT = "//span[contains(text(), 'Z toho po splatnosti')]";
String PRODUCT_LIST_TITLE = "//span[contains(text(), 'Seznam produktů')]";
String PRODUCT_LIST_TITLE = "//h6[contains(text(), 'Produkty')]";
String ALL_CONTRACT_BUTTON = "//span[contains(text(), 'Všechny zakázky')]";
@CheckElementsPresent(value = {

View File

@ -25,6 +25,7 @@ public class CalculationData {
private Subsidy subsidy;
private ItemType itemType;
private int firstPayment;
private String numberOfSeats;
public CalculationData setCustomer(Customer customer) {
this.customer = customer;
@ -131,4 +132,8 @@ public class CalculationData {
return this;
}
public CalculationData setNumberOfSeats(String numberOfSeats) {
this.numberOfSeats = numberOfSeats;
return this;
}
}

View File

@ -0,0 +1,33 @@
package cz.moneta.test.dsl.cagw;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.api.ApiBuilder;
import cz.moneta.test.dsl.cagw.auth.AuthBuilder;
import cz.moneta.test.dsl.cagw.oauth2.Oauth2Builder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.RawRestRequest;
public class CaGw extends CaGwBuilder {
public CaGw(Harness harness) {
super(harness);
}
public ApiBuilder api() {
return new ApiBuilder(harness);
}
public Oauth2Builder oauth2() {
return new Oauth2Builder(harness);
}
public AuthBuilder auth() {
return new AuthBuilder(harness);
}
public RawRestRequest.Path prepareRequest() {
CaGwEndpoint endpoint = harness.getEndpoint(CaGwEndpoint.class);
return RawRestRequest.jsonBuilder(endpoint);
}
}

View File

@ -1,34 +1,20 @@
package cz.moneta.test.dsl.cagw;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.api.ApiBuilder;
import cz.moneta.test.dsl.cagw.auth.AuthBuilder;
import cz.moneta.test.dsl.cagw.oauth2.Oauth2Builder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class CaGwBuilder {
private final Harness harness;
protected final Harness harness;
public CaGwBuilder(Harness harness) {
protected CaGwBuilder(Harness harness) {
this.harness = harness;
}
public ApiBuilder api() {
return new ApiBuilder(harness);
}
public Oauth2Builder oauth2() {
return new Oauth2Builder(harness);
}
public AuthBuilder auth() {
return new AuthBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
protected <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}
}

View File

@ -1,19 +1,16 @@
package cz.moneta.test.dsl.cagw.api;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.cbl.CblBuilder;
import cz.moneta.test.dsl.cagw.api.v2.V2Builder;
import cz.moneta.test.dsl.cagw.api.v4.V4Builder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.dsl.cagw.api.v1.V1Builder;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class ApiBuilder {
private final Harness harness;
public class ApiBuilder extends CaGwBuilder {
public ApiBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public CblBuilder cbl() {
@ -32,7 +29,4 @@ public class ApiBuilder {
return new V1Builder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.cbl;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.cbl.psd.PsdBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class CblBuilder {
private final Harness harness;
public class CblBuilder extends CaGwBuilder {
public CblBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public PsdBuilder psd() {
return new PsdBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,17 +1,14 @@
package cz.moneta.test.dsl.cagw.api.cbl.psd;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.AispBuilder;
import cz.moneta.test.dsl.cagw.api.cbl.psd.pisp.PispBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class PsdBuilder {
private final Harness harness;
public class PsdBuilder extends CaGwBuilder {
public PsdBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public PispBuilder pisp() {
@ -22,7 +19,4 @@ public class PsdBuilder {
return new AispBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.cbl.psd.aisp;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.my.MyBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class AispBuilder {
private final Harness harness;
public class AispBuilder extends CaGwBuilder {
public AispBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public MyBuilder my() {
return new MyBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,19 +1,16 @@
package cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.my;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.my.accounts.Account;
import cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.my.accounts.AccountsBuilder;
import cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.my.accounts.AccountsWithParams;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class MyBuilder {
private final Harness harness;
public class MyBuilder extends CaGwBuilder {
public MyBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public AccountsBuilder accounts() {
@ -28,7 +25,4 @@ public class MyBuilder {
return getBuilder(AccountsWithParams.class);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.my.accounts;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.my.accounts.id.IdBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class AccountsBuilder {
private final Harness harness;
public class AccountsBuilder extends CaGwBuilder {
public AccountsBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public IdBuilder id() {
return new IdBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,18 +1,15 @@
package cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.my.accounts.id;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.my.accounts.id.balance.Balance;
import cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.my.accounts.id.transactions.Transactions;
import cz.moneta.test.dsl.cagw.api.cbl.psd.aisp.my.accounts.id.transactions.TransactionsWithParams;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class IdBuilder {
private final Harness harness;
public class IdBuilder extends CaGwBuilder {
public IdBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public Balance prepareBalanceRequest() {
@ -26,8 +23,5 @@ public class IdBuilder {
public TransactionsWithParams prepareTransactionsWithParamsRequest() {
return getBuilder(TransactionsWithParams.class);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.cbl.psd.pisp;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.cbl.psd.pisp.my.MyBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class PispBuilder {
private final Harness harness;
public class PispBuilder extends CaGwBuilder {
public PispBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public MyBuilder my() {
return new MyBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,17 +1,14 @@
package cz.moneta.test.dsl.cagw.api.cbl.psd.pisp.my;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.cbl.psd.pisp.my.payments.Payment;
import cz.moneta.test.dsl.cagw.api.cbl.psd.pisp.my.payments.PaymentsBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class MyBuilder {
private final Harness harness;
public class MyBuilder extends CaGwBuilder {
public MyBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public PaymentsBuilder payments() {
@ -22,7 +19,4 @@ public class MyBuilder {
return getBuilder(Payment.class);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.cbl.psd.pisp.my.payments;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.cbl.psd.pisp.my.payments.paymentid.PaymentIdBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class PaymentsBuilder {
private final Harness harness;
public class PaymentsBuilder extends CaGwBuilder {
public PaymentsBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public PaymentIdBuilder paymentId() {
return new PaymentIdBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.cbl.psd.pisp.my.payments.paymentid;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.cbl.psd.pisp.my.payments.paymentid.status.Status;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class PaymentIdBuilder {
private final Harness harness;
public class PaymentIdBuilder extends CaGwBuilder {
public PaymentIdBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public Status prepareStatusRequest() {
return getBuilder(Status.class);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.v1;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.v1.external.ExternalBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class V1Builder {
private final Harness harness;
public class V1Builder extends CaGwBuilder {
public V1Builder(Harness harness) {
this.harness = harness;
super(harness);
}
public ExternalBuilder external() {
return new ExternalBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,17 +1,14 @@
package cz.moneta.test.dsl.cagw.api.v1.external;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.v1.external.product.ProductBuilder;
import cz.moneta.test.dsl.cagw.api.v1.external.service.ServiceBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class ExternalBuilder {
private final Harness harness;
public class ExternalBuilder extends CaGwBuilder {
public ExternalBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public ProductBuilder product() {
@ -22,7 +19,4 @@ public class ExternalBuilder {
return new ServiceBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.v1.external.product;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.v1.external.product.cloan.CloanBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class ProductBuilder {
private final Harness harness;
public class ProductBuilder extends CaGwBuilder {
public ProductBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public CloanBuilder cbl() {
return new CloanBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.v1.external.product.cloan;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.v1.external.product.cloan.application.ApplicationBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class CloanBuilder {
private final Harness harness;
public class CloanBuilder extends CaGwBuilder {
public CloanBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public ApplicationBuilder application() {
return new ApplicationBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,22 +1,16 @@
package cz.moneta.test.dsl.cagw.api.v1.external.product.cloan.application;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
public class ApplicationBuilder {
private final Harness harness;
public class ApplicationBuilder extends CaGwBuilder {
public ApplicationBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public Application prepareApplicationRequest() {
return getBuilder(Application.class);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.v1.external.service;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.v1.external.service.voicebot.VoicebotBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class ServiceBuilder {
private final Harness harness;
public class ServiceBuilder extends CaGwBuilder {
public ServiceBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public VoicebotBuilder voicebot() {
return new VoicebotBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.v1.external.service.voicebot;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.v1.external.service.voicebot.voicepassworddetail.VoicePasswordDetail;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class VoicebotBuilder {
private final Harness harness;
public class VoicebotBuilder extends CaGwBuilder {
public VoicebotBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public VoicePasswordDetail prepareVoicePasswordDetailApi() {
public VoicePasswordDetail prepareVoicePasswordDetail() {
return getBuilder(VoicePasswordDetail.class);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.v2;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.v2.external.ExternalBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class V2Builder {
private final Harness harness;
public class V2Builder extends CaGwBuilder {
public V2Builder(Harness harness) {
this.harness = harness;
super(harness);
}
public ExternalBuilder external() {
return new ExternalBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.v2.external;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.v2.external.client.ClientBuilder;
public class ExternalBuilder {
private final Harness harness;
public class ExternalBuilder extends CaGwBuilder {
public ExternalBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public ClientBuilder client() {
return new ClientBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.v2.external.client;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.v2.external.client.kyc.KycBuilder;
public class ClientBuilder {
private final Harness harness;
public class ClientBuilder extends CaGwBuilder {
public ClientBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public KycBuilder kyc() {
return new KycBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.v2.external.client.kyc;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.v2.external.client.kyc.businesscard.BusinessCardBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class KycBuilder {
private final Harness harness;
public class KycBuilder extends CaGwBuilder {
public KycBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public BusinessCardBuilder bussinesCard() {
return new BusinessCardBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,22 +1,16 @@
package cz.moneta.test.dsl.cagw.api.v2.external.client.kyc.businesscard;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
public class BusinessCardBuilder {
private final Harness harness;
public class BusinessCardBuilder extends CaGwBuilder {
public BusinessCardBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public BusinessCard prepareBusinessCardRequest() {
return getBuilder(BusinessCard.class);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.api.v4;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.api.v4.token.TokenBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class V4Builder {
private final Harness harness;
public class V4Builder extends CaGwBuilder {
public V4Builder(Harness harness) {
this.harness = harness;
super(harness);
}
public TokenBuilder token() {
return new TokenBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,16 @@
package cz.moneta.test.dsl.cagw.api.v4.token;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
public class TokenBuilder {
private final Harness harness;
public class TokenBuilder extends CaGwBuilder {
public TokenBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public ApiV4Token prepareTokenRequest() {
return getBuilder(ApiV4Token.class);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.auth;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.auth.oauth.OauthBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class AuthBuilder {
private final Harness harness;
public class AuthBuilder extends CaGwBuilder {
public AuthBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public OauthBuilder oauth() {
return new OauthBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.auth.oauth;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.auth.oauth.v2.V2Builder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class OauthBuilder {
private final Harness harness;
public class OauthBuilder extends CaGwBuilder {
public OauthBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public V2Builder v2() {
return new V2Builder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.auth.oauth.v2;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.auth.oauth.v2.token.TokenBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class V2Builder {
private final Harness harness;
public class V2Builder extends CaGwBuilder {
public V2Builder(Harness harness) {
this.harness = harness;
super(harness);
}
public TokenBuilder token() {
return new TokenBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,24 +1,17 @@
package cz.moneta.test.dsl.cagw.auth.oauth.v2.token;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
public class TokenBuilder {
private final Harness harness;
public class TokenBuilder extends CaGwBuilder {
public TokenBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
public OauthToken prepareOauth2V2TokenRequest() {
return getBuilder(OauthToken.class);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,23 +1,17 @@
package cz.moneta.test.dsl.cagw.oauth2;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
import cz.moneta.test.dsl.cagw.oauth2.token.TokenBuilder;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
public class Oauth2Builder {
private final Harness harness;
public class Oauth2Builder extends CaGwBuilder {
public Oauth2Builder(Harness harness) {
this.harness = harness;
super(harness);
}
public TokenBuilder token() {
return new TokenBuilder(harness);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,24 +1,18 @@
package cz.moneta.test.dsl.cagw.oauth2.token;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.endpoints.cagw.CaGwEndpoint;
import cz.moneta.test.harness.support.rest.Builders;
import cz.moneta.test.harness.support.rest.RestRequest;
import cz.moneta.test.dsl.cagw.CaGwBuilder;
public class TokenBuilder {
private final Harness harness;
public class TokenBuilder extends CaGwBuilder {
public TokenBuilder(Harness harness) {
this.harness = harness;
super(harness);
}
@Deprecated
public Oauth2Token prepareOauth2TokenRequest() {
return getBuilder(Oauth2Token.class);
}
private <RESP, B extends RestRequest<B, ?, RESP>> B getBuilder(Class<B> builderClass) {
return Builders.newRestBuilder(builderClass, CaGwEndpoint.class, harness);
}
}

View File

@ -1,5 +1,6 @@
package cz.moneta.test.dsl.exevido.components;
import cz.moneta.test.dsl.exevido.pages.inheritance.FoldersPage;
import cz.moneta.test.dsl.exevido.pages.IncomingMessagesPage;
import cz.moneta.test.dsl.exevido.pages.OutgoingMessagesPage;
import cz.moneta.test.harness.support.web.Click;
@ -9,6 +10,7 @@ import cz.moneta.test.harness.support.web.Wait;
import static cz.moneta.test.dsl.exevido.components.ExevidoPanels.LOADER_DIV;
import static cz.moneta.test.dsl.exevido.components.LeftMenu.PAGE_SA_SMART_MENU;
import static cz.moneta.test.dsl.exevido.pages.inheritance.FoldersPage.PAGE_LABEL_XPATH;
@Wait(PAGE_SA_SMART_MENU)
@Wait(value = LOADER_DIV, until = Until.GONE)
@ -22,6 +24,7 @@ public interface LeftMenu<T> {
String CATEGORY_INHERITANCE_MMB_XPATH = "//li[@id='Dědictví - MMB']";
String SUBCATEGORY_WITHOUT_FOLDER_XPATH = CATEGORY_INHERITANCE_MMB_XPATH + "//a[contains(., 'Bez spisu')]";
String SUBCATEGORY_FOR_PROCESSING_XPATH = CATEGORY_INHERITANCE_MMB_XPATH + "//a[contains(., 'Ke zpracování')]";
String SUBCATEGORY_FOLDERS_XPATH = CATEGORY_INHERITANCE_MMB_XPATH + "//a[contains(., 'Spisy')]";
String FOR_PROCESSING_D_REQUEST_MMB_XPATH = CATEGORY_INHERITANCE_MMB_XPATH + "//a[contains(., 'D - Žádost [M] - MMB')]";
String REFRESH_COUNTERS_BUTTON = "refresh_counters";
@ -37,7 +40,7 @@ public interface LeftMenu<T> {
@Click(SUBCATEGORY_ALL_OUTGOING_MESSAGES_A)
OutgoingMessagesPage clickAllOutgoingMessages();
@Click(value = CATEGORY_INHERITANCE_MMB_XPATH, by = Lookup.XPATH, andWait = @Wait(value = SUBCATEGORY_WITHOUT_FOLDER_XPATH, by = Lookup.XPATH ,until = Until.VISIBLE))
@Click(value = CATEGORY_INHERITANCE_MMB_XPATH, by = Lookup.XPATH, andWait = @Wait(value = SUBCATEGORY_WITHOUT_FOLDER_XPATH, by = Lookup.XPATH, until = Until.VISIBLE))
@Click(value = SUBCATEGORY_WITHOUT_FOLDER_XPATH, by = Lookup.XPATH, andWait = @Wait(value = LOADER_DIV, until = Until.GONE))
IncomingMessagesPage clickInheritanceMmbWithoutFolder();
@ -45,6 +48,10 @@ public interface LeftMenu<T> {
@Click(value = SUBCATEGORY_FOR_PROCESSING_XPATH, by = Lookup.XPATH, andWait = @Wait(value = FOR_PROCESSING_D_REQUEST_MMB_XPATH, by = Lookup.XPATH, until = Until.VISIBLE))
LeftMenu clickInheritanceMmbForProcessing();
@Click(value = CATEGORY_INHERITANCE_MMB_XPATH, by = Lookup.XPATH, andWait = @Wait(value = SUBCATEGORY_FOR_PROCESSING_XPATH, by = Lookup.XPATH, until = Until.VISIBLE))
@Click(value = SUBCATEGORY_FOLDERS_XPATH, by = Lookup.XPATH, andWait = @Wait(value = PAGE_LABEL_XPATH, by = Lookup.XPATH, until = Until.VISIBLE))
FoldersPage clickInheritanceMmbFolders();
@Click(value = FOR_PROCESSING_D_REQUEST_MMB_XPATH, by = Lookup.XPATH, andWait = @Wait(value = LOADER_DIV, until = Until.GONE))
IncomingMessagesPage clickRequestMmb();

View File

@ -36,6 +36,11 @@ public interface DetailIncomingMessagePage extends ExevidoWebFlow<DetailIncoming
String DOWNLOAD_ZFO = "//button[normalize-space()='Stáhnout ZFO']";
String MESSAGE_RETURN_P = "//p[text()='Zpráva byla vrácena na podatelnu k dalšímu zpracování']";
String INTERNAL_REFERENCE_NUMBER = "//accordion-group[.//b[text()='Spisy']]//table//tr/td[2][normalize-space()='%s']";
String ADD_MESSAGE_FOLDER_BUTTON = "add_message_folder_button";
String ADD_FOLDER_ISSUE_NUMBER_INPUT = "add_folder_issue_number";
String SAVE_FOLDER_ISSUE_NUMBER = "//td//i[@title='Přiřadit ke spisu']";
String REMOVE_FOLDER_ISSUE_NUMBER = "//tr[td[2][normalize-space(text())='%s']]//td[4]//i[@title='Odebrat spis']";
String CONFIRM_BUTTON = "confirm_button";
String MESSAGE_ID_SPAN = "message_id";
@Click(ASSIGN_BUTTON)
@ -119,6 +124,25 @@ public interface DetailIncomingMessagePage extends ExevidoWebFlow<DetailIncoming
@CheckElementPresent(value = INTERNAL_REFERENCE_NUMBER, by = Lookup.XPATH, isStringDynamicXpath = true)
DetailIncomingMessagePage checkInternalReferenceNumber(String referenceNumber);
@CustomAction
default DetailIncomingMessagePage clickAddMessageFolder() {
ExevidoEndpoint endpoint = getEndpoint(ExevidoEndpoint.class);
endpoint.moveToElement(ADD_MESSAGE_FOLDER_BUTTON);
endpoint.click(() -> ADD_MESSAGE_FOLDER_BUTTON);
return null;
}
@TypeInto(value = ADD_FOLDER_ISSUE_NUMBER_INPUT, clear = true, andWait = @Wait(value = ExevidoPanels.LOADER_DIV, until = Until.GONE))
@KeyPress(Key.ENTER)
DetailIncomingMessagePage fillFolderIssueNumber(String folderIssueNumber);
@Click(value = SAVE_FOLDER_ISSUE_NUMBER, by = Lookup.XPATH, andWait = @Wait(value = ExevidoPanels.LOADER_DIV, until = Until.GONE))
DetailIncomingMessagePage saveFolderIssueNumber();
@Click(value = REMOVE_FOLDER_ISSUE_NUMBER, by = Lookup.XPATH, isStringDynamicXpath = true)
@Click(CONFIRM_BUTTON)
DetailIncomingMessagePage removeFolderIssueNumber(String folderIssueNumber);
@CheckElementContent(value = MESSAGE_ID_SPAN)
NewIncomingMessagePage checkMessageId(String id);
}

View File

@ -49,6 +49,15 @@ public interface IncomingMessagesPage extends ExevidoWebFlow<IncomingMessagesPag
return null;
}
@CustomAction
default IncomingMessagesPage verifyIncomingMessageRowNotPresent() {
ExevidoEndpoint endpoint = getEndpoint(ExevidoEndpoint.class);
if (endpoint.isElementPresent(INCOMING_MESSAGE_ROW, Lookup.ID)) {
throw new AssertionError("Incoming message row should NOT be present.");
}
return null;
}
@TypeInto(value = DATE_RANGE_ACCEPTANCE_TIME, clear = true)
@KeyPress(value = Key.ENTER, andWait = @Wait(value = ExevidoPanels.LOADER_DIV, until = Until.GONE))
IncomingMessagesPage searchByDateRange(String date);

View File

@ -42,8 +42,8 @@ public interface NewOutgoingMessagePage extends ExevidoWebFlow<NewOutgoingMessag
String MESSAGE_IS_SENDING_DIV = "message_identification";
String MESSAGE_SUCCESSFULLY_SEND_LOG_XPATH = "//span[contains(text(), 'byla odeslána')]";
String MESSAGE_SEND_FAILURE_LOG_XPATH = "//span[contains(text(), 'selhání odeslání zprávy')]";
String ATTACHMENT_PATH = "regression/exevido/testExevido.txt";
String SECOND_ATTACHMENT_PATH = "regression/exevido/testExevido2.txt";
String ATTACHMENT_PATH = "regression/exevido/web/testExevido.txt";
String SECOND_ATTACHMENT_PATH = "regression/exevido/web/testExevido2.txt";
String MESSAGE_ID_SPAN = "message_id";
String MULTIPLE_RECIPIENTS_SPAN = "//label[@for='multiple_recipients']";
String ADD_RECIPIENT_TO_LIST_BUTTON = "add_to_list_button";

View File

@ -0,0 +1,25 @@
package cz.moneta.test.dsl.exevido.pages.inheritance;
import cz.moneta.test.dsl.exevido.ExevidoWebFlow;
import cz.moneta.test.dsl.exevido.pages.DetailIncomingMessagePage;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.exevido.ExevidoEndpoint;
import cz.moneta.test.harness.support.web.*;
import static cz.moneta.test.dsl.exevido.pages.inheritance.DetailFolderPage.PAGE_LABEL_XPATH;
@Wait(value = PAGE_LABEL_XPATH, by = Lookup.XPATH)
public interface DetailFolderPage extends ExevidoWebFlow<DetailFolderPage>, StoreAccessor {
String PAGE_LABEL_XPATH = "//b[contains(text(),'Spis:')]";
String OUTGOING_MESSAGES_LABEL_XPATH = "//a[contains(text(),'Odchozí zprávy')]";
String ROW_BY_MESSAGE_ID = "//tr[contains(@class,'clickable-row')]//td[2]/div[normalize-space()='%s']/ancestor::tr";
@CustomAction
default DetailIncomingMessagePage openMessageById(String messageId) {
ExevidoEndpoint endpoint = getEndpoint(ExevidoEndpoint.class);
endpoint.moveToElement(OUTGOING_MESSAGES_LABEL_XPATH, Lookup.XPATH);
endpoint.click(() -> String.format(ROW_BY_MESSAGE_ID, messageId), Lookup.XPATH);
return null;
}
}

View File

@ -0,0 +1,26 @@
package cz.moneta.test.dsl.exevido.pages.inheritance;
import cz.moneta.test.dsl.exevido.ExevidoWebFlow;
import cz.moneta.test.dsl.exevido.components.ExevidoPanels;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.exevido.ExevidoEndpoint;
import cz.moneta.test.harness.support.web.*;
import static cz.moneta.test.dsl.exevido.pages.inheritance.FoldersPage.PAGE_LABEL_XPATH;
@Wait(value = PAGE_LABEL_XPATH, by = Lookup.XPATH)
public interface FoldersPage extends ExevidoWebFlow<FoldersPage>, StoreAccessor {
String PAGE_LABEL_XPATH = "//b[contains(text(),'Spisy')]";
String PRODUCT_OWNER_NAME_INPUT = "text_product_owner_name";
String FOLDER_MESSAGE_ROW = "folder_0_row";
@TypeInto(value = PRODUCT_OWNER_NAME_INPUT)
@KeyPress(value = Key.ENTER, andWait = @Wait(value = ExevidoPanels.LOADER_DIV, until = Until.GONE))
FoldersPage fillProductOwnerName(String name);
@Click(value = FOLDER_MESSAGE_ROW, andWait = @Wait(value = ExevidoPanels.LOADER_DIV, until = Until.GONE))
DetailFolderPage clickFolderRow();
}

View File

@ -97,7 +97,7 @@ public class HyposContractPrepare {
.realtyPriceCurrent(3500000)
.realtyType(RealtyType.FLAT.getValue())
.pledgeType(PledgeType.PROPERTY_HOUSING.getValue())
.contractRelation(ContranctRelation.PLEDGE_WITH_CURRENT_REALTY.getValue())
.contractRelation(ContractRelation.PLEDGE_WITH_CURRENT_REALTY.getValue())
.collateralType(CollateralType.FLAT.getValue())
.appraiserCompany(AppraiserCompany.MONETA_SUPERVISION.getValue())
.build();

View File

@ -13,4 +13,4 @@ public enum AppraiserCompany {
public String getValue() {
return appraiserCompany;
}
}
}

View File

@ -1,6 +1,8 @@
package cz.moneta.test.dsl.hypos.enums;
public enum CadasterRequestType {
import cz.moneta.test.harness.support.web.SelectByValue;
public enum CadasterRequestType implements SelectByValue {
PART_OWNER_LIST("Část. výpis LV"),
CADASTER_MAP("Kat. mapa"),
OWNER_LIST("List vlastnictví"),
@ -12,6 +14,7 @@ public enum CadasterRequestType {
this.cadasterRequestType = cadasterRequestType;
}
@Override
public String getValue() {
return cadasterRequestType;
}

View File

@ -12,4 +12,4 @@ public enum CollateralCode {
public String getValue() {
return collateralCode;
}
}
}

View File

@ -1,6 +1,8 @@
package cz.moneta.test.dsl.hypos.enums;
public enum CollectableFee {
import cz.moneta.test.harness.support.web.SelectByValue;
public enum CollectableFee implements SelectByValue {
APPENDIX_CLIENT_INITIATIVE("DODATEK - Z PODNĚTU KLIENTA"),
FEE_DOWNLOAD_LV_KM("Poplatek za stažení LV/KM"),
OTHER_BANK_INFORMATION("OSTATNÍ - BANKOVNÍ INFORMACE");
@ -11,6 +13,7 @@ public enum CollectableFee {
this.collectableFee = collectableFee;
}
@Override
public String getValue() {
return collectableFee;
}

View File

@ -1,6 +1,6 @@
package cz.moneta.test.dsl.hypos.enums;
public enum ContranctRelation {
public enum ContractRelation {
PLEDGE_WITH_OTHER_REALTY("Zajištění jinou nemovitostí"),
PLEDGE_WITH_CURRENT_REALTY("Zajištění = objekt úvěru"),
PLEDGE_ADDIONAL("Dozajištění"),
@ -8,11 +8,11 @@ public enum ContranctRelation {
private final String contractRelation;
ContranctRelation(String contractRelation) {
ContractRelation(String contractRelation) {
this.contractRelation = contractRelation;
}
public String getValue() {
return contractRelation;
}
}
}

View File

@ -12,4 +12,4 @@ public enum IncomeCurrency {
public String getValue() {
return currency;
}
}
}

View File

@ -18,4 +18,4 @@ public enum LivingType {
public String getValue() {
return livingType;
}
}
}

View File

@ -16,4 +16,4 @@ public enum LoanObjectType {
public String getValue() {
return loanObject;
}
}
}

View File

@ -1,6 +1,5 @@
package cz.moneta.test.dsl.hypos.enums;
public enum PaymentType {
WITHOUT_PURPOSE("1"),
GROUP_PURPOSE_BUY("2"),

View File

@ -13,4 +13,4 @@ public enum PurchaseReason {
public String getValue() {
return purchaseReason;
}
}
}

View File

@ -16,4 +16,4 @@ public enum StayType {
public String getValue() {
return accomodationType;
}
}
}

View File

@ -1,5 +1,6 @@
package cz.moneta.test.dsl.hypos.pages.cadaster;
import cz.moneta.test.dsl.hypos.enums.CadasterRequestType;
import cz.moneta.test.dsl.hypos.pages.HyposPageFlow;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.hypos.HyposEndpoint;
@ -18,7 +19,7 @@ public interface CadasterRequestPage extends HyposPageFlow<CadasterRequestPage>,
CadasterRequestPage clickSearchButton();
@Select(FILTER_TYPE_SELECT)
CadasterRequestPage selectFilterType(String type);
CadasterRequestPage selectFilterType(CadasterRequestType type);
@Select(FILTER_STATUS_SELECT)
CadasterRequestPage selectFilterStatus(String status);

View File

@ -85,8 +85,9 @@ public interface ScoringPage extends HyposPageFlow<ScoringPage>, Menu, StoreAcce
ScoringPage clickApproveContractButton();
@Waits({
@Wait(value = LOADER, waitSecondsForElement = 60, until = Until.GONE),
@Wait(value = NAS_ONGOING_CHECKS_DIV, waitSecondsForElement = 60, until = Until.GONE),
@Wait(value = CONFIRM_APPROVAL_BUTTON, waitSecondsForElement = 60, until = Until.CLICKABLE)
@Wait(value = LOADER, waitSecondsForElement = 30, until = Until.GONE)
})
@Click(CONFIRM_APPROVAL_BUTTON)
@AcceptAlert(waitSecondsForAlert = 30)

View File

@ -57,6 +57,7 @@ public interface ApprovalChecklistPage extends HyposPageFlow<ApprovalChecklistPa
for (int i = 1; i <= docs.size(); i++) {
String doc = String.format(DOCS_IN_CATEGORY_UPLOAD_BUTTON, checklistTab.getValue(), clientOrder, category.getValue(), i);
endpoint.click(() -> doc);
endpoint.waitForElementsToLoad(20, Until.GONE, LOADER);
ChecklistImportDocModalPage checklistImportDocModalPage = Builders.newWebFlowBuilder(ChecklistImportDocModalPage.class, endpoint, harness);
if (endpoint.isElementVisible(1, VALIDITY_DATE_INPUT, Lookup.XPATH)) {
checklistImportDocModalPage.fillValidityDate(LocalDate.now().plusYears(category == IDENTITY_GENERAL ? 5 : 0).format(DateTimeFormatter.ofPattern(defaultDateFormat)))

View File

@ -20,7 +20,7 @@ public interface ChecklistImportDocModalPage extends HyposPageFlow<ChecklistImpo
@TypeInto(value = VALIDITY_DATE_INPUT, clear = true)
ChecklistImportDocModalPage fillValidityDate(String validityDate);
@KeyPress(value = Key.TAB, andWait = @Wait(value = SAVE_BUTTON, until = Until.CLICKABLE))
@KeyPress(value = Key.TAB, andWait = @Wait(value = LOADER, until = Until.GONE))
ChecklistImportDocModalPage checkValidityDate();
@Click(SAVE_BUTTON)

View File

@ -15,6 +15,7 @@ public interface DocumentGeneratePage extends HyposPageFlow<DocumentGeneratePage
String DOCUMENTS_MAKER_INPUT = "//input[@id='docsMaker']";
String AUTO_VERIFY_CHECKBOX = "//input[@id='auto-verify']";
String SIGN_LOCATION_PRAGUE_RADIO = "//input[@value='Praze']";
String BOTTOM_LOADER = "//div[@class='loading-overlay']";
String GENERATE_BUTTON = "//button[@id='butt-gen']";
@ -30,6 +31,7 @@ public interface DocumentGeneratePage extends HyposPageFlow<DocumentGeneratePage
@CustomAction
default DocumentsPage clickGenerateButton() {
HyposEndpoint endpoint = getEndpoint(HyposEndpoint.class);
endpoint.waitForElementsToLoad(20, Until.GONE, BOTTOM_LOADER);
endpoint.waitForElementsToLoad(20, Until.CLICKABLE, GENERATE_BUTTON);
endpoint.click(() -> GENERATE_BUTTON);
try {

View File

@ -1,6 +1,7 @@
package cz.moneta.test.dsl.hypos.pages.contract.fees;
import cz.moneta.test.dsl.hypos.components.Menu;
import cz.moneta.test.dsl.hypos.enums.CollectableFee;
import cz.moneta.test.dsl.hypos.pages.HyposPageFlow;
import cz.moneta.test.harness.support.web.*;
@ -15,7 +16,7 @@ public interface FeesPage extends HyposPageFlow<FeesPage>, Menu {
String COLLECTED_FEE_TEXT = "//h3[contains(text(),'Byl zinkasován poplatek')]";
@Select(COLLECTABLE_FEE_SELECT)
FeesPage selectCollectableFee(String fee);
FeesPage selectCollectableFee(CollectableFee fee);
@Click(value = CASH_BUTTON, andWait = @Wait(value = COLLECTED_FEE_TEXT, until = Until.VISIBLE))
FeesPage clickCash();

View File

@ -1,5 +1,6 @@
package cz.moneta.test.dsl.hypos.pages.contract.loan;
import cz.moneta.test.dsl.hypos.components.Menu;
import cz.moneta.test.dsl.hypos.pages.HyposPageFlow;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.Wait;
@ -8,7 +9,7 @@ import static cz.moneta.test.dsl.hypos.pages.contract.loan.ClientCurrentAcountPa
import static cz.moneta.test.dsl.hypos.pages.contract.loan.ClientCurrentAcountPage.SAVE_BUTTON;
@Wait({PAGE_TITLE, SAVE_BUTTON})
public interface ClientCurrentAcountPage extends HyposPageFlow<ClientCurrentAcountPage> {
public interface ClientCurrentAcountPage extends HyposPageFlow<ClientCurrentAcountPage>, Menu {
String PAGE_TITLE = "//h1[text()='Účet pro splácení']";
String CURRENT_ACCOUNTS_FORM = "//form[@id='form-bezneucty']";
String SELECT_CURRENT_ACCOUNT_RADIO = CURRENT_ACCOUNTS_FORM + "//input[@value='%s']";

View File

@ -256,23 +256,19 @@ public interface OrderValuationPage extends HyposPageFlow<OrderValuationPage>, M
@Click(A_BACKTOREALTYDETAIL)
OrderValuationPage clickBackToRealtyDetail();
@Select(SELECT_ORDERER_TYPE)
@Select(value = SELECT_ORDERER_TYPE, andWait = @Wait(value = LOADER, until = Until.GONE))
OrderValuationPage selectOrdererType(String ordereType);
@TypeInto(SELECT_FINALTYPE)
@KeyPress(Key.ENTER)
@Select(value = SELECT_FINALTYPE, andWait = @Wait(value = LOADER, until = Until.GONE))
OrderValuationPage selectFinalType(String finalType);
@TypeInto(SELECT_REALTYUNITTYPE)
@KeyPress(Key.ENTER)
@Select(SELECT_REALTYUNITTYPE)
OrderValuationPage selectRealtyFlatType(String realtyType);
@TypeInto(SELECT_REALTYBUILDINGTYPE)
@KeyPress(Key.ENTER)
@Select(SELECT_REALTYBUILDINGTYPE)
OrderValuationPage selectRealtyHouseType(String realtyType);
@TypeInto(SELECT_PURPOSE)
@KeyPress(Key.ENTER)
@Select(value = SELECT_PURPOSE, andWait = @Wait(value = LOADER, until = Until.GONE))
OrderValuationPage selectPurpose(String purpose);
@TypeInto(INPUT_ADDRESSSTREET)
@ -297,15 +293,9 @@ public interface OrderValuationPage extends HyposPageFlow<OrderValuationPage>, M
@TypeInto(INPUT_SHARE)
OrderValuationPage insertShare(int share);
@Click(COMBOBOX_DOCUMENTSAVAILABLE_YES)
@Click(value = COMBOBOX_DOCUMENTSAVAILABLE_YES, andWait = @Wait(value = LOADER, until = Until.GONE))
OrderValuationPage clickDocumentsAvailable();
@Wait(value = SELECT_DISPOSITION, until = Until.CLICKABLE)
OrderValuationPage waitFlatDispositionClickable();
@Wait(value = SELECT_CONSTRUCTIONMATERIAL_HOUSE, until = Until.CLICKABLE)
OrderValuationPage waitHouseMaterialClickable();
@Click(COMBOBOX_DOCUMENTSAVAILABLE_NO)
OrderValuationPage clickDocumentsNotAvailable();
@ -333,7 +323,7 @@ public interface OrderValuationPage extends HyposPageFlow<OrderValuationPage>, M
@Click(COMBOBOX_PROPERTYRENTED_YES_FLAT)
OrderValuationPage clickPropertyRentedFlat();
@Click(COMBOBOX_PROPERTYRENTED_NO_FLAT)
@Click(value = COMBOBOX_PROPERTYRENTED_NO_FLAT, andWait = @Wait(value = LOADER, until = Until.GONE))
OrderValuationPage clickPropertyNotRentedFlat();
@TypeInto(INPUT_OUTSIDEPARKING)
@ -388,7 +378,7 @@ public interface OrderValuationPage extends HyposPageFlow<OrderValuationPage>, M
@Click(COMBOBOX_PROPERTYRENTED_YES_HOUSE)
OrderValuationPage clickPropertyRentedHouse();
@Click(COMBOBOX_PROPERTYRENTED_NO_HOUSE)
@Click(value = COMBOBOX_PROPERTYRENTED_NO_HOUSE, andWait = @Wait(value = LOADER, until = Until.GONE))
OrderValuationPage clickPropertyNotRentedHouse();
@TypeInto(INPUT_FLOOREAREA_HOUSE)

View File

@ -32,7 +32,7 @@ public interface SearchRealtyPage extends HyposPageFlow<SearchRealtyPage> {
@Select(value = REALTY_TYPE_SELECT, andWait = @Wait(value = LAND_AREA_NAME_INPUT, until = Until.VISIBLE))
SearchRealtyPage selectRealtyType(String realtyType);
@TypeInto(value = LAND_AREA_NAME_INPUT, clear = true)
@TypeInto(value = LAND_AREA_NAME_INPUT, clear = true, andWait = @Wait(value = LAND_AREA_AUTOSUGGEST_LINK, until = Until.VISIBLE, isStringDynamicXpath = true))
SearchRealtyPage fillAreaName(String area);
@TypeInto(value = LAND_AREA_CODE_INPUT, clear = true)
@ -65,4 +65,4 @@ public interface SearchRealtyPage extends HyposPageFlow<SearchRealtyPage> {
@Click(CREATE_NEW_UNIT_SEARCH_LINK)
CreateNewUnitPage clickCreateNewSearchUnit();
}
}

View File

@ -12,12 +12,12 @@ import static cz.moneta.test.dsl.hypos.pages.contract.realty.ValuationDetailPage
@Wait(value = H1_ORDERVALUATION, waitSecondsForElement = 180)
public interface ValuationDetailPage extends HyposPageFlow<ValuationDetailPage>, Menu {
String autoComment = "Automation Test";
String H1_ORDERVALUATION = "//h1[text()='Objednávka ocenění']";
String H2_RISKS = "//h2[text()='Rizika a stanovení podmínek']";
String H2_FINAL = "//h2[text()='Finální ocenění']";
String H3_COMPARATIVE_METHOD = "//h3[text()='Porovnávací metoda']";
String H3_VALUATIONCOMPLETED = "//h3[text()='Ocenění bylo uloženo']";
String H2_REALTYDESCRIPTION = "//h2[text()='Popis nemovitosti']";
@ -31,15 +31,16 @@ public interface ValuationDetailPage extends HyposPageFlow<ValuationDetailPage>,
String TD_LASTOPERATION_COMMENT = "//table[@id='appr-order-events']/tbody/tr[1]/td[3]";
String TD_VALUATIONTYPE = "//th[text()='Způsob zpracování - výchozí']/following-sibling::td[1]";
String INPUT_GIVEORDER = "//input[@value='Předat objednávku']";
String INPUT_DEFERORDER = "//input[@value='Odložit objednávku']";
String INPUT_DELAYUNTIL = "//input[@name='delayUntil']";
String INPUT_GIVE_ORDER = "//input[@value='Předat objednávku']";
String INPUT_DEFER_ORDER = "//input[@value='Odložit objednávku']";
String INPUT_DELAY_UNTIL = "//input[@name='delayUntil']";
String INPUT_CANCEL = "//input[@value='Zrušit objednávku']";
String INPUT_CURRENTPRICE = "//input[@name='final_valuation[results][data][current_price]']";
String INPUT_JKSOPRICE = "//input[@id='results-auto-reproduction-price-flat']";
String INPUT_REPRODUCTIVEPRICE = "//input[@id='results-reproduction-price-flat']";
String INPUT_FLATAREA = "//input[@id='flat-floor-area']";
String INPUT_FLATAREOTHER = "//input[@id='flat-floor-area-other']";
String INPUT_CURRENT_PRICE = "//input[@name='final_valuation[results][data][current_price]']";
String INPUT_JKSO_PRICE = "//input[@id='results-auto-reproduction-price-flat']";
String INPUT_REPRODUCTIVE_PRICE = "//input[@id='results-reproduction-price-flat']";
String INPUT_FLAT_AREA = "//input[@id='flat-floor-area']";
String INPUT_FLAT_AREA_OTHER = "//input[@id='flat-floor-area-other']";
String INPUT_LOCAL_INVESTIGATION_DATE = "//input[@id='results-local-investigation-date']";
String SELECT_FLAT_HEATING = "//select[@id='flat-heating']";
String SELECT_FLAT_HEATING_MEDIUM = "//select[@name='realty[flat][unit_heating_medium_tp]']";
@ -65,7 +66,6 @@ public interface ValuationDetailPage extends HyposPageFlow<ValuationDetailPage>,
String INPUT_HOUSE_SURROUND_SPACE = "//input[@id='house-building-surround-space']";
String INPUT_HOUSE_FLOOR_AREA = "//input[@id='house-building-residential-floor-area']";
String TEXTAREA_FORWARDCOMMENT = "//textarea[@id='forward-comment']";
String TEXTAREA_DELAYCOMMNET = "//textarea[@id='delay-comment']";
String TEXTAREA_CANCELCOMMNET = "//textarea[@id='cancel-comment']";
@ -83,10 +83,10 @@ public interface ValuationDetailPage extends HyposPageFlow<ValuationDetailPage>,
@Wait(value = H3_VALUATIONCOMPLETED, waitSecondsForElement = 60)
ValuationDetailPage waitForValuationCompleted();
@TypeInto(value = INPUT_REPRODUCTIVEPRICE, clear = true)
@TypeInto(value = INPUT_REPRODUCTIVE_PRICE, clear = true)
ValuationDetailPage insertReproductivePrice(int price);
@TypeInto(value = INPUT_CURRENTPRICE, clear = true)
@TypeInto(value = INPUT_CURRENT_PRICE, clear = true)
ValuationDetailPage insertCurrentPrice(int price);
@Click(A_PROCESSORDER)
@ -98,6 +98,9 @@ public interface ValuationDetailPage extends HyposPageFlow<ValuationDetailPage>,
@Click(H2_FINAL)
ValuationDetailPage clickFinalSection();
@Click(H3_COMPARATIVE_METHOD)
ValuationDetailPage clickComparativeMethod();
@Wait(H2_REALTYDESCRIPTION)
@Click(H2_REALTYDESCRIPTION)
ValuationDetailPage clickRealtyDescription();
@ -111,13 +114,13 @@ public interface ValuationDetailPage extends HyposPageFlow<ValuationDetailPage>,
@Click(A_DEFER)
ValuationDetailPage clickDeferOrder();
@TypeInto(INPUT_DELAYUNTIL)
@TypeInto(INPUT_DELAY_UNTIL)
ValuationDetailPage insertDelayUntil(String delay);
@TypeInto(TEXTAREA_DELAYCOMMNET)
ValuationDetailPage insertDelayComment(String comment);
@Click(INPUT_DEFERORDER)
@Click(INPUT_DEFER_ORDER)
ValuationDetailPage clickDeferOrderInput();
@AcceptAlert(waitSecondsForAlert = 10)
@ -138,7 +141,7 @@ public interface ValuationDetailPage extends HyposPageFlow<ValuationDetailPage>,
@TypeInto(TEXTAREA_FORWARDCOMMENT)
ValuationDetailPage insertForwardComment(String comment);
@Click(INPUT_GIVEORDER)
@Click(INPUT_GIVE_ORDER)
ValuationDetailPage clickGiveOrderInput();
@Click(A_TAKE)
@ -225,9 +228,12 @@ public interface ValuationDetailPage extends HyposPageFlow<ValuationDetailPage>,
@TypeInto(value = INPUT_HOUSE_SURROUND_SPACE, clear = true)
ValuationDetailPage insertSurroundSpace(String area);
@TypeInto(value = INPUT_HOUSE_FLOOR_AREA,clear = true)
@TypeInto(value = INPUT_HOUSE_FLOOR_AREA, clear = true)
ValuationDetailPage insertFloorArea(String area);
@TypeInto(INPUT_LOCAL_INVESTIGATION_DATE)
ValuationDetailPage insertLocalInvestigationDate(String investigationDate);
/**
* Verify if last operation has correct comment in history of order.
*
@ -300,8 +306,8 @@ public interface ValuationDetailPage extends HyposPageFlow<ValuationDetailPage>,
default ValuationDetailPage doCalculationAndVerify() {
HyposEndpoint endpoint = getEndpoint(HyposEndpoint.class);
double flatArea = Double.parseDouble(endpoint.getAttribute(INPUT_FLATAREA, "value").replace(",","."));
double flatAreaOther = Double.parseDouble(endpoint.getAttribute(INPUT_FLATAREOTHER, "value").replace(",","."));
double flatArea = Double.parseDouble(endpoint.getAttribute(INPUT_FLAT_AREA, "value").replace(",","."));
double flatAreaOther = Double.parseDouble(endpoint.getAttribute(INPUT_FLAT_AREA_OTHER, "value").replace(",","."));
double countedArea;
if ((flatAreaOther / 2 )> 0.2 * flatArea){
@ -310,9 +316,9 @@ public interface ValuationDetailPage extends HyposPageFlow<ValuationDetailPage>,
countedArea = flatArea + (flatAreaOther / 2);
}
double JKSOhodnota = Double.parseDouble(endpoint.getAttribute(INPUT_JKSOPRICE,"value").replace(",","."));
double JKSOhodnota = Double.parseDouble(endpoint.getAttribute(INPUT_JKSO_PRICE,"value").replace(",","."));
double expectedValue = Math.floor((countedArea * JKSOhodnota)/ 10000) * 10000;
double reproductivePrice = Double.parseDouble(endpoint.getAttribute(INPUT_REPRODUCTIVEPRICE, "value").replace(",","."));
double reproductivePrice = Double.parseDouble(endpoint.getAttribute(INPUT_REPRODUCTIVE_PRICE, "value").replace(",","."));
String message = String.format("Expected reporductive price value %s is not equal actual price %s.", expectedValue, reproductivePrice);
Assertions.assertEquals(expectedValue, reproductivePrice, message);

View File

@ -35,7 +35,7 @@ public interface HypokalkulackaPage extends HyposPageFlow<HypokalkulackaPage>, M
String GENERATE_AGREEMENTS101_BUTTON = DOCUMENTS_DIV + "//span[@id='generate-link-186']/a";
String GENERATE_AGREEMENTS101_LOADER_IMG = DOCUMENTS_DIV + "//span[@id='generate-link-186']/img[@src='/img/common/loadingAnimationSmall.gif']";
String SIGN_AGREEMENTS101_BUTTON = DOCUMENTS_DIV + "//span[@id='sign-link-186']/a";
String GENERATE_APPLICATION_BUTTON = DOCUMENTS_DIV + "//span[@id='generate-link-333']/a";
String GENERATE_APPLICATION_BUTTON = DOCUMENTS_DIV + "//span[@id='generate-link-333']/a[not(contains(@class,'generate-disabled'))]";
String GENERATE_APPLICATION_LOADER_IMG = DOCUMENTS_DIV + "//span[@id='generate-link-333']/img[@src='/img/common/loadingAnimationSmall.gif']";
String SIGN_APPLICATION_BUTTON = DOCUMENTS_DIV + "//span[@id='sign-link-333']/a";
@ -79,8 +79,14 @@ public interface HypokalkulackaPage extends HyposPageFlow<HypokalkulackaPage>, M
@Click(value = CALCULATE_BUTTON, andWait = @Wait(value = HYPOKALKULACKA_CALCULATE_LOADER, until = Until.GONE))
HypokalkulackaPage clickCalculateButton();
@TypeInto(FIRST_EXPECTED_DRAW_DATE_INPUT)
HypokalkulackaPage fillFirstExpectedDrawDate(String drawDate);
@CustomAction
default HypokalkulackaPage fillFirstExpectedDrawDate(String drawDate) {
HyposEndpoint endpoint = getEndpoint(HyposEndpoint.class);
endpoint.type(() -> FIRST_EXPECTED_DRAW_DATE_INPUT, drawDate, true);
endpoint.sendKeysOneAtATime(Key.TAB);
endpoint.waitForElementsToLoad(20, Until.GONE, HYPOKALKULACKA_CALCULATE_LOADER);
return null;
}
@Wait(value = GENERATE_AGREEMENTS101_BUTTON, waitSecondsForElement = 60, until = Until.VISIBLE)
@Click(value = GENERATE_AGREEMENTS101_BUTTON, andWait = @Wait(value = GENERATE_AGREEMENTS101_LOADER_IMG, waitSecondsForElement = 60, until = Until.GONE))

View File

@ -24,7 +24,7 @@ public interface HypokalkulackaRealtyPage extends HyposPageFlow<HypokalkulackaRe
HypokalkulackaRealtyPage fillRealtyPrice(int price);
@Select(REALTY_CONTRACT_SELECT)
HypokalkulackaRealtyPage selectContractRealtion(String contranctRelation);
HypokalkulackaRealtyPage selectContractRealtion(String contractRelation);
@Click(SAVE_REALTY_BUTTON_XPATH)
HypokalkulackaPage clickSaveRealtyButton();

View File

@ -7,7 +7,6 @@ import cz.moneta.test.harness.support.web.Wait;
import static cz.moneta.test.dsl.hypos.pages.tasklist.TaskDetailPage.PAGE_TITLE;
@Wait(PAGE_TITLE)
public interface TaskDetailPage extends HyposPageFlow<TaskDetailPage>, StoreAccessor {
String PAGE_TITLE = "//h1[text()='Detail úkolu']";

View File

@ -4,11 +4,11 @@ import cz.moneta.test.dsl.hypos.pages.HyposPageFlow;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.Select;
import cz.moneta.test.harness.support.web.Until;
import cz.moneta.test.harness.support.web.Wait;
import static cz.moneta.test.dsl.hypos.pages.tasklist.TaskListPage.FILTER_MODE_SELECT;
@Wait(FILTER_MODE_SELECT)
public interface TaskListPage extends HyposPageFlow<TaskListPage>, StoreAccessor {
String FILTER_MODE_SELECT = "//select[@id='filter-mode']";
@ -16,7 +16,7 @@ public interface TaskListPage extends HyposPageFlow<TaskListPage>, StoreAccessor
String FILTER_SEARCH_BUTTON = "//button[text()='Vyhledat']";
String TASK_DETAIL = "(//a[contains(@href,'complaint.detail')])[1]";
@Click(FILTER_SEARCH_BUTTON)
@Click(value = FILTER_SEARCH_BUTTON, andWait = @Wait(value = TASK_DETAIL, until = Until.CLICKABLE))
TaskListPage clickSearchButton();
@Click(TASK_DETAIL)

View File

@ -35,7 +35,7 @@ public class ContractTasks {
public Function<ContractHistoryPage, FeesPage> cashCollectedFee() {
tasks.hyposLog(TASK, new Object() {}.getClass().getEnclosingMethod().getName());
return start -> start.clickFees()
.selectCollectableFee(CollectableFee.FEE_DOWNLOAD_LV_KM.getValue())
.selectCollectableFee(CollectableFee.FEE_DOWNLOAD_LV_KM)
.clickCash()
.checkCollectedFee();
}
@ -243,12 +243,13 @@ public class ContractTasks {
.clickHomepage();
}
public Function<ContractHistoryPage, ClientCurrentAcountPage> setClientCurrentAccount(String currentAccountNumber) {
public Function<ContractHistoryPage, ContractHistoryPage> setClientCurrentAccount(String currentAccountNumber) {
tasks.hyposLog(TASK, new Object() {}.getClass().getEnclosingMethod().getName());
return start -> start.clickLoan()
.clickSetCurrentAccount()
.setCurrentAccount(currentAccountNumber)
.clickSaveCurrentAccount();
.clickSaveCurrentAccount()
.clickHomepage();
}
public Function<ContractHistoryPage, ContractHistoryPage> approveDrawingConditions() {

View File

@ -69,7 +69,7 @@ public class HyposWso2Tasks {
/**
* 08/ Insert Internet Bank details to the contract tab Notifications (Sdeleni)
*/
public void insertInternetBankLoginToCommunication(String contractId, String clientPin, String clientIbLogin) {
public void insertInternetBankLoginToCommunication(String contractId, String clientPin, String clientFullName, String clientIbLogin) {
harness.withWso2()
.prepareRequest()
.withPath("/t/mortgages.cluster/CRT_PR_SDELENI/001")
@ -77,7 +77,7 @@ public class HyposWso2Tasks {
.withHeader("Authorization", "Bearer " + tokenMortgages)
.withPayloadFromTemplate(Template.fromFilepath("system/wso2/mortgages_cluster/createInternetBankApis/crt_pr_sdeleni.json")
.setQuoted("ContractId", contractId)
.setQuoted("Text", "Login do IB pro RC " + clientPin + " je: " + clientIbLogin))
.setQuoted("Text", String.format("Login do IB pro RC %s (%s) je: %s", clientPin, clientFullName, clientIbLogin)))
.post()
.andAssertStatus(200);
harness.log("Internet Bank login was saved into contract's notifications (Sdeleni).");

View File

@ -12,11 +12,13 @@ import cz.moneta.test.dsl.hypos.pages.contract.realty.OrderValuationPage;
import cz.moneta.test.dsl.hypos.pages.contract.realty.UnitDetailPage;
import cz.moneta.test.dsl.hypos.pages.contract.realty.ValuationDetailPage;
import cz.moneta.test.dsl.hypos.pages.realty.RealtyMenuPage;
import cz.moneta.test.dsl.util.DateUtils;
import cz.moneta.test.dsl.util.data.YamlLoader;
import java.util.function.Function;
import static cz.moneta.test.dsl.hypos.enums.HyposLogType.TASK;
import static cz.moneta.test.dsl.hypos.tasks.HyposTasks.defaultDateFormat;
public class ValuationTasks {
private final String YAML_REALTY_DETAIL_PATH = "yamls/hypos/realtyDetails";
@ -54,8 +56,7 @@ public class ValuationTasks {
.selectPledgeType(data.realtyCategories.get(realtyType).pledgeType)
.selectPledgeCode(data.realtyCategories.get(realtyType).pledgeCode)
.clickUseThisUnitCheckbox()
.clickSaveButton()
;
.clickSaveButton();
}
/**
@ -77,8 +78,7 @@ public class ValuationTasks {
.clickSubmit()
.checkUnitUsage(data.realtyCategories.get(realtyType).orientationNumber, data.realtyCategories.get(realtyType).tdPosition)
.clickRealty()
.clickRealtyDetail()
;
.clickRealtyDetail();
}
/**
@ -99,8 +99,7 @@ public class ValuationTasks {
.clickAutosuggestLink(data.realtyCategories.get(realtyType).propertyArea)
.fillDocumentNumber(data.realtyCategories.get(realtyType).documentNumber)
.clickSubmit()
.addUnit(data.realtyCategories.get(realtyType).orientationNumber)
;
.addUnit(data.realtyCategories.get(realtyType).orientationNumber);
}
/**
@ -113,8 +112,7 @@ public class ValuationTasks {
return start -> start
.clickRealty()
.clickRealtyDetail()
.clickOnOrderValuation()
;
.clickOnOrderValuation();
}
/**
@ -128,8 +126,7 @@ public class ValuationTasks {
.checkSharedElements()
.checkFlatElements()
.checkHouseElements()
.checkLandElements()
;
.checkLandElements();
}
public Function<OrderValuationPage, ValuationDetailPage> doFlatMarketValuation() {
@ -161,7 +158,6 @@ public class ValuationTasks {
.selectContactRole("Žadatel o úvěr")
.insertPurchasePrice(data.valuationDetails.get(valuationType).price)
.clickDocumentsAvailable()
.waitFlatDispositionClickable()
.selectDisposition(data.valuationDetails.get(valuationType).disposition)
.insertArea(data.valuationDetails.get(valuationType).area)
.selectFlatState(data.valuationDetails.get(valuationType).state)
@ -178,9 +174,7 @@ public class ValuationTasks {
.clickElevatorYes()
.clickDocumentsLater()
.clickSave()
.waitForValuationComplete()
.verifyValuationType(data.valuationDetails.get(valuationType).valuation)
;
.waitForValuationComplete();
}
/**
@ -203,7 +197,6 @@ public class ValuationTasks {
.selectContactRole("Žadatel o úvěr")
.insertPurchasePrice(data.valuationDetails.get(valuationType).price)
.clickDocumentsAvailable()
.waitHouseMaterialClickable()
.selectConstructionMaterial(data.valuationDetails.get(valuationType).material)
.insertBuildYear(data.valuationDetails.get(valuationType).year)
.insertAreaTotalHouse(data.valuationDetails.get(valuationType).area)
@ -214,9 +207,7 @@ public class ValuationTasks {
.clickNoSeparateGarageInHouse()
.clickDocumentsLater()
.clickSave()
.waitForValuationComplete()
.verifyValuationType(data.valuationDetails.get(valuationType).valuation)
;
.waitForValuationComplete();
}
/**
@ -233,8 +224,7 @@ public class ValuationTasks {
.clickDeferOrderInput()
.acceptAlert()
.verifyLastOperation("odloženo")
.verifyLastOperationComment()
;
.verifyLastOperationComment();
}
/**
@ -250,8 +240,7 @@ public class ValuationTasks {
.clickCancelOrderInput()
.acceptAlert()
.verifyLastOperation("zrušeno")
.verifyLastOperationComment()
;
.verifyLastOperationComment();
}
/**
@ -267,8 +256,7 @@ public class ValuationTasks {
.clickGiveOrderInput()
.acceptAlert()
.verifyLastOperation("předáno")
.verifyLastOperationComment()
;
.verifyLastOperationComment();
}
/**
@ -281,8 +269,7 @@ public class ValuationTasks {
return start -> start
.clickTakeOrder()
.acceptAlert()
.verifyLastOperation("převzato")
;
.verifyLastOperation("převzato");
}
/**
@ -304,8 +291,7 @@ public class ValuationTasks {
.clickSaveAll()
.clickProcessOrder()
.acceptAlert()
.waitForValuationCompleted()
;
.waitForValuationCompleted();
}
public Function<ValuationDetailPage, ValuationDetailPage> finishFlatOrder() {
@ -323,6 +309,7 @@ public class ValuationTasks {
.clickRisks()
.setAllRisksNo()
.clickFinalSection()
.clickComparativeMethod()
.clickComparatorAddRealty()
.insertComparatorRealtyArea("50")
.insertComparatorPrice("50000")
@ -364,6 +351,7 @@ public class ValuationTasks {
.clickRisks()
.setAllRisksNo()
.clickFinalSection()
.clickComparativeMethod()
.clickComparatorAddRealty()
.insertComparatorRealtyArea("50")
.insertSurroundSpace("800")
@ -378,6 +366,7 @@ public class ValuationTasks {
.insertComparatorLandArea("80")
.insertComparatorPrice("50000")
.insertCurrentPrice(6800000)
.insertLocalInvestigationDate(DateUtils.getFormattedTodayDate(defaultDateFormat))
.clickSaveAll()
.clickProcessOrder()
.acceptAlert()
@ -405,8 +394,7 @@ public class ValuationTasks {
.checkElements(selectElements, "select")
.checkElements(inputElement, "input")
.checkElements(textAreaElements, "textarea")
.clickRealtyDescription()
;
.clickRealtyDescription();
}
/**
@ -418,8 +406,7 @@ public class ValuationTasks {
return start -> start
.clickRealtyDescription()
.clickFinalSection()
.doCalculationAndVerify()
;
.doCalculationAndVerify();
}
public Function<RealtyMenuPage, CadasterRedocDetailPage> searchCadasterRedocDetail(String areaCode, String lv) {

View File

@ -1,26 +0,0 @@
package cz.moneta.test.dsl.messaging;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.endpoints.messaging.MessagingEndpoint;
import cz.moneta.test.harness.support.messaging.MessagingRequest;
public class Messaging {
private final Harness harness;
public Messaging(Harness harness) {
this.harness = harness;
}
public MessagingRequest to(String destinationName) {
return request().to(destinationName);
}
public MessagingRequest from(String destinationName) {
return request().from(destinationName);
}
public MessagingRequest request() {
return MessagingRequest.builder(harness.getEndpoint(MessagingEndpoint.class));
}
}

View File

@ -4,20 +4,25 @@ import cz.moneta.test.dsl.newib.NewIbPageFlow;
import cz.moneta.test.dsl.newib.mainpage.DashboardPage;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.ib.NewIbEndpoint;
import cz.moneta.test.harness.support.web.CheckElementPresent;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.CustomAction;
import cz.moneta.test.harness.support.web.Wait;
import cz.moneta.test.harness.support.web.*;
import static cz.moneta.test.dsl.newib.documents.DocumentsModalPage.*;
import static org.junit.jupiter.api.Assertions.assertTrue;
@Wait({DOCUMENTS_TITLE_XPATH, FILTER_BTN_XPATH})
@Wait(value = {DOCUMENTS_TITLE_XPATH, FILTER_BTN_XPATH, LOAD_MORE_DOCUMENTS_BUTTON_XPATH, DOWNLOAD_BUTTON_XPATH, INFO_TEXT_XPATH}, waitSecondsForElement = 30)
public interface DocumentsModalPage extends NewIbPageFlow<DocumentsModalPage>, StoreAccessor {
String DOCUMENTS_TITLE_XPATH = "//h1[@class='t-title t-title--h3 u-mb--0'][text()='Dokumenty']";
String FILTER_BTN_XPATH = "//button[@data-testid='show-filter-button']";
String FILTER_BTN_XPATH = "//button[@data-testid='show-filter-button' and text()='Podrobné hledání']";
String CLOSE_BTN_XPATH = "//button[@data-testid='close-documents-button']";
String DOCUMENT_NAME_XPATH = "//span[@data-testid='TextComponent' and text()='%s']";
String LOAD_MORE_DOCUMENTS_BUTTON_XPATH = "//button[@data-testid='load-more-documents' and text()='Zobrazit 10 dalších dokumentů']";
String DOWNLOAD_BUTTON_XPATH = "//button[@data-testid='Button' and text()='Stáhnout']";
String INFO_TEXT_XPATH = "//p[@data-testid='TextComponent' and contains(., 'Základní Produktové podmínky, speciální Produktové podmínky, Sazebník, Úrokový lístek, Reklamační řád a ') and contains(., 'další smluvní dokumenty najdete na našem webu')]";
String LINK_XPATH = "//a[@href='https://www.moneta.cz/dokumenty-ke-stazeni']";
String OPEN_DOCUMENT_TITLE_XPATH = "//h1[@class='t-title t-title--h3 u-mb--0' and text()='Záznam o podané reklamaci/stížnosti']";
String PRINT_BUTTON_XPATH = "//button[@aria-label='Vytisknout']";
String OPEN_DOCUMENT_DOWNLOAD_BUTTON_XPATH = "//button[@aria-label='Stáhnout']";
@CheckElementPresent(DOCUMENTS_TITLE_XPATH)
DocumentsModalPage checkDocumentsTitleIsPresent();
@ -39,4 +44,22 @@ public interface DocumentsModalPage extends NewIbPageFlow<DocumentsModalPage>, S
@Click(CLOSE_BTN_XPATH)
DashboardPage closeDocumentsModal();
@CheckElementPresent(value = DOCUMENT_NAME_XPATH, isStringDynamicXpath = true)
DocumentsModalPage checkDocumentName(String documentName);
@Click(LINK_XPATH)
DocumentsModalPage clickOnLink();
@Click(value = DOCUMENT_NAME_XPATH, isStringDynamicXpath = true)
DocumentsModalPage clickOnDocument(String documentName);
@CheckElementPresent(OPEN_DOCUMENT_TITLE_XPATH)
DocumentsModalPage checkOpenDocumentTitle();
@CheckElementPresent(PRINT_BUTTON_XPATH)
DocumentsModalPage checkPrintButton();
@CheckElementPresent(OPEN_DOCUMENT_DOWNLOAD_BUTTON_XPATH)
DocumentsModalPage checkDownloadButton();
}

Some files were not shown because too many files have changed in this diff Show More