/** * Returns the variable value. * * @return the variable value. May be {@code null} */ public String getValue() { final String savedValue = installData.getVariable(variable); if (savedValue == null && unprocessedValue != null) { unprocessedValue = null; } return (unprocessedValue==null ? savedValue : unprocessedValue); }
public String getValue(final InstallData installData) { return installData.getVariable(key); }
public String getValue(final InstallData installData) { return installData.getVariable(key); }
/** * Determines if the desktop shortcut checkbox is enabled. * * @return {@code true} if the desktop shortcut checkbox is enabled */ public boolean isDesktopShortcutCheckboxSelected() { return Boolean.valueOf(installData.getVariable("DesktopShortcutCheckboxEnabled")); }
public boolean isStartupShortcutCheckboxSelected() { return Boolean.valueOf(installData.getVariable("StartupShortcutCheckboxEnabled")); }
/** * MUST always be called in constructor of JDKPathConsolePanel and JDKPathPanel * @param installData */ public static void initialize(InstallData installData) { minVersion = installData.getVariable("JDKPathPanel.minVersion"); maxVersion = installData.getVariable("JDKPathPanel.maxVersion"); installData.setVariable(JDK_VAR_NAME, JDK_PATH); }
@Override public void createInstallationRecord(InstallData installData, IXMLElement rootElement) { String jdkVarName = installData.getVariable("jdkVarName"); String jdkPathName = installData.getVariable(jdkVarName); IXMLElement jdkPath = new XMLElementImpl("jdkPath", rootElement); jdkPath.setContent(jdkPathName); rootElement.addChild(jdkPath); IXMLElement jdkVar = new XMLElementImpl("jdkVarName", rootElement); jdkVar.setContent(jdkVarName); rootElement.addChild(jdkVar); }
private static InstallData mockInstallData() { final InstallData data = mock(InstallData.class); when(data.getVariable(eq(Variables.INSTALL_PATH.getKey()))) .thenReturn(new File("target/").getAbsolutePath()); return data; }
private static InstallData mockBaseData(final String installPath) { final InstallData data = mock(InstallData.class); when(data.getVariable(Variables.INSTALL_PATH.getKey())) .thenReturn(new File(installPath).getAbsolutePath()); return data; }
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; }
private static InstallData mockInstallData() { final InstallData d = mock(InstallData.class); when(d.getVariable(Variables.ZONKY_USERNAME.getKey())).thenReturn(ZonkySettingsValidatorTest.USERNAME); when(d.getVariable(Variables.ZONKY_PASSWORD.getKey())).thenReturn(ZonkySettingsValidatorTest.PASSWORD); return d; }
private static InstallData mockInstallData() { final InstallData d = mock(InstallData.class); when(d.getVariable(Variables.ZONKY_USERNAME.getKey())).thenReturn(ZonkoidSettingsValidatorTest.USER); when(d.getVariable(Variables.ZONKOID_TOKEN.getKey())).thenReturn(ZonkoidSettingsValidatorTest.TOKEN); return d; }
private static InstallData mockInstallData(final File f) { final InstallData data = StrategySettingsValidatorTest.mockInstallData(); when(data.getVariable(eq(Variables.STRATEGY_TYPE.getKey()))).thenReturn("file"); when(data.getVariable(eq(Variables.STRATEGY_SOURCE.getKey()))) .thenReturn(f.getAbsolutePath()); return data; }
private static InstallData mockInstallData(final URL u) { final InstallData data = StrategySettingsValidatorTest.mockInstallData(); when(data.getVariable(eq(Variables.STRATEGY_TYPE.getKey()))).thenReturn("url"); when(data.getVariable(eq(Variables.STRATEGY_SOURCE.getKey()))) .thenReturn(u.toExternalForm()); return data; }
@Override public boolean generateOptions(InstallData installData, Options options) { final String name =JDKPathPanelHelper.JDK_PATH; options.add(name, installData.getVariable(name)); options.addEmptyLine(name); options.putComment(name, Arrays.asList(getPanel().getPanelId())); return true; }
@Test void emailEnabledConfiguredFromURL() throws IOException { final URL f = File.createTempFile("robozonky-", ".tmp").toURI().toURL(); // prepare final InstallData localData = RoboZonkyInstallerListenerTest.mockData(); when(localData.getVariable(Variables.EMAIL_CONFIGURATION_TYPE.getKey())).thenReturn("url"); when(localData.getVariable(Variables.EMAIL_CONFIGURATION_SOURCE.getKey())).thenReturn(f.toExternalForm()); RoboZonkyInstallerListener.setInstallData(localData); // execute SUT final CommandLinePart clp = RoboZonkyInstallerListener.prepareEmailConfiguration(); assertThat(clp.getOptions()).containsOnlyKeys("-i"); }
@Test void readValue() { for (final Variables variable : Variables.values()) { final String key = variable.getKey(); final String value = UUID.randomUUID().toString(); final InstallData data = mock(InstallData.class); when(data.getVariable(key)).thenReturn(value); assertThat(variable.getValue(data)).isSameAs(value); } }
@Test void configuresGmail() { final InstallData data = mock(InstallData.class); when(data.getVariable(eq(Variables.EMAIL_CONFIGURATION_TYPE.getKey()))).thenReturn("gmail.com"); final DataValidator validator = new SimpleEmailServerValidator(); validator.validateData(data); // will fail, but that's OK here; we only care about the configuration aspect verify(data).setVariable(eq(Variables.IS_EMAIL_ENABLED.getKey()), eq("true")); verify(data).setVariable(eq(Variables.SMTP_AUTH.getKey()), eq("true")); verify(data).setVariable(eq(Variables.SMTP_IS_SSL.getKey()), eq("true")); verify(data).setVariable(eq(Variables.SMTP_IS_TLS.getKey()), eq("false")); verify(data).setVariable(eq(Variables.SMTP_PORT.getKey()), eq("465")); verify(data).setVariable(eq(Variables.SMTP_HOSTNAME.getKey()), eq("smtp.gmail.com")); }
@Test void configuresSeznam() { final InstallData data = mock(InstallData.class); when(data.getVariable(eq(Variables.EMAIL_CONFIGURATION_TYPE.getKey()))).thenReturn("seznam.cz"); final DataValidator validator = new SimpleEmailServerValidator(); validator.validateData(data); // will fail, but that's OK here; we only care about the configuration aspect verify(data).setVariable(eq(Variables.IS_EMAIL_ENABLED.getKey()), eq("true")); verify(data).setVariable(eq(Variables.SMTP_AUTH.getKey()), eq("true")); verify(data).setVariable(eq(Variables.SMTP_IS_SSL.getKey()), eq("true")); verify(data).setVariable(eq(Variables.SMTP_IS_TLS.getKey()), eq("false")); verify(data).setVariable(eq(Variables.SMTP_PORT.getKey()), eq("465")); verify(data).setVariable(eq(Variables.SMTP_HOSTNAME.getKey()), eq("smtp.seznam.cz")); }
@Test void strategyFile() { // prepare RoboZonkyInstallerListener.setInstallData(data); // execute SUT final CommandLinePart clp = 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).exists(); }); }