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

com.arextest.schedule.service.ConfigurationService Maven / Gradle / Ivy

There is a newer version: 2.0.4
Show newest version
package com.arextest.schedule.service;

import com.arextest.schedule.client.HttpWepServiceApiClient;
import jakarta.annotation.Resource;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class ConfigurationService {

  @Resource
  private HttpWepServiceApiClient wepApiClientService;
  @Value("${arex.api.config.application.url}")
  private String applicationUrl;
  @Value("${arex.api.config.schedule.url}")
  private String scheduleUrl;

  public Application application(String appId) {
    ApplicationResponse applicationResponse = wepApiClientService.get(applicationUrl,
        appIdUrlVariable(appId),
        ApplicationResponse.class);
    return applicationResponse != null ? applicationResponse.body : null;
  }

  public ScheduleConfiguration schedule(String appId) {
    ScheduleResponse scheduleResponse = wepApiClientService.get(scheduleUrl,
        appIdUrlVariable(appId),
        ScheduleResponse.class);
    return scheduleResponse != null ? scheduleResponse.body : null;
  }

  private Map appIdUrlVariable(String appId) {
    return Collections.singletonMap("appId", appId);
  }

  @Data
  private static final class ScheduleResponse {

    private ScheduleConfiguration body;
  }

  @Data
  public static final class ScheduleConfiguration {

    private String appId;
    private Integer offsetDays;
    private Set targetEnv;
    // replay exclusion operations
    private Map> excludeOperationMap;
    private Integer sendMaxQps;
    // record inclusion operations
    private Set includeServiceOperationSet;
    // record exclusion operations
    private Set excludeServiceOperationSet;
  }

  @Data
  private static final class ApplicationResponse {

    private Application body;
  }

  @Data
  static final class Application {

    private String appId;
    private int features;
    private String groupName;
    private String groupId;
    private String agentVersion;
    private String agentExtVersion;
    private String appName;
    private String description;

    /**
     * java_web_service nodeJs_Web_service
     */
    private String category;
    private String owner;
    private String organizationName;
    private Integer recordedCaseCount;

    /**
     * organization_id
     */
    private String organizationId;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy