@Test void testLinkWithPassword() { CassandraConnection cassandraConnection = new CassandraConnection.Builder().passwordId("123").build(); Bundle bundle = new Bundle(); bundle.addEntity(new StoredPassword.Builder().name("name").id("123").build()); linker.link(cassandraConnection, bundle, null); assertNotNull(cassandraConnection.getStoredPasswordName()); assertEquals("name", cassandraConnection.getStoredPasswordName()); }
@Override public void link(CassandraConnection entity, Bundle bundle, Bundle targetBundle) { if (entity.getPasswordId() == null) { return; } StoredPassword storedPassword = bundle.getEntities(StoredPassword.class).values().stream().filter(s -> entity.getPasswordId().equals(s.getId())).findFirst().orElse(null); if (storedPassword == null) { throw new LinkerException("Could not find Stored Password for Cassandra Connection: " + entity.getName() + ". Password ID: " + entity.getPasswordId()); } entity.setStoredPasswordName(storedPassword.getName()); }
CassandraConnectionLinker implements EntityLinker<CassandraConnection> { @Override public void link(CassandraConnection entity, Bundle bundle, Bundle targetBundle) { if (entity.getPasswordId() == null) { return; } StoredPassword storedPassword = bundle.getEntities(StoredPassword.class).values().stream().filter(s -> entity.getPasswordId().equals(s.getId())).findFirst().orElse(null); if (storedPassword == null) { throw new LinkerException("Could not find Stored Password for Cassandra Connection: " + entity.getName() + ". Password ID: " + entity.getPasswordId()); } entity.setStoredPasswordName(storedPassword.getName()); } }
CassandraConnectionLinker implements EntityLinker<CassandraConnection> { @Override public void link(CassandraConnection entity, Bundle bundle, Bundle targetBundle) { if (entity.getPasswordId() == null) { return; } StoredPassword storedPassword = bundle.getEntities(StoredPassword.class).values().stream().filter(s -> entity.getPasswordId().equals(s.getId())).findFirst().orElse(null); if (storedPassword == null) { throw new LinkerException("Could not find Stored Password for Cassandra Connection: " + entity.getName() + ". Password ID: " + entity.getPasswordId()); } entity.setStoredPasswordName(storedPassword.getName()); }  }
CassandraConnectionLinker implements EntityLinker<CassandraConnection> { @Override public void link(CassandraConnection entity, Bundle bundle, Bundle targetBundle) { if (entity.getPasswordId() == null) { return; } StoredPassword storedPassword = bundle.getEntities(StoredPassword.class).values().stream().filter(s -> entity.getPasswordId().equals(s.getId())).findFirst().orElse(null); if (storedPassword == null) { throw new LinkerException("Could not find Stored Password for Cassandra Connection: " + entity.getName() + ". Password ID: " + entity.getPasswordId()); } entity.setStoredPasswordName(storedPassword.getName()); }  @Override void link(CassandraConnection entity, Bundle bundle, Bundle targetBundle); @Override Class<CassandraConnection> getEntityClass(); }
CassandraConnectionLinker implements EntityLinker<CassandraConnection> { @Override public void link(CassandraConnection entity, Bundle bundle, Bundle targetBundle) { if (entity.getPasswordId() == null) { return; } StoredPassword storedPassword = bundle.getEntities(StoredPassword.class).values().stream().filter(s -> entity.getPasswordId().equals(s.getId())).findFirst().orElse(null); if (storedPassword == null) { throw new LinkerException("Could not find Stored Password for Cassandra Connection: " + entity.getName() + ". Password ID: " + entity.getPasswordId()); } entity.setStoredPasswordName(storedPassword.getName()); }  @Override void link(CassandraConnection entity, Bundle bundle, Bundle targetBundle); @Override Class<CassandraConnection> getEntityClass();  }