@Test public void testSshDetection() { doReturn(new HashMap<String, String>()).when(scoreSSHShellCommand).execute(any(SSHShellInputs.class)); OperatingSystemDetails toBeReturnedOsDetails = new OperatingSystemDetails(); toBeReturnedOsDetails.setArchitecture("xYZ"); toBeReturnedOsDetails.setFamily("b os fam"); toBeReturnedOsDetails.setName("b os"); toBeReturnedOsDetails.setVersion("ultimate"); doReturn(toBeReturnedOsDetails).when(osDetectorHelperService).processOutput(any(OperatingSystemDetails.class), anyMapOf(String.class, String.class), anyString()); OperatingSystemDetails actualOsDetails = sshOsDetectorService.detectOs(new OsDetectorInputs.Builder().build()); assertEquals("b os", actualOsDetails.getName()); assertEquals("xYZ", actualOsDetails.getArchitecture()); assertEquals("b os fam", actualOsDetails.getFamily()); assertEquals("ultimate", actualOsDetails.getVersion()); }
@Override public OperatingSystemDetails detectOs(OsDetectorInputs osDetectorInputs) { OperatingSystemDetails operatingSystemDetails = new OperatingSystemDetails(); Map<String, String> execute = scoreSSHShellCommand.execute(getSshShellInputs(osDetectorInputs)); return osDetectorHelperService.processOutput(operatingSystemDetails, execute, SSH); }
SshOsDetectorService implements OperatingSystemDetector { @Override public OperatingSystemDetails detectOs(OsDetectorInputs osDetectorInputs) { OperatingSystemDetails operatingSystemDetails = new OperatingSystemDetails(); Map<String, String> execute = scoreSSHShellCommand.execute(getSshShellInputs(osDetectorInputs)); return osDetectorHelperService.processOutput(operatingSystemDetails, execute, SSH); } }
SshOsDetectorService implements OperatingSystemDetector { @Override public OperatingSystemDetails detectOs(OsDetectorInputs osDetectorInputs) { OperatingSystemDetails operatingSystemDetails = new OperatingSystemDetails(); Map<String, String> execute = scoreSSHShellCommand.execute(getSshShellInputs(osDetectorInputs)); return osDetectorHelperService.processOutput(operatingSystemDetails, execute, SSH); } SshOsDetectorService(OsDetectorHelperService osDetectorHelperService, ScoreSSHShellCommand scoreSSHShellCommand); }
SshOsDetectorService implements OperatingSystemDetector { @Override public OperatingSystemDetails detectOs(OsDetectorInputs osDetectorInputs) { OperatingSystemDetails operatingSystemDetails = new OperatingSystemDetails(); Map<String, String> execute = scoreSSHShellCommand.execute(getSshShellInputs(osDetectorInputs)); return osDetectorHelperService.processOutput(operatingSystemDetails, execute, SSH); } SshOsDetectorService(OsDetectorHelperService osDetectorHelperService, ScoreSSHShellCommand scoreSSHShellCommand); @Override OperatingSystemDetails detectOs(OsDetectorInputs osDetectorInputs); }
SshOsDetectorService implements OperatingSystemDetector { @Override public OperatingSystemDetails detectOs(OsDetectorInputs osDetectorInputs) { OperatingSystemDetails operatingSystemDetails = new OperatingSystemDetails(); Map<String, String> execute = scoreSSHShellCommand.execute(getSshShellInputs(osDetectorInputs)); return osDetectorHelperService.processOutput(operatingSystemDetails, execute, SSH); } SshOsDetectorService(OsDetectorHelperService osDetectorHelperService, ScoreSSHShellCommand scoreSSHShellCommand); @Override OperatingSystemDetails detectOs(OsDetectorInputs osDetectorInputs);  }