Search in sources :

Example 1 with InstallerListener

use of com.izforge.izpack.api.event.InstallerListener 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();
}
Also used : InstallData(com.izforge.izpack.api.data.InstallData) ProgressListener(com.izforge.izpack.api.event.ProgressListener) InstallerListener(com.izforge.izpack.api.event.InstallerListener) File(java.io.File) Test(org.junit.jupiter.api.Test) AbstractRoboZonkyTest(com.github.robozonky.test.AbstractRoboZonkyTest)

Example 2 with InstallerListener

use of com.izforge.izpack.api.event.InstallerListener in project robozonky by RoboZonky.

the class RoboZonkyInstallerListenerTest method progressUnix.

@Test
void progressUnix() {
    final ProgressListener progress = mock(ProgressListener.class);
    // execute SUT
    RoboZonkyInstallerListener.setInstallData(data);
    final InstallerListener listener = new RoboZonkyInstallerListener(RoboZonkyInstallerListener.OS.LINUX);
    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.bat")).doesNotExist();
        softly.assertThat(new File(RoboZonkyInstallerListener.INSTALL_PATH, "robozonky-exec.sh")).exists().has(new Condition<>(File::canExecute, "Is executable"));
        softly.assertThat(new File(RoboZonkyInstallerListener.INSTALL_PATH, "robozonky-systemd.service")).exists();
        softly.assertThat(new File(RoboZonkyInstallerListener.INSTALL_PATH, "robozonky-upstart.conf")).exists();
        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();
}
Also used : ProgressListener(com.izforge.izpack.api.event.ProgressListener) InstallerListener(com.izforge.izpack.api.event.InstallerListener) File(java.io.File) Test(org.junit.jupiter.api.Test) AbstractRoboZonkyTest(com.github.robozonky.test.AbstractRoboZonkyTest)

Aggregations

AbstractRoboZonkyTest (com.github.robozonky.test.AbstractRoboZonkyTest)2 InstallerListener (com.izforge.izpack.api.event.InstallerListener)2 ProgressListener (com.izforge.izpack.api.event.ProgressListener)2 File (java.io.File)2 Test (org.junit.jupiter.api.Test)2 InstallData (com.izforge.izpack.api.data.InstallData)1