use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class EmailSettingsValidatorTest method mailFailed.
@Test
void mailFailed() {
final InstallData data = mock(InstallData.class);
when(data.getVariable(eq(Variables.SMTP_PORT.getKey()))).thenReturn(String.valueOf(EMAIL.getSmtp().getPort()));
when(data.getVariable(eq(Variables.SMTP_HOSTNAME.getKey()))).thenReturn(String.valueOf(EMAIL.getSmtp().getBindTo()));
when(data.getVariable(eq(Variables.SMTP_USERNAME.getKey()))).thenReturn("sender@server.cz");
when(data.getVariable(eq(Variables.SMTP_PASSWORD.getKey()))).thenReturn(UUID.randomUUID().toString());
final DataValidator validator = new EmailSettingsValidator();
final DataValidator.Status result = validator.validateData(data);
assertThat(result).isEqualTo(DataValidator.Status.WARNING);
assertThat(EMAIL.getReceivedMessages()).hasSize(0);
}
use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class EmailSettingsValidatorTest method mailSent.
@Test
void mailSent() {
final InstallData data = mock(InstallData.class);
when(data.getVariable(eq(Variables.ZONKY_USERNAME.getKey()))).thenReturn("someone@somewhere.cz");
when(data.getVariable(eq(Variables.SMTP_PORT.getKey()))).thenReturn(String.valueOf(EMAIL.getSmtp().getPort()));
when(data.getVariable(eq(Variables.SMTP_HOSTNAME.getKey()))).thenReturn(String.valueOf(EMAIL.getSmtp().getBindTo()));
when(data.getVariable(eq(Variables.SMTP_TO.getKey()))).thenReturn("recipient@server.cz");
when(data.getVariable(eq(Variables.SMTP_USERNAME.getKey()))).thenReturn("sender@server.cz");
when(data.getVariable(eq(Variables.SMTP_PASSWORD.getKey()))).thenReturn(UUID.randomUUID().toString());
final DataValidator validator = new EmailSettingsValidator();
final DataValidator.Status result = validator.validateData(data);
assertThat(result).isEqualTo(DataValidator.Status.OK);
}
use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class InstallDirValidatorTest method wrongDir.
@Test
void wrongDir() {
final InstallData d = InstallDirValidatorTest.mockBaseData("C:\\Program Files\\RoboZonky\\4.0.0-SNAPSHOT");
final InstallDirValidator v = new InstallDirValidator();
assertThat(v.validateData(d)).isEqualTo(DataValidator.Status.ERROR);
assertThat(v.getErrorMessageId()).isNotEmpty();
}
use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class RoboZonkyInstallerListenerTest method mockData.
private static InstallData mockData() {
final InstallData data = RoboZonkyInstallerListenerTest.mockBaseData();
when(data.getVariable(Variables.STRATEGY_TYPE.getKey())).thenReturn("file");
when(data.getVariable(Variables.STRATEGY_SOURCE.getKey())).thenReturn(RoboZonkyInstallerListenerTest.newFile(true).getAbsolutePath());
when(data.getVariable(Variables.ZONKY_USERNAME.getKey())).thenReturn(RoboZonkyInstallerListenerTest.ZONKY_USERNAME);
when(data.getVariable(Variables.ZONKY_PASSWORD.getKey())).thenReturn(RoboZonkyInstallerListenerTest.ZONKY_PASSWORD);
when(data.getVariable(Variables.IS_EMAIL_ENABLED.getKey())).thenReturn("true");
when(data.getVariable(Variables.SMTP_HOSTNAME.getKey())).thenReturn("127.0.0.1");
when(data.getVariable(Variables.SMTP_TO.getKey())).thenReturn("recipient@server.cz");
when(data.getVariable(Variables.SMTP_USERNAME.getKey())).thenReturn("sender@server.cz");
when(data.getVariable(Variables.SMTP_PASSWORD.getKey())).thenReturn(UUID.randomUUID().toString());
return data;
}
use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class RoboZonkyInstallerListenerTest method mockBaseData.
private static InstallData mockBaseData() {
final InstallData data = mock(InstallData.class);
when(data.getVariable(Variables.INSTALL_PATH.getKey())).thenReturn(new File("target/install").getAbsolutePath());
return data;
}
Aggregations