use of org.sakuli.datamodel.properties.ActionProperties in project sakuli by ConSol.
the class CipherUtilsTest method testChipherException.
@Test
public void testChipherException() throws Throwable {
try {
ActionProperties props = new ActionProperties();
props.setEncryptionInterfaceAutodetect(false);
props.setEncryptionInterface("etNOVALID");
testling = new CipherUtil(props);
testling.scanNetworkInterfaces();
Assert.assertTrue(false, "Error, no exception is thrown");
} catch (SakuliCipherException e) {
Assert.assertNotNull(e.interfaceLog);
Assert.assertTrue(e.getMessage().contains(e.interfaceLog));
}
}
use of org.sakuli.datamodel.properties.ActionProperties in project sakuli by ConSol.
the class CipherUtilsTest method setUp.
@BeforeMethod
public void setUp() throws Throwable {
MockitoAnnotations.initMocks(this);
ActionProperties props = new ActionProperties();
props.setEncryptionInterfaceAutodetect(true);
testling = new CipherUtil(props);
testling.scanNetworkInterfaces();
}
use of org.sakuli.datamodel.properties.ActionProperties in project sakuli by ConSol.
the class SakuliStarter method encryptSecret.
/**
* Encrypt a secret based on the assigned interface.
*
* @param strToEncrypt secret to encrypt
* @param ethInterface name of network interface, if NULL use the auto-detection
* @return a Key-Value Pair of used interface for the encryption and the encrypted secret as strings.
* @throws SakuliCipherException
*/
public static Entry<String, String> encryptSecret(String strToEncrypt, String ethInterface) throws SakuliCipherException {
ActionProperties cipherProps = new ActionProperties();
if (isNotEmpty(ethInterface)) {
cipherProps.setEncryptionInterface(ethInterface);
cipherProps.setEncryptionInterfaceAutodetect(false);
} else {
cipherProps.setEncryptionInterfaceAutodetect(true);
}
CipherUtil cipher = new CipherUtil(cipherProps);
cipher.scanNetworkInterfaces();
return new AbstractMap.SimpleEntry<>(cipher.getInterfaceName(), cipher.encrypt(strToEncrypt));
}
use of org.sakuli.datamodel.properties.ActionProperties in project sakuli by ConSol.
the class ScreenBasedSettingsTest method testSetDefaults.
@Test(expectedExceptions = InvalidParameterException.class, expectedExceptionsMessageRegExp = "the property '" + ActionProperties.DEFAULT_HIGHLIGHT_SEC + "' has to be greater as 1, but was 0.6")
public void testSetDefaults() throws Exception {
ActionProperties props = new ActionProperties();
props.setDefaultHighlightSeconds(0.6f);
SakuliProperties sakuliProps = new SakuliProperties();
sakuliProps.setTessDataLibFolder(Paths.get("."));
ScreenBasedSettings testling = new ScreenBasedSettings(props, sakuliProps);
testling.setDefaults();
}
Aggregations