Skip to content

Commit

Permalink
Java17 (#1417)
Browse files Browse the repository at this point in the history
* java 17 changes

* java 17 changes

* add fixes

---------

Co-authored-by: GIlca <[email protected]>
Co-authored-by: Larisa Bratean <[email protected]>
Co-authored-by: Larisa Bratean <[email protected]>
  • Loading branch information
4 people authored Jul 29, 2024
1 parent 6d919d6 commit 952e53a
Show file tree
Hide file tree
Showing 26 changed files with 91 additions and 27 deletions.
8 changes: 8 additions & 0 deletions cloudslang-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
Expand All @@ -100,6 +101,7 @@
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>

<dependency>
Expand Down Expand Up @@ -140,6 +142,7 @@
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<scope>test</scope>
</dependency>

<!-- liquibase : this is only for fixing liquibase logging issue -->
Expand All @@ -153,6 +156,11 @@
<artifactId>liquibase-slf4j</artifactId>
</dependency>

<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.springframework.beans.factory.DisposableBean;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.springframework.shell.Bootstrap;
Expand All @@ -21,6 +22,7 @@
import static org.powermock.api.mockito.PowerMockito.mockStatic;

@RunWith(PowerMockRunner.class)
@PowerMockIgnore("jdk.internal.reflect.*")
@PrepareForTest({SlangBootstrap.class, Bootstrap.class})
public class SlangBootstrapTest {

Expand Down
5 changes: 5 additions & 0 deletions cloudslang-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

<dependencies>

<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.DisposableBean;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;
import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ThreadPoolExecutor;
Expand Down
6 changes: 6 additions & 0 deletions cloudslang-compiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</dependency>

<dependency>
<groupId>${score.group}</groupId>
<artifactId>score-api</artifactId>
Expand Down Expand Up @@ -96,6 +101,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<scope>test</scope>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.concurrent.TimeUnit;
import org.apache.commons.codec.digest.DigestUtils;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;

public class CachedPrecompileServiceImpl implements CachedPrecompileService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public List<RuntimeException> validateSlangModelWithDirectDependencies(Executabl
*
* @param executable the executable to create an {@link io.cloudslang.score.api.ExecutionPlan} for
* @return {@link io.cloudslang.score.api.ExecutionPlan} of the given
* {@link io.cloudslang.lang.compiler.modeller.model.Executable}
*{@link io.cloudslang.lang.compiler.modeller.model.Executable}
*/
private ExecutionPlan compileToExecutionPlan(Executable executable) {

Expand Down
1 change: 1 addition & 0 deletions cloudslang-content-maven-compiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
<version>2.2.0</version>
<executions>
<execution>
<goals>
Expand Down
7 changes: 7 additions & 0 deletions cloudslang-content-verifier/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
<artifactId>score-all</artifactId>
</dependency>

<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
Expand Down Expand Up @@ -162,11 +167,13 @@
<dependency>
<groupId>org.python</groupId>
<artifactId>jython-standalone</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<scope>test</scope>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ private void processActiveTest(final BulkRunMode bulkRunMode, final Map<TestCase
if (bulkRunMode == BulkRunMode.POSSIBLY_MIXED) {
TestCaseRunMode runModeForTestCase = testRunInfoService
.getRunModeForTestCase(testCase, new RunMultipleTestSuiteConflictResolutionStrategy(),
new SequentialRunTestSuiteResolutionStrategy());
new SequentialRunTestSuiteResolutionStrategy());
if (runModeForTestCase == TestCaseRunMode.SEQUENTIAL) {
resultMap.get(TestCaseRunState.SEQUENTIAL).put(testCaseEntry.getKey(), testCase);
} else if (runModeForTestCase == TestCaseRunMode.PARALLEL) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.concurrent.Future;
import org.springframework.beans.factory.DisposableBean;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;

import static java.lang.Integer.parseInt;
import static java.lang.String.valueOf;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import io.cloudslang.lang.tools.build.tester.parallel.testcaseevents.SlangTestCaseEvent;
import org.apache.commons.lang3.event.EventListenerSupport;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;

public class TestCaseEventDispatchService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.cloudslang.lang.tools.build.tester.runconfiguration.strategy.ConflictResolutionStrategy;
import io.cloudslang.lang.tools.build.tester.runconfiguration.strategy.DefaultResolutionStrategy;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ public void testCaseFileParsingForNonTestCasesFile() throws Exception {
RuntimeException exception = assertThrows(RuntimeException.class, () ->
parser.parseTestCases(SlangSource.fromFile(fileUri)));
Assert.assertEquals("There was a problem parsing the YAML source: properties.prop.sl.\n" +
"java.lang.String cannot be cast to java.util.Map", exception.getMessage());
"class java.lang.String cannot be cast to class java.util.Map " +
"(java.lang.String and java.util.Map are in module java.base of loader 'bootstrap')",
exception.getMessage());
}

@Test
Expand Down
8 changes: 8 additions & 0 deletions cloudslang-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<groupId>${project.groupId}</groupId>
<artifactId>cloudslang-spi</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<dependency>
Expand Down Expand Up @@ -62,6 +63,11 @@
<artifactId>guava</artifactId>
</dependency>

<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</dependency>

<dependency>
<groupId>org.python</groupId>
<artifactId>jython-standalone</artifactId>
Expand All @@ -85,11 +91,13 @@
<dependency>
<groupId>${score.group}</groupId>
<artifactId>dependency-management-api</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>${score.group}</groupId>
<artifactId>dependency-management-impl</artifactId>
<scope>test</scope>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.python.core.PyObject;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {RunEnvironmentSensitiveTest.RunEnvironmentSensitiveValueTestConfig.class,
SlangEntitiesSpringConfig.class})
SlangEntitiesSpringConfig.class})
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public class RunEnvironmentSensitiveTest {
private static final String ENCYPTED = "{Encrypted}";
private static final String ENCRYPTED = "{Encrypted}";
private static final String OBFUSCATED = "{Obfuscated}";

@Test
Expand Down Expand Up @@ -233,7 +233,7 @@ public Encryption getTestEncryption() {

@Override
public String encrypt(char[] clearText) {
return ENCYPTED + new String(clearText);
return ENCRYPTED + new String(clearText);
}

@Override
Expand All @@ -248,12 +248,12 @@ public char[] deobfuscate(String cypherText) {

@Override
public char[] decrypt(String cypherText) {
return cypherText.substring(ENCYPTED.length()).toCharArray();
return cypherText.substring(ENCRYPTED.length()).toCharArray();
}

@Override
public boolean isTextEncrypted(String text) {
return text.startsWith(ENCYPTED);
return text.startsWith(ENCRYPTED);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public class ParallelLoopStepsTest {
private static final String BRANCH_EXCEPTION_MESSAGE = "Exception details placeholder";
private static final String SUCCESS_RESULT = "SUCCESS";

static {
System.setProperty("python.expressionsEval", "jython");
}

@Autowired
private ParallelLoopExecutionData parallelLoopSteps;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@
@ContextConfiguration(classes = StepExecutionDataTest.Config.class)
public class StepExecutionDataTest {

static {
System.setProperty("python.expressionsEval", "jython");
}

@Autowired
private StepExecutionData stepExecutionData;

Expand Down
Loading

0 comments on commit 952e53a

Please sign in to comment.