@Test public void testSuccessfulCollection() throws CloudbreakOrchestratorFailedException { FingerprintsResponse response = new FingerprintsResponse(); response.setStatusCode(HttpStatus.OK.value()); Fingerprint fp = new Fingerprint(); fp.setAddress("1.1.1.1"); fp.setFingerprint("asdf"); Fingerprint fp2 = new Fingerprint(); fp2.setAddress("1.1.1.2"); fp2.setFingerprint("gfsd"); response.setFingerprints(List.of(fp, fp2)); when(sc.collectFingerPrints(any(FingerprintRequest.class))).thenReturn(response); Minion m1 = new Minion(); m1.setAddress("1.1.1.1"); m1.setHostName("m1"); m1.setDomain("domain"); Minion m2 = new Minion(); m2.setAddress("1.1.1.2"); m2.setHostName("m2"); m2.setDomain("domain"); FingerprintsResponse result = underTest.collectFingerprintFromMinions(sc, List.of(m1, m2)); assertEquals(response, result); }
public FingerprintsResponse collectFingerprintFromMinions(SaltConnector sc, List<Minion> minionsToAccept) throws CloudbreakOrchestratorFailedException { FingerprintsResponse fingerprintsResponse; try { fingerprintsResponse = sc.collectFingerPrints(new FingerprintRequest(minionsToAccept)); } catch (Exception e) { LOGGER.error("Couldn't collect fingerprints for minions: {}", minionsToAccept, e); throw new CloudbreakOrchestratorFailedException("Couldn't collect fingerprints for minions", e); } validateFingerprintResponse(minionsToAccept, fingerprintsResponse); return fingerprintsResponse; }
FingerprintFromSbCollector implements FingerprintCollector { public FingerprintsResponse collectFingerprintFromMinions(SaltConnector sc, List<Minion> minionsToAccept) throws CloudbreakOrchestratorFailedException { FingerprintsResponse fingerprintsResponse; try { fingerprintsResponse = sc.collectFingerPrints(new FingerprintRequest(minionsToAccept)); } catch (Exception e) { LOGGER.error("Couldn't collect fingerprints for minions: {}", minionsToAccept, e); throw new CloudbreakOrchestratorFailedException("Couldn't collect fingerprints for minions", e); } validateFingerprintResponse(minionsToAccept, fingerprintsResponse); return fingerprintsResponse; } }
FingerprintFromSbCollector implements FingerprintCollector { public FingerprintsResponse collectFingerprintFromMinions(SaltConnector sc, List<Minion> minionsToAccept) throws CloudbreakOrchestratorFailedException { FingerprintsResponse fingerprintsResponse; try { fingerprintsResponse = sc.collectFingerPrints(new FingerprintRequest(minionsToAccept)); } catch (Exception e) { LOGGER.error("Couldn't collect fingerprints for minions: {}", minionsToAccept, e); throw new CloudbreakOrchestratorFailedException("Couldn't collect fingerprints for minions", e); } validateFingerprintResponse(minionsToAccept, fingerprintsResponse); return fingerprintsResponse; }  }
FingerprintFromSbCollector implements FingerprintCollector { public FingerprintsResponse collectFingerprintFromMinions(SaltConnector sc, List<Minion> minionsToAccept) throws CloudbreakOrchestratorFailedException { FingerprintsResponse fingerprintsResponse; try { fingerprintsResponse = sc.collectFingerPrints(new FingerprintRequest(minionsToAccept)); } catch (Exception e) { LOGGER.error("Couldn't collect fingerprints for minions: {}", minionsToAccept, e); throw new CloudbreakOrchestratorFailedException("Couldn't collect fingerprints for minions", e); } validateFingerprintResponse(minionsToAccept, fingerprintsResponse); return fingerprintsResponse; }  FingerprintsResponse collectFingerprintFromMinions(SaltConnector sc, List<Minion> minionsToAccept); }
FingerprintFromSbCollector implements FingerprintCollector { public FingerprintsResponse collectFingerprintFromMinions(SaltConnector sc, List<Minion> minionsToAccept) throws CloudbreakOrchestratorFailedException { FingerprintsResponse fingerprintsResponse; try { fingerprintsResponse = sc.collectFingerPrints(new FingerprintRequest(minionsToAccept)); } catch (Exception e) { LOGGER.error("Couldn't collect fingerprints for minions: {}", minionsToAccept, e); throw new CloudbreakOrchestratorFailedException("Couldn't collect fingerprints for minions", e); } validateFingerprintResponse(minionsToAccept, fingerprintsResponse); return fingerprintsResponse; }  FingerprintsResponse collectFingerprintFromMinions(SaltConnector sc, List<Minion> minionsToAccept);  }