Skip to content

Commit 7c1cc6d

Browse files
authored
Merge pull request #32 from AutomateThePlanet/smpInternal
SMP Release
2 parents fb614e4 + d2bc948 commit 7c1cc6d

File tree

51 files changed

+923
-255
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+923
-255
lines changed

bellatrix.android/src/main/java/solutions/bellatrix/android/infrastructure/DriverService.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import io.appium.java_client.remote.MobileCapabilityType;
2020
import lombok.SneakyThrows;
2121
import org.openqa.selenium.MutableCapabilities;
22-
import org.openqa.selenium.Platform;
2322
import org.openqa.selenium.remote.DesiredCapabilities;
2423
import solutions.bellatrix.android.configuration.AndroidSettings;
2524
import solutions.bellatrix.android.configuration.GridSettings;
@@ -30,11 +29,10 @@
3029

3130
import java.io.IOException;
3231
import java.io.InputStream;
33-
import java.net.MalformedURLException;
3432
import java.net.URL;
33+
import java.time.Duration;
3534
import java.util.HashMap;
3635
import java.util.Properties;
37-
import java.util.concurrent.TimeUnit;
3836

3937
public class DriverService {
4038
private static final ThreadLocal<Boolean> DISPOSED;
@@ -84,7 +82,7 @@ public static AndroidDriver start(AppConfiguration configuration) {
8482
driver = initializeDriverGridMode(gridSettings.get(), testName);
8583
}
8684

87-
driver.manage().timeouts().implicitlyWait(androidSettings.getTimeoutSettings().getImplicitWaitTimeout(), TimeUnit.SECONDS);
85+
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(androidSettings.getTimeoutSettings().getImplicitWaitTimeout()));
8886
WRAPPED_ANDROID_DRIVER.set(driver);
8987
solutions.bellatrix.web.infrastructure.DriverService.setWrappedDriver(driver);
9088
return driver;

bellatrix.core/pom.xml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<version>1.0</version>
2525

2626
<properties>
27-
<selenium.version>4.8.1</selenium.version>
27+
<selenium.version>4.11.0</selenium.version>
2828
<appium.version>8.3.0</appium.version>
2929
<testng.version>7.7.0</testng.version>
3030
<junit.version>5.9.2</junit.version>
@@ -62,19 +62,16 @@
6262
<groupId>software.amazon.awssdk</groupId>
6363
<artifactId>textract</artifactId>
6464
</dependency>
65-
6665
<dependency>
6766
<groupId>com.opencsv</groupId>
6867
<artifactId>opencsv</artifactId>
6968
<version>5.7.1</version>
7069
</dependency>
71-
7270
<dependency>
7371
<groupId>com.mailslurp</groupId>
7472
<artifactId>mailslurp-client-java</artifactId>
7573
<version>15.17.1</version>
7674
</dependency>
77-
7875
<dependency>
7976
<groupId>commons-io</groupId>
8077
<artifactId>commons-io</artifactId>
@@ -83,7 +80,7 @@
8380
<dependency>
8481
<groupId>com.google.guava</groupId>
8582
<artifactId>guava</artifactId>
86-
<version>31.1-jre</version>
83+
<version>33.0.0-jre</version>
8784
</dependency>
8885
<dependency>
8986
<groupId>com.google.code.gson</groupId>
@@ -156,15 +153,5 @@
156153
<version>${rest.assured.version}</version>
157154
<scope>compile</scope>
158155
</dependency>
159-
<dependency>
160-
<groupId>com.azure</groupId>
161-
<artifactId>azure-security-keyvault-secrets</artifactId>
162-
<version>4.2.3</version>
163-
</dependency>
164-
<dependency>
165-
<groupId>com.azure</groupId>
166-
<artifactId>azure-identity</artifactId>
167-
<version>1.2.0</version>
168-
</dependency>
169156
</dependencies>
170157
</project>

bellatrix.core/src/main/java/solutions/bellatrix/core/assertions/EntitiesAsserter.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,32 @@ private static <TEntity> List<Exception> assertAreEqualsInternal(TEntity expecte
6161
try {
6262
currentExpectedProperty = expectedObject.getClass().getMethod(currentRealProperty.getName());
6363
} catch (NoSuchMethodException e) {
64-
failedAssertions.add(e);
64+
System.out.println(String.format("Property %s not found.", currentRealProperty));
65+
// failedAssertions.add(e);
6566
}
6667

6768
var exceptionMessage = "The property " + currentRealProperty.getName() + " of class " + realObject.getClass().getSimpleName() + " was not as expected.";
6869

6970
try {
7071
if (currentRealProperty.getReturnType() == LocalDateTime.class) {
7172
LocalDateTimeAssert.areEqual(
72-
(LocalDateTime) currentExpectedProperty.invoke(expectedObject),
73-
(LocalDateTime) currentRealProperty.invoke(realObject),
73+
(LocalDateTime)currentExpectedProperty.invoke(expectedObject),
74+
(LocalDateTime)currentRealProperty.invoke(realObject),
7475
deltaType, deltaQuantity, exceptionMessage);
7576
} else {
7677
Assertions.assertEquals(
7778
currentExpectedProperty.invoke(expectedObject),
7879
currentRealProperty.invoke(realObject),
7980
exceptionMessage);
8081
}
81-
82-
} catch (Exception ex) {
82+
}
83+
catch (NoSuchMethodException nsm){
84+
//ignore this case
85+
}
86+
catch (NullPointerException nsmex){
87+
//ignore this case
88+
}
89+
catch (Exception ex) {
8390
failedAssertions.add(ex);
8491
}
8592
}

