-
Notifications
You must be signed in to change notification settings - Fork 63
Implementation of POINT statement in CICS #2615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
slavek-kucera
merged 4 commits into
eclipse-che4z:development
from
ilidio-lopes:US1001516-Implementation-of-POINT-statement-in-CICS
Jan 2, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
65a33f3
Implementation of POINT statement in CICS
ilidio-lopes 3868678
Merge branch 'development' into US1001516-Implementation-of-POINT-sta…
ilidio-lopes 3a6fec0
pr comments
ilidio-lopes 2371dc2
Merge branch 'development' into US1001516-Implementation-of-POINT-sta…
ilidio-lopes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
64 changes: 64 additions & 0 deletions
64
...ava/org/eclipse/lsp/cobol/implicitDialects/cics/utility/CICSPointOptionsCheckUtility.java
This file contains hidden or 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,64 @@ | ||
/* | ||
* Copyright (c) 2024 Broadcom. | ||
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Broadcom, Inc. - initial API and implementation | ||
* | ||
*/ | ||
package org.eclipse.lsp.cobol.implicitDialects.cics.utility; | ||
|
||
import org.antlr.v4.runtime.ParserRuleContext; | ||
import org.eclipse.lsp.cobol.common.dialects.DialectProcessingContext; | ||
import org.eclipse.lsp.cobol.common.error.ErrorSeverity; | ||
import org.eclipse.lsp.cobol.common.error.SyntaxError; | ||
import org.eclipse.lsp.cobol.implicitDialects.cics.CICSLexer; | ||
import org.eclipse.lsp.cobol.implicitDialects.cics.CICSParser; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static org.eclipse.lsp.cobol.implicitDialects.cics.CICSParser.RULE_cics_point; | ||
|
||
/** Checks CICS POINT rules for required and invalid options */ | ||
public class CICSPointOptionsCheckUtility extends CICSOptionsCheckBaseUtility { | ||
public static final int RULE_INDEX = RULE_cics_point; | ||
|
||
private static final Map<Integer, ErrorSeverity> DUPLICATE_CHECK_OPTIONS = | ||
new HashMap<Integer, ErrorSeverity>() { | ||
{ | ||
put(CICSLexer.POINT, ErrorSeverity.ERROR); | ||
put(CICSLexer.CONVID, ErrorSeverity.ERROR); | ||
put(CICSLexer.SESSION, ErrorSeverity.ERROR); | ||
} | ||
}; | ||
|
||
public CICSPointOptionsCheckUtility(DialectProcessingContext context, List<SyntaxError> errors) { | ||
super(context, errors, DUPLICATE_CHECK_OPTIONS); | ||
} | ||
|
||
/** | ||
* Entrypoint to check CICS POINT rule options | ||
* | ||
* @param ctx ParserRuleContext subclass containing options | ||
* @param <E> A subclass of ParserRuleContext | ||
*/ | ||
public <E extends ParserRuleContext> void checkOptions(E ctx) { | ||
if (ctx instanceof CICSParser.Cics_point_optionsContext) { | ||
checkPoint((CICSParser.Cics_point_optionsContext) ctx); | ||
} | ||
checkDuplicates(ctx); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
private void checkPoint(CICSParser.Cics_point_optionsContext ctx) { | ||
checkHasMutuallyExclusiveOptions("CONVID or SESSION", ctx.CONVID(), ctx.SESSION()); | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
server/engine/src/test/java/org/eclipse/lsp/cobol/usecases/TestCICSPoint.java
This file contains hidden or 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,93 @@ | ||
/* | ||
* Copyright (c) 2024 Broadcom. | ||
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Broadcom, Inc. - initial API and implementation | ||
* | ||
*/ | ||
package org.eclipse.lsp.cobol.usecases; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
import org.eclipse.lsp.cobol.common.error.ErrorSource; | ||
import org.eclipse.lsp.cobol.usecases.common.CICSTestUtils; | ||
import org.eclipse.lsp4j.Diagnostic; | ||
import org.eclipse.lsp4j.DiagnosticSeverity; | ||
import org.eclipse.lsp4j.Range; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* Test CICS POINT command. Documentation link: <a | ||
* href="https://www.ibm.com/docs/en/cics-ts/6.x?topic=summary-point">POINT Command</a> | ||
* | ||
* <p>This class tests the POINT command. | ||
*/ | ||
public class TestCICSPoint { | ||
private static final String POINT_VALID = | ||
"POINT"; | ||
|
||
private static final String POINT_VALID_CONVID = | ||
"POINT CONVID({$varOne})"; | ||
|
||
private static final String POINT_VALID_SESSION = | ||
"POINT SESSION({$varOne})"; | ||
|
||
private static final String POINT_INVALID_DUPLICATE_SESSION = | ||
"POINT SESSION({$varOne}) {SESSION|errorOne}({$varTwo})"; | ||
|
||
private static final String POINT_INVALID_BOTH_OPTIONS = | ||
"POINT {CONVID|errorOne}({$varOne}) {SESSION|errorTwo}({$varTwo})"; | ||
|
||
@Test | ||
void testPointValid() { | ||
CICSTestUtils.noErrorTest(POINT_VALID); | ||
} | ||
|
||
@Test | ||
void testPointValidConvid() { | ||
CICSTestUtils.noErrorTest(POINT_VALID_CONVID); | ||
} | ||
|
||
@Test | ||
void testPointValidSession() { | ||
CICSTestUtils.noErrorTest(POINT_VALID_SESSION); | ||
} | ||
|
||
@Test | ||
void testPointInvalidDuplicateSession() { | ||
CICSTestUtils.errorTest( | ||
POINT_INVALID_DUPLICATE_SESSION, | ||
ImmutableMap.of( | ||
"errorOne", | ||
new Diagnostic( | ||
new Range(), | ||
"Excessive options provided for: SESSION", | ||
DiagnosticSeverity.Error, | ||
ErrorSource.PARSING.getText()))); | ||
} | ||
|
||
@Test | ||
void testPointInvalidBothOptions() { | ||
CICSTestUtils.errorTest( | ||
POINT_INVALID_BOTH_OPTIONS, | ||
ImmutableMap.of( | ||
"errorOne", | ||
new Diagnostic( | ||
new Range(), | ||
"Exactly one option required, options are mutually exclusive: CONVID or SESSION", | ||
DiagnosticSeverity.Error, | ||
ErrorSource.PARSING.getText()), | ||
"errorTwo", | ||
new Diagnostic( | ||
new Range(), | ||
"Exactly one option required, options are mutually exclusive: CONVID or SESSION", | ||
DiagnosticSeverity.Error, | ||
ErrorSource.PARSING.getText()))); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.