@Test public void testSkipEnvset() throws Exception { final TerminalProperties terminalProperties = TerminalProperties.getNewBuilder() .setOsPromptPattern("osPromptPattern").setSkipEnvset(true).build(); mockStatic(TerminalProperties.class); when(TerminalProperties.getGlobalTerminalProperties()).thenReturn(terminalProperties); final ArgumentCaptor<TerminalProperties> captorTerminalProperties = ArgumentCaptor .forClass(TerminalProperties.class); Environment.getEnvironment(); verify(sshTerminal, times(1)).executeCommandGroups(argumentCaptorCommandExpectationGroupList.capture()); final List<List<CommandExpectationGroup>> commandExpectationsGroupsList = argumentCaptorCommandExpectationGroupList .getAllValues(); assertThat(commandExpectationsGroupsList.size()).isEqualTo(1); for (List<CommandExpectationGroup> commandExpectationsGroups : commandExpectationsGroupsList) { for (CommandExpectationGroup commandExpectationsGroup : commandExpectationsGroups) { for (String command : commandExpectationsGroup.getCommands()) { assertThat(command).doesNotContain("envset"); } } } }
public static Environment getEnvironment() { final BackendNodePrincipal principal = JaasUtils.getPrincipal(BackendNodePrincipal.class); final String environmentName = principal.getEnvironmentName(); if (environmentName == null) { throw new NullPointerException("Environment name cannot be null."); } if (StringUtils.isBlank(environmentName)) { throw new IllegalArgumentException("Environment name cannot be blank."); } final String normalizedName = environmentName.toLowerCase(Locale.getDefault()); if (CACHE.containsKey(normalizedName)) { return CACHE.get(normalizedName); } final Environment env = new Environment(environmentName); CACHE.put(normalizedName, env); return env; }
Environment { public static Environment getEnvironment() { final BackendNodePrincipal principal = JaasUtils.getPrincipal(BackendNodePrincipal.class); final String environmentName = principal.getEnvironmentName(); if (environmentName == null) { throw new NullPointerException("Environment name cannot be null."); } if (StringUtils.isBlank(environmentName)) { throw new IllegalArgumentException("Environment name cannot be blank."); } final String normalizedName = environmentName.toLowerCase(Locale.getDefault()); if (CACHE.containsKey(normalizedName)) { return CACHE.get(normalizedName); } final Environment env = new Environment(environmentName); CACHE.put(normalizedName, env); return env; } }
Environment { public static Environment getEnvironment() { final BackendNodePrincipal principal = JaasUtils.getPrincipal(BackendNodePrincipal.class); final String environmentName = principal.getEnvironmentName(); if (environmentName == null) { throw new NullPointerException("Environment name cannot be null."); } if (StringUtils.isBlank(environmentName)) { throw new IllegalArgumentException("Environment name cannot be blank."); } final String normalizedName = environmentName.toLowerCase(Locale.getDefault()); if (CACHE.containsKey(normalizedName)) { return CACHE.get(normalizedName); } final Environment env = new Environment(environmentName); CACHE.put(normalizedName, env); return env; } Environment(final String environmentName); }
Environment { public static Environment getEnvironment() { final BackendNodePrincipal principal = JaasUtils.getPrincipal(BackendNodePrincipal.class); final String environmentName = principal.getEnvironmentName(); if (environmentName == null) { throw new NullPointerException("Environment name cannot be null."); } if (StringUtils.isBlank(environmentName)) { throw new IllegalArgumentException("Environment name cannot be blank."); } final String normalizedName = environmentName.toLowerCase(Locale.getDefault()); if (CACHE.containsKey(normalizedName)) { return CACHE.get(normalizedName); } final Environment env = new Environment(environmentName); CACHE.put(normalizedName, env); return env; } Environment(final String environmentName); static Environment getEnvironment(); String getCclSource(); String getCclUserDir(); String getCerInstall(); String getCerProc(); String getCerTemp(); String getEnvironmentName(); }
Environment { public static Environment getEnvironment() { final BackendNodePrincipal principal = JaasUtils.getPrincipal(BackendNodePrincipal.class); final String environmentName = principal.getEnvironmentName(); if (environmentName == null) { throw new NullPointerException("Environment name cannot be null."); } if (StringUtils.isBlank(environmentName)) { throw new IllegalArgumentException("Environment name cannot be blank."); } final String normalizedName = environmentName.toLowerCase(Locale.getDefault()); if (CACHE.containsKey(normalizedName)) { return CACHE.get(normalizedName); } final Environment env = new Environment(environmentName); CACHE.put(normalizedName, env); return env; } Environment(final String environmentName); static Environment getEnvironment(); String getCclSource(); String getCclUserDir(); String getCerInstall(); String getCerProc(); String getCerTemp(); String getEnvironmentName();  }