bellatrix.core/src/main/java/solutions/bellatrix/core/configuration/ConfigurationService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
public final class ConfigurationService {
3131
private static String environment;
3232

33+
public static String getEnvironment() {
34+
return environment;
35+
}
36+
3337
public static <T> T get(Class<T> configSection) {
3438
T mappedObject = (T)new Object();
3539
if (environment == null) {

bellatrix.core/src/main/java/solutions/bellatrix/core/integrations/azure/KeyVault.java

Lines changed: 0 additions & 43 deletions
This file was deleted.

bellatrix.core/src/main/java/solutions/bellatrix/core/integrations/azure/SecretsResolver.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,10 @@ public static String getSecret(Supplier<String> getConfigValue) {
1010
return System.getenv(configValue.replace("env_", ""));
1111
}
1212

13-
if (configValue.startsWith("vault_")) {
14-
return KeyVault.getSecret(configValue.replace("vault_", ""));
15-
}
16-
1713
return configValue;
1814
}
1915

2016
public static String getSecret(String name) {
21-
if (KeyVault.isAvailable) {
22-
return KeyVault.getSecret(name);
23-
}
2417

2518
String environmentalVariable = System.getenv(name);
2619

bellatrix.core/src/main/java/solutions/bellatrix/core/plugins/PluginExecutionEngine.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
package solutions.bellatrix.core.plugins;
1515

1616
import java.lang.reflect.Method;
17-
import java.util.HashSet;
18-
import java.util.LinkedHashSet;
19-
import java.util.Set;
17+
import java.util.*;
2018

2119
public final class PluginExecutionEngine {
22-
private final static Set<Plugin> PLUGINS;
20+
private final static LinkedHashSet<Plugin> PLUGINS;
2321

2422
static {
2523
PLUGINS = new LinkedHashSet<>();

bellatrix.core/src/main/java/solutions/bellatrix/core/plugins/junit/BaseTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313

1414
package solutions.bellatrix.core.plugins.junit;
1515

16-
import org.junit.jupiter.api.AfterAll;
17-
import org.junit.jupiter.api.AfterEach;
18-
import org.junit.jupiter.api.BeforeEach;
19-
import org.junit.jupiter.api.TestInfo;
16+
import org.junit.jupiter.api.*;
2017
import org.junit.jupiter.api.extension.ExtendWith;
2118
import solutions.bellatrix.core.plugins.PluginExecutionEngine;
2219
import solutions.bellatrix.core.plugins.TestResult;
@@ -28,6 +25,7 @@
2825
import java.util.List;
2926

3027
@ExtendWith(TestResultWatcher.class)
28+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
3129
public class BaseTest extends UsesPlugins {
3230
static final ThreadLocal<TestResult> CURRENT_TEST_RESULT = new ThreadLocal<>();
3331
private static final ThreadLocal<Boolean> CONFIGURATION_EXECUTED = new ThreadLocal<>();
@@ -92,7 +90,7 @@ public void afterMethodCore(TestInfo testInfo) {
9290
try {
9391
var testClass = this.getClass();
9492
assert testInfo.getTestMethod().isPresent();
95-
var methodInfo = testClass.getMethod(testInfo.getTestMethod().get().getName());
93+
var methodInfo = testClass.getMethod(testInfo.getTestMethod().get().getName(), testInfo.getTestMethod().get().getParameterTypes());
9694
PluginExecutionEngine.preAfterTest(CURRENT_TEST_RESULT.get(), methodInfo);
9795
afterEach();
9896
// PluginExecutionEngine.postAfterTest(CURRENT_TEST_RESULT.get(), methodInfo);
@@ -103,11 +101,12 @@ public void afterMethodCore(TestInfo testInfo) {
103101
}
104102

105103
@AfterAll
106-
public static void afterClassCore(TestInfo testInfo) {
104+
public void afterClassCore(TestInfo testInfo) {
107105
try {
108106
var testClass = testInfo.getTestClass();
109107
if (testClass.isPresent()) {
110108
PluginExecutionEngine.preAfterClass(testClass.get());
109+
afterClass();
111110
PluginExecutionEngine.postAfterClass(testClass.get());
112111
}
113112
} catch (Exception e) {
@@ -134,4 +133,7 @@ protected void onBeforeEachFailure() {
134133

135134
protected void afterEach() {
136135
}
136+
137+
protected void afterClass() {
138+
}
137139
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package solutions.bellatrix.core.utilities;
2+
3+
import java.awt.*;
4+
import java.awt.datatransfer.*;
5+
import java.io.IOException;
6+
7+
public class ClipboardManager {
8+
private static final Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
9+
10+
public static String getLastEntity() {
11+
var lastCopiedEntity = "";
12+
13+
try {
14+
lastCopiedEntity = (String)systemClipboard.getData(DataFlavor.stringFlavor);
15+
} catch (IOException | UnsupportedFlavorException e) {
16+
throw new RuntimeException(e);
17+
}
18+
19+
return lastCopiedEntity;
20+
}
21+
22+
public static void copyTextToClipboard(String text) {
23+
Transferable transferable = new StringSelection(text);
24+
systemClipboard.setContents(transferable, null);
25+
}
26+
}

bellatrix.core/src/main/java/solutions/bellatrix/core/utilities/SingletonFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static <T> T getInstance(Class<T> classOf, Object... initargs) {
3636

3737
return (T)SINGLETON_FACTORY.mapHolder.get(classOf.getName());
3838
} catch (Exception e) {
39-
// not the best practice to return null. But probably we will never end here so it is OK.
39+
Log.error("Failed to create instance of the object. Exception was: " + e);
4040
return null;
4141
}
4242
}

0 commit comments

Comments
 (0)