-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
102 changed files
with
27,220 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
376 changes: 376 additions & 0 deletions
376
...ib/src/main/java/com/ptsecurity/appsec/ai/ee/utils/ci/integration/api/v490/ApiClient.java
Large diffs are not rendered by default.
Oops, something went wrong.
580 changes: 580 additions & 0 deletions
580
...com/ptsecurity/appsec/ai/ee/utils/ci/integration/api/v490/converters/AiProjConverter.java
Large diffs are not rendered by default.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
.../com/ptsecurity/appsec/ai/ee/utils/ci/integration/api/v490/converters/EnumsConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.ptsecurity.appsec.ai.ee.utils.ci.integration.api.v490.converters; | ||
|
||
import com.ptsecurity.appsec.ai.ee.scan.progress.Stage; | ||
import lombok.NonNull; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class EnumsConverter { | ||
public static final Map<com.ptsecurity.appsec.ai.ee.server.v490.api.model.Stage, Stage> PROJECT_STAGE_MAP = new HashMap<>(); | ||
public static final Map<com.ptsecurity.appsec.ai.ee.server.v490.notifications.model.Stage, Stage> NOTIFICATION_STAGE_MAP = new HashMap<>(); | ||
|
||
static { | ||
for (com.ptsecurity.appsec.ai.ee.server.v490.api.model.Stage stage : com.ptsecurity.appsec.ai.ee.server.v490.api.model.Stage.values()) | ||
PROJECT_STAGE_MAP.put(stage, Stage.valueOf(stage.name().toUpperCase())); | ||
for (com.ptsecurity.appsec.ai.ee.server.v490.notifications.model.Stage stage : com.ptsecurity.appsec.ai.ee.server.v490.notifications.model.Stage.values()) | ||
NOTIFICATION_STAGE_MAP.put(stage, Stage.valueOf(stage.name().toUpperCase())); | ||
} | ||
|
||
@NonNull | ||
public static Stage convert(@NonNull final com.ptsecurity.appsec.ai.ee.server.v490.api.model.Stage stage) { | ||
return PROJECT_STAGE_MAP.get(stage); | ||
} | ||
|
||
@NonNull | ||
public static Stage convert(@NonNull final com.ptsecurity.appsec.ai.ee.server.v490.notifications.model.Stage stage) { | ||
return NOTIFICATION_STAGE_MAP.get(stage); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
...ptsecurity/appsec/ai/ee/utils/ci/integration/api/v490/converters/HealthDataConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.ptsecurity.appsec.ai.ee.utils.ci.integration.api.v490.converters; | ||
|
||
import com.ptsecurity.appsec.ai.ee.HealthData; | ||
import com.ptsecurity.appsec.ai.ee.server.v490.api.model.HealthCheckServiceResult; | ||
import com.ptsecurity.appsec.ai.ee.server.v490.api.model.HealthCheckSummaryResult; | ||
import com.ptsecurity.appsec.ai.ee.server.v490.api.model.HealthStatus; | ||
import lombok.NonNull; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
@Slf4j | ||
public class HealthDataConverter { | ||
@NonNull | ||
public static HealthData convert(@NonNull final HealthCheckSummaryResult health) { | ||
List<HealthData.Service> services = new ArrayList<>(); | ||
if (null == health.getServices() || health.getServices().isEmpty()) { | ||
log.warn("Health data services list is empty"); | ||
log.trace(health.toString()); | ||
} else { | ||
for (HealthCheckServiceResult serviceHealth : health.getServices()) { | ||
if (null == serviceHealth) continue; | ||
services.add(convert(serviceHealth)); | ||
} | ||
} | ||
return HealthData.builder().services(services).build(); | ||
} | ||
|
||
@NonNull | ||
public static HealthData.Service convert(@NonNull final HealthCheckServiceResult serviceHealth) { | ||
return HealthData.Service.builder() | ||
.name(Objects.requireNonNull(serviceHealth.getService(), "Health data service name is null")) | ||
.ok(HealthStatus.HEALTHY == Objects.requireNonNull(serviceHealth.getStatus(), "Health data service status is null")) | ||
.build(); | ||
} | ||
} |
429 changes: 429 additions & 0 deletions
429
...com/ptsecurity/appsec/ai/ee/utils/ci/integration/api/v490/converters/IssuesConverter.java
Large diffs are not rendered by default.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
...tsecurity/appsec/ai/ee/utils/ci/integration/api/v490/converters/LicenseDataConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.ptsecurity.appsec.ai.ee.utils.ci.integration.api.v490.converters; | ||
|
||
import com.ptsecurity.appsec.ai.ee.LicenseData; | ||
import com.ptsecurity.appsec.ai.ee.server.v490.api.model.EnterpriseLicenseModel; | ||
import com.ptsecurity.appsec.ai.ee.server.v490.api.model.ProgrammingLanguageGroup; | ||
import lombok.NonNull; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.util.*; | ||
|
||
@Slf4j | ||
public class LicenseDataConverter { | ||
public static final Map<ProgrammingLanguageGroup, String> LANGUAGES_MAP = new HashMap<>(); | ||
|
||
static { | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.NONE, "None"); | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.PHP, "PHP"); | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.JAVA, "Java"); | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.CANDCPLUSPLUS, "C/C++"); | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.JAVASCRIPT, "JavaScript/TypeScript"); | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.SQL, "SQL"); | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.OBJECTIVEC, "Objective-C"); | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.SWIFT, "Swift"); | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.PYTHON, "Python"); | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.CSHARP, "C#"); | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.VB, "VB.NET"); | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.GO, "Go"); | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.KOTLIN, "Kotlin"); | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.RUBY, "Ruby"); | ||
LANGUAGES_MAP.put(ProgrammingLanguageGroup.SOLIDITY, "Solidity"); | ||
} | ||
|
||
@NonNull | ||
public static LicenseData convert(@NonNull final EnterpriseLicenseModel licenseData) { | ||
final List<String> languages = new ArrayList<>(); | ||
if (null == licenseData.getLanguages() || licenseData.getLanguages().isEmpty()) { | ||
log.warn("License languages list is empty"); | ||
log.trace(licenseData.toString()); | ||
} else | ||
licenseData.getLanguages().stream().map(LANGUAGES_MAP::get).filter(StringUtils::isNotEmpty).forEach(languages::add); | ||
return LicenseData.builder() | ||
.languages(languages) | ||
.startDate(null) | ||
.endDate(Objects.requireNonNull(licenseData.getEndDate(), "License end date is null")) | ||
.number(Objects.requireNonNull(licenseData.getLicenseNumber(), "License number is null")) | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.