use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class RoboZonkyInstallerListenerTest method progressWindows.
@Test
void progressWindows() {
final ProgressListener progress = mock(ProgressListener.class);
final InstallData localData = RoboZonkyInstallerListenerTest.mockData();
// execute SUT
RoboZonkyInstallerListener.setInstallData(localData);
final InstallerListener listener = new RoboZonkyInstallerListener(RoboZonkyInstallerListener.OS.WINDOWS);
listener.afterPacks(Collections.emptyList(), progress);
// test
assertSoftly(softly -> {
softly.assertThat(new File(RoboZonkyInstallerListener.INSTALL_PATH, "logback.xml")).exists();
softly.assertThat(new File(RoboZonkyInstallerListener.INSTALL_PATH, "robozonky.properties")).exists();
softly.assertThat(new File(RoboZonkyInstallerListener.INSTALL_PATH, "robozonky.cli")).exists();
softly.assertThat(new File(RoboZonkyInstallerListener.INSTALL_PATH, "robozonky-exec.sh")).doesNotExist();
softly.assertThat(new File(RoboZonkyInstallerListener.INSTALL_PATH, "robozonky-exec.bat")).exists().has(new Condition<>(File::canExecute, "Is executable"));
softly.assertThat(new File(RoboZonkyInstallerListener.INSTALL_PATH, "robozonky-systemd.service")).doesNotExist();
softly.assertThat(new File(RoboZonkyInstallerListener.INSTALL_PATH, "robozonky-upstart.conf")).doesNotExist();
softly.assertThat(RoboZonkyInstallerListener.CLI_CONFIG_FILE).exists();
});
verify(progress, times(1)).startAction(anyString(), anyInt());
verify(progress, times(7)).nextStep(anyString(), anyInt(), eq(1));
verify(progress, times(1)).stopAction();
}
use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class RoboZonkyInstallerListenerTest method coreWithoutKeyStore.
@Test
void coreWithoutKeyStore() {
// prepare
final InstallData localData = RoboZonkyInstallerListenerTest.mockData();
when(localData.getVariable(Variables.IS_ZONKOID_ENABLED.getKey())).thenReturn("true");
when(localData.getVariable(Variables.ZONKOID_TOKEN.getKey())).thenReturn("123456");
RoboZonkyInstallerListener.setInstallData(localData);
// execute SUT
final CommandLinePart clp = new RoboZonkyInstallerListener().prepareCore(null);
// test
assertSoftly(softly -> {
softly.assertThat(clp.getOptions()).doesNotContainKey("-d").doesNotContainKey("-r").doesNotContainKey("-g");
softly.assertThat(clp.getOptions().get("-u")).containsOnly(localData.getVariable(Variables.ZONKY_USERNAME.getKey()));
softly.assertThat(clp.getOptions().get("-x")).containsOnly("zonkoid:" + localData.getVariable(Variables.ZONKOID_TOKEN.getKey()));
softly.assertThat(clp.getOptions().get("-p")).containsOnly(data.getVariable(Variables.ZONKY_PASSWORD.getKey()));
});
}
use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class RoboZonkyInstallerListenerTest method coreWithTweaks.
@Test
void coreWithTweaks() {
// prepare
final InstallData localData = RoboZonkyInstallerListenerTest.mockData();
when(localData.getVariable(Variables.IS_DRY_RUN.getKey())).thenReturn("true");
when(localData.getVariable(Variables.IS_ZONKOID_ENABLED.getKey())).thenReturn("true");
when(localData.getVariable(Variables.ZONKOID_TOKEN.getKey())).thenReturn("123456");
RoboZonkyInstallerListener.setInstallData(localData);
// execute SUT
final CommandLinePart clp = new RoboZonkyInstallerListener().prepareCore();
// test
assertSoftly(softly -> {
softly.assertThat(clp.getOptions()).containsKey("-d").containsKey("-x");
softly.assertThat(clp.getOptions().get("-p")).containsOnly(String.valueOf(RoboZonkyInstallerListener.KEYSTORE_PASSWORD));
});
}
use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class RoboZonkyInstallerListenerTest method emailDisabled.
@Test
void emailDisabled() {
// prepare
final InstallData data = RoboZonkyInstallerListenerTest.mockBaseData();
when(data.getVariable(Variables.IS_EMAIL_ENABLED.getKey())).thenReturn("false");
RoboZonkyInstallerListener.setInstallData(data);
// execute SUT
final CommandLinePart clp = new RoboZonkyInstallerListener().prepareEmailConfiguration();
// test
assertSoftly(softly -> {
softly.assertThat(clp.getProperties()).isEmpty();
softly.assertThat(RoboZonkyInstallerListener.EMAIL_CONFIG_FILE).doesNotExist();
});
}
use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class RoboZonkyInstallerListenerTest method strategyUrl.
@Test
void strategyUrl() {
// prepare
final InstallData localData = RoboZonkyInstallerListenerTest.mockBaseData();
when(localData.getVariable(Variables.STRATEGY_TYPE.getKey())).thenReturn("url");
when(localData.getVariable(Variables.STRATEGY_SOURCE.getKey())).thenReturn("http://www.robozonky.cz");
RoboZonkyInstallerListener.setInstallData(localData);
// execute SUT
final CommandLinePart clp = new RoboZonkyInstallerListener().prepareStrategy();
// test
assertSoftly(softly -> {
softly.assertThat(clp.getOptions()).containsKey("-s");
final File newStrat = new File(data.getVariable(Variables.INSTALL_PATH.getKey()), "robozonky-strategy.cfg");
softly.assertThat(newStrat).doesNotExist();
});
}
Aggregations