Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ checkmarx-ast-eclipse-plugin/lib/ast-cli-java-wrapper-2.4.20.jar filter=lfs diff
checkmarx-ast-eclipse-plugin/lib/ast-cli-java-wrapper-2.4.21.jar filter=lfs diff=lfs merge=lfs -text
checkmarx-ast-eclipse-plugin/lib/ast-cli-java-wrapper-2.4.23.jar filter=lfs diff=lfs merge=lfs -text
checkmarx-ast-eclipse-plugin/lib/ast-cli-java-wrapper-2.4.24.jar filter=lfs diff=lfs merge=lfs -text
devassist-lib/lib/*.jar filter=lfs diff=lfs merge=lfs -text
common-lib/lib/*.jar filter=lfs diff=lfs merge=lfs -text
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
.vs/
*.jar
!checkmarx-ast-eclipse-plugin/lib/*.jar
!devassist-lib/lib/*.jar
Comment thread
cx-rakesh-kadu marked this conversation as resolved.
!common-lib/lib/*.jar
6 changes: 3 additions & 3 deletions checkmarx-ast-eclipse-plugin-tests/.classpath
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
Expand All @@ -14,7 +13,8 @@
</attributes>
</classpathentry>
<classpathentry exported="true" kind="lib" path="lib/mockito-core-5.14.2.jar"/>
<classpathentry kind="lib" path="lib/powermock-core-2.0.9.jar"/>
<classpathentry exported="true" kind="lib" path="lib/byte-buddy-1.17.8.jar"/>
<classpathentry exported="true" kind="lib" path="lib/byte-buddy-agent-1.17.8.jar"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
Expand Down
1 change: 1 addition & 0 deletions checkmarx-ast-eclipse-plugin-tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Require-Bundle:
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ClassPath: .,lib/mockito-core-5.14.2.jar,lib/powermock-core-*.jar, lib/byte-buddy-1.17.8.jar, lib/byte-buddy-agent-1.17.8.jar
Automatic-Module-Name: com.checkmarx.ast.eclipse.tests
Import-Package: com.checkmarx.eclipse.common.runner
27 changes: 1 addition & 26 deletions checkmarx-ast-eclipse-plugin-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,10 @@
<formats>
<format>XML</format>
<format>CSV</format>
<format>HTML</format>
</formats>
</configuration>
</execution>
<execution>
<id>check</id>
<phase>verify</phase>
<goals><goal>check</goal></goals>
<configuration>
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
<classesDirectory>${project.basedir}/../checkmarx-ast-eclipse-plugin/target/classes</classesDirectory>
<excludes>
<exclude>org/eclipse/wb/swt/SWTResourceManager.class</exclude>
</excludes>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.30</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.mockito.Mock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.checkmarx.eclipse.runner.Authenticator;
import com.checkmarx.eclipse.common.runner.Authenticator;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import com.checkmarx.ast.wrapper.CxConfig;
import com.checkmarx.ast.wrapper.CxWrapper;
import com.checkmarx.eclipse.runner.Authenticator;
import com.checkmarx.eclipse.common.runner.Authenticator;

import checkmarx.ast.eclipse.plugin.tests.common.Environment;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;

import com.checkmarx.eclipse.common.utils.PluginConstants;

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swt.widgets.Decorations;
import org.eclipse.swt.widgets.Tree;

import com.checkmarx.eclipse.utils.PluginConstants;

import checkmarx.ast.eclipse.plugin.tests.common.Environment;

public abstract class BaseUITest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.junit.jupiter.api.Test;

import com.checkmarx.eclipse.utils.PluginConstants;
import com.checkmarx.eclipse.common.utils.PluginConstants;

public class BestFixLocationTest extends BaseUITest{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import com.checkmarx.eclipse.enums.Severity;
import com.checkmarx.eclipse.common.enums.Severity;
import com.checkmarx.eclipse.enums.State;
import com.checkmarx.eclipse.views.actions.ToolBarActions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
import org.junit.jupiter.api.Test;

import com.checkmarx.eclipse.utils.PluginConstants;
import com.checkmarx.eclipse.common.utils.PluginConstants;

import checkmarx.ast.eclipse.plugin.tests.common.Environment;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.junit.jupiter.api.Test;

import com.checkmarx.eclipse.enums.Severity;
import com.checkmarx.eclipse.utils.PluginConstants;
import com.checkmarx.eclipse.common.enums.Severity;
import com.checkmarx.eclipse.common.utils.PluginConstants;

public class TestTriage extends BaseUITest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import org.junit.jupiter.api.Test;

import com.checkmarx.eclipse.enums.ActionName;
import com.checkmarx.eclipse.enums.Severity;
import com.checkmarx.eclipse.utils.PluginConstants;
import com.checkmarx.eclipse.common.enums.Severity;
import com.checkmarx.eclipse.common.utils.PluginConstants;
import com.checkmarx.eclipse.views.actions.ToolBarActions;

import checkmarx.ast.eclipse.plugin.tests.common.Environment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

import com.checkmarx.eclipse.enums.Severity;
import com.checkmarx.eclipse.common.enums.Severity;

class SeverityExtendedTest {

Expand All @@ -17,9 +17,6 @@ void testGetSeverity_allConstants() {
assertEquals(Severity.MEDIUM, Severity.getSeverity("MEDIUM"));
assertEquals(Severity.LOW, Severity.getSeverity("LOW"));
assertEquals(Severity.INFO, Severity.getSeverity("INFO"));
assertEquals(Severity.GROUP_BY_SEVERITY, Severity.getSeverity("GROUP_BY_SEVERITY"));
assertEquals(Severity.GROUP_BY_QUERY_NAME, Severity.getSeverity("GROUP_BY_QUERY_NAME"));
assertEquals(Severity.GROUP_BY_STATE_NAME, Severity.getSeverity("GROUP_BY_STATE_NAME"));
}

@Test
Expand Down Expand Up @@ -49,9 +46,6 @@ void testValueOf_allConstantsExist() {
assertDoesNotThrow(() -> Severity.valueOf("MEDIUM"));
assertDoesNotThrow(() -> Severity.valueOf("LOW"));
assertDoesNotThrow(() -> Severity.valueOf("INFO"));
assertDoesNotThrow(() -> Severity.valueOf("GROUP_BY_SEVERITY"));
assertDoesNotThrow(() -> Severity.valueOf("GROUP_BY_QUERY_NAME"));
assertDoesNotThrow(() -> Severity.valueOf("GROUP_BY_STATE_NAME"));
}

@Test
Expand All @@ -71,9 +65,6 @@ void testEnumName_correctValues() {
assertEquals("MEDIUM", Severity.MEDIUM.name());
assertEquals("LOW", Severity.LOW.name());
assertEquals("INFO", Severity.INFO.name());
assertEquals("GROUP_BY_SEVERITY", Severity.GROUP_BY_SEVERITY.name());
assertEquals("GROUP_BY_QUERY_NAME", Severity.GROUP_BY_QUERY_NAME.name());
assertEquals("GROUP_BY_STATE_NAME", Severity.GROUP_BY_STATE_NAME.name());
}

@Test
Expand All @@ -83,9 +74,6 @@ void testEnumOrdinal_correctSequence() {
assertEquals(2, Severity.MEDIUM.ordinal());
assertEquals(3, Severity.LOW.ordinal());
assertEquals(4, Severity.INFO.ordinal());
assertEquals(5, Severity.GROUP_BY_SEVERITY.ordinal());
assertEquals(6, Severity.GROUP_BY_QUERY_NAME.ordinal());
assertEquals(7, Severity.GROUP_BY_STATE_NAME.ordinal());
}

@Test
Expand All @@ -106,7 +94,6 @@ void testValues_containsAllExpected() {
if (s == Severity.CRITICAL) hasCritical = true;
if (s == Severity.HIGH) hasHigh = true;
if (s == Severity.LOW) hasLow = true;
if (s == Severity.GROUP_BY_SEVERITY) hasGroupBy = true;
}

assertTrue(hasCritical);
Expand Down Expand Up @@ -142,7 +129,6 @@ void testSeverityComparison_differentInstancesNotEqual() {
void testToString_returnsName() {
assertEquals("CRITICAL", Severity.CRITICAL.toString());
assertEquals("HIGH", Severity.HIGH.toString());
assertEquals("GROUP_BY_SEVERITY", Severity.GROUP_BY_SEVERITY.toString());
}

@Test
Expand Down Expand Up @@ -210,9 +196,6 @@ void testEnumConstants_arePublicStaticFinal() {

@Test
void testGroupByConstants_arePublicStaticFinal() {
assertNotNull(Severity.GROUP_BY_SEVERITY);
assertNotNull(Severity.GROUP_BY_QUERY_NAME);
assertNotNull(Severity.GROUP_BY_STATE_NAME);
}

@Test
Expand All @@ -233,9 +216,6 @@ void testGetSeverity_multipleCallsSequence() {

@Test
void testGetSeverity_allGroupByVariants() {
assertEquals(Severity.GROUP_BY_SEVERITY, Severity.getSeverity("GROUP_BY_SEVERITY"));
assertEquals(Severity.GROUP_BY_QUERY_NAME, Severity.getSeverity("GROUP_BY_QUERY_NAME"));
assertEquals(Severity.GROUP_BY_STATE_NAME, Severity.getSeverity("GROUP_BY_STATE_NAME"));
}

@ParameterizedTest
Expand All @@ -247,7 +227,6 @@ void testGetSeverity_validStandardSeverities(String severityName) {
}

@ParameterizedTest
@ValueSource(strings = {"GROUP_BY_SEVERITY", "GROUP_BY_QUERY_NAME", "GROUP_BY_STATE_NAME"})
void testGetSeverity_validGroupingOptions(String groupingName) {
Severity severity = Severity.getSeverity(groupingName);
assertNotNull(severity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import org.junit.jupiter.api.Test;

import com.checkmarx.eclipse.enums.Severity;
import com.checkmarx.eclipse.common.enums.Severity;

class SeverityTest {

Expand Down Expand Up @@ -33,21 +33,6 @@ void testGetSeverity_info() {
assertEquals(Severity.INFO, Severity.getSeverity("INFO"));
}

@Test
void testGetSeverity_groupBySeverity() {
assertEquals(Severity.GROUP_BY_SEVERITY, Severity.getSeverity("GROUP_BY_SEVERITY"));
}

@Test
void testGetSeverity_groupByQueryName() {
assertEquals(Severity.GROUP_BY_QUERY_NAME, Severity.getSeverity("GROUP_BY_QUERY_NAME"));
}

@Test
void testGetSeverity_groupByStateName() {
assertEquals(Severity.GROUP_BY_STATE_NAME, Severity.getSeverity("GROUP_BY_STATE_NAME"));
}

@Test
void testGetSeverity_unknownValue_throwsIllegalArgumentException() {
assertThrows(IllegalArgumentException.class, () -> Severity.getSeverity("UNKNOWN_SEVERITY_XYZ"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.mockito.MockitoAnnotations;

import com.checkmarx.eclipse.Activator;
import com.checkmarx.eclipse.properties.Preferences;
import com.checkmarx.eclipse.common.preferences.Preferences;

class PreferencesTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

import com.checkmarx.ast.wrapper.CxException;
import com.checkmarx.ast.wrapper.CxWrapper;
import com.checkmarx.eclipse.runner.Authenticator;
import com.checkmarx.eclipse.utils.CxLogger;
import com.checkmarx.eclipse.utils.PluginConstants;
import com.checkmarx.eclipse.common.runner.Authenticator;
import com.checkmarx.eclipse.common.utils.CxLogger;
import com.checkmarx.eclipse.common.utils.PluginConstants;

class AuthenticatorTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import org.junit.jupiter.api.Test;

import com.checkmarx.eclipse.utils.CxLogger;
import com.checkmarx.eclipse.common.utils.CxLogger;

class CxLoggerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
import com.checkmarx.ast.results.result.Data;
import com.checkmarx.ast.results.result.Node;
import com.checkmarx.ast.results.result.Result;
import com.checkmarx.eclipse.enums.Severity;
import com.checkmarx.eclipse.properties.Preferences;
import com.checkmarx.eclipse.utils.PluginConstants;
import com.checkmarx.eclipse.common.enums.Severity;
import com.checkmarx.eclipse.common.preferences.Preferences;
import com.checkmarx.eclipse.common.utils.PluginConstants;
import com.checkmarx.eclipse.utils.PluginUtils;
import com.checkmarx.eclipse.views.DataProvider;
import com.checkmarx.eclipse.views.DisplayModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import org.mockito.MockedStatic;
import org.mockito.Mockito;

import com.checkmarx.eclipse.common.utils.PluginConstants;
import com.checkmarx.eclipse.enums.ActionName;
import com.checkmarx.eclipse.utils.PluginConstants;
import com.checkmarx.eclipse.views.DisplayModel;
import com.checkmarx.eclipse.views.actions.ActionOpenPreferencesPage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.checkmarx.eclipse.views.DataProvider;

import com.checkmarx.eclipse.enums.PluginListenerType;
import com.checkmarx.eclipse.enums.Severity;
import com.checkmarx.eclipse.common.enums.Severity;
import com.checkmarx.eclipse.views.DisplayModel;
import com.checkmarx.eclipse.views.PluginListenerDefinition;
import com.checkmarx.eclipse.views.actions.ToolBarActions;
Expand Down Expand Up @@ -135,10 +135,8 @@ void testRefreshToolbarRecreatesActions() {

@Test
void testGroupBySeverityAction() {
// The GROUP_BY_SEVERITY action calls FilterState.setState(Severity.GROUP_BY_SEVERITY).
// createGroupByActions() runs inside a background Job so we test the toggle directly.
FilterState.groupBySeverity = false;
FilterState.setState(Severity.GROUP_BY_SEVERITY);
assertTrue(FilterState.groupBySeverity);
}

Expand Down Expand Up @@ -186,17 +184,14 @@ void testStaticConstant_menuGroupBy() {

@Test
void testStaticConstant_groupBySeverity() {
assertEquals("Severity", ToolBarActions.GROUP_BY_SEVERITY);
}

@Test
void testStaticConstant_groupByQueryName() {
assertEquals("Query Name", ToolBarActions.GROUP_BY_QUERY_NAME);
}

@Test
void testStaticConstant_groupByStateName() {
assertEquals("State Name", ToolBarActions.GROUP_BY_STATE_NAME);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.checkmarx.eclipse.views.filters.ActionFilters;
import com.checkmarx.eclipse.enums.ActionName;
import com.checkmarx.eclipse.enums.PluginListenerType;
import com.checkmarx.eclipse.enums.Severity;
import com.checkmarx.eclipse.common.enums.Severity;
import com.checkmarx.eclipse.views.DataProvider;
import com.checkmarx.eclipse.views.PluginListenerDefinition;
import com.google.common.eventbus.EventBus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.mockito.MockedStatic;
import org.mockito.MockitoAnnotations;

import com.checkmarx.eclipse.enums.Severity;
import com.checkmarx.eclipse.common.enums.Severity;
import com.checkmarx.eclipse.enums.State;
import com.checkmarx.eclipse.views.GlobalSettings;
import com.checkmarx.eclipse.views.filters.FilterState;
Expand Down Expand Up @@ -87,7 +87,6 @@ void testSetState_groupBySeverityToggle() {
boolean beforeState = FilterState.groupBySeverity;

try (MockedStatic<GlobalSettings> mockSettings = mockStatic(GlobalSettings.class)) {
FilterState.setState(Severity.GROUP_BY_SEVERITY);
assertNotEquals(beforeState, FilterState.groupBySeverity);
}
}
Expand Down
Loading
Loading