All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.intershop.oms.test.configuration.Configuration Maven / Gradle / Ivy

There is a newer version: 7.1.0
Show newest version
package com.intershop.oms.test.configuration;

import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;

import java.util.Map;
import java.util.Optional;

@ConfigMapping(prefix = "testframework")
public interface Configuration {

    @WithName("default-endpoint")
    Optional defaultEndpoint();

    @WithName("database")
    Map databaseConfigs();

    @WithName("order-service")
    Map orderServiceConfigs();

    @WithName("order-state-service")
    Map orderStateServiceConfigs();

    @WithName("inventory-service")
    Map inventoryServiceConfigs();

    @WithName("rma-service")
    Map rmaServiceConfigs();

    @WithName("schedule-service")
    Map scheduleServiceConfigs();

    @WithName("supplier-service")
    Map supplierServiceConfigs();

    @WithName("transmission-service")
    Map transmissionServiceConfigs();

    @WithName("client-logging")
    @WithDefault("true")
    boolean clientLogging();

    @WithName("jwt-secret")
    Optional jwtSecret();

    default ServiceConfiguration getDbServiceById(String id) {
        return Optional.ofNullable(databaseConfigs().get(id)).orElseThrow(() -> new IllegalArgumentException("db service config with name " + id + " not found!"));
    }

    default ServiceConfiguration getOrderServiceById(String id) {
        return Optional.ofNullable(orderServiceConfigs().get(id)).orElseThrow(() -> new IllegalArgumentException("order service config with name " + id + " not found!"));
    }

    default ServiceConfiguration getInventoryServiceById(String id) {
        return Optional.ofNullable(inventoryServiceConfigs().get(id)).orElseThrow(() -> new IllegalArgumentException("inventory service config with name " + id + " not found!"));
    }

    default ServiceConfiguration getOrderStateServiceById(String id) {
        return Optional.ofNullable(orderStateServiceConfigs().get(id)).orElseThrow(() -> new IllegalArgumentException("order state service config with name " + id + " not found!"));
    }

    default ServiceConfiguration getRMAServiceById(String id) {
        return Optional.ofNullable(rmaServiceConfigs().get(id)).orElseThrow(() -> new IllegalArgumentException("RMA service config with name " + id + " not found!"));
    }

    default ServiceConfiguration getScheduleServiceById(String id) {
        return Optional.ofNullable(scheduleServiceConfigs().get(id)).orElseThrow(() -> new IllegalArgumentException("schedule service config with name " + id + " not found!"));
    }

    default ServiceConfiguration getSupplierServiceById(String id) {
        return Optional.ofNullable(supplierServiceConfigs().get(id)).orElseThrow(() -> new IllegalArgumentException("supplier service config with name " + id + " not found!"));
    }

    default ServiceConfiguration getTransmissionServiceById(String id) {
        return Optional.ofNullable(transmissionServiceConfigs().get(id)).orElseThrow(() -> new IllegalArgumentException("transmission service config with name " + id + " not found!"));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy