Skip to content

Commit fc72964

Browse files
added-isdev-isoneassist-function
1 parent 1adc1f4 commit fc72964

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

src/main/java/com/checkmarx/ast/wrapper/CxConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ public final class CxConstants {
7575
static final String SUB_CMD_TENANT = "tenant";
7676
static final String IDE_SCANS_KEY = "scan.config.plugins.ideScans";
7777
static final String AI_MCP_SERVER_KEY = "scan.config.plugins.aiMcpServer";
78+
static final String DEV_ASSIST_LICENSE_KEY = "scan.config.plugins.cxdevassist";
79+
static final String ONE_ASSIST_LICENSE_KEY = "scan.config.plugins.cxoneassist";
7880
static final String IGNORED_FILE_PATH = "--ignored-file-path";
7981
static final String SUB_CMD_OSS_REALTIME = "oss-realtime";
8082
static final String SUB_CMD_IAC_REALTIME = "iac-realtime";

src/main/java/com/checkmarx/ast/wrapper/CxWrapper.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,28 @@ public List<TenantSetting> tenantSettings() throws CxException, IOException, Int
530530
return Execution.executeCommand(withConfigArguments(arguments), logger, TenantSetting::listFromLine);
531531
}
532532

533+
534+
535+
public boolean getTenantSetting(String key) throws CxException, IOException, InterruptedException {
536+
List<TenantSetting> tenantSettings = tenantSettings();
537+
if (tenantSettings == null) {
538+
throw new CxException(1, "Unable to parse tenant settings");
539+
}
540+
return tenantSettings.stream()
541+
.filter(t -> t.getKey().equals(key))
542+
.findFirst()
543+
.map(t -> Boolean.parseBoolean(t.getValue()))
544+
.orElse(false);
545+
}
546+
public boolean devAssistEnabled() throws CxException, IOException, InterruptedException {
547+
return getTenantSetting(CxConstants.DEV_ASSIST_LICENSE_KEY);
548+
549+
}
550+
551+
public boolean oneAssistEnabled() throws CxException, IOException, InterruptedException {
552+
return getTenantSetting(CxConstants.ONE_ASSIST_LICENSE_KEY);
553+
}
554+
533555
public MaskResult maskSecrets(@NonNull String filePath) throws CxException, IOException, InterruptedException {
534556
List<String> arguments = new ArrayList<>();
535557

src/test/java/com/checkmarx/ast/TenantTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,14 @@ void testAiMcpServerEnabled() throws Exception {
2424
boolean enabled = Assertions.assertDoesNotThrow(() -> wrapper.aiMcpServerEnabled());
2525
Assertions.assertTrue(enabled, "AI MCP Server flag expected to be true");
2626
}
27+
28+
@Test
29+
void testDevAssistEnabled() {
30+
Assertions.assertDoesNotThrow(() -> wrapper.devAssistEnabled());
31+
}
32+
33+
@Test
34+
void testOneAssistEnabled() {
35+
Assertions.assertDoesNotThrow(() -> wrapper.oneAssistEnabled());
36+
}
2737
}

0 commit comments

Comments
 (0)