@Test void build() { Bundle bundle = new Bundle(); bundle.putAllPrivateKeys(ImmutableMap.of("test", createPrivateKey())); PrivateKeyEntityBuilder builder = new PrivateKeyEntityBuilder(keystoreHelper); final List<Entity> entities = builder.build(bundle, BundleType.ENVIRONMENT, INSTANCE.getDocumentBuilder().newDocument()); assertNotNull(entities); assertFalse(entities.isEmpty()); assertEquals(1, entities.size()); Entity entity = entities.get(0); assertEquals(EntityTypes.PRIVATE_KEY_TYPE, entity.getType()); Assertions.assertEquals(KeyStoreType.GENERIC.generateKeyId("test"), entity.getId()); assertEquals("test", entity.getName()); }
@Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { Map<String, PrivateKey> privateKeyMap = Optional.ofNullable(bundle.getPrivateKeys()).orElse(Collections.emptyMap()); return buildEntities(bundle, bundleType, privateKeyMap, document); }
PrivateKeyEntityBuilder implements EntityBuilder { @Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { Map<String, PrivateKey> privateKeyMap = Optional.ofNullable(bundle.getPrivateKeys()).orElse(Collections.emptyMap()); return buildEntities(bundle, bundleType, privateKeyMap, document); } }
PrivateKeyEntityBuilder implements EntityBuilder { @Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { Map<String, PrivateKey> privateKeyMap = Optional.ofNullable(bundle.getPrivateKeys()).orElse(Collections.emptyMap()); return buildEntities(bundle, bundleType, privateKeyMap, document); } @Inject  PrivateKeyEntityBuilder(final KeystoreHelper keystoreHelper); }
PrivateKeyEntityBuilder implements EntityBuilder { @Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { Map<String, PrivateKey> privateKeyMap = Optional.ofNullable(bundle.getPrivateKeys()).orElse(Collections.emptyMap()); return buildEntities(bundle, bundleType, privateKeyMap, document); } @Inject  PrivateKeyEntityBuilder(final KeystoreHelper keystoreHelper); @Override List<Entity> build(Bundle bundle, BundleType bundleType, Document document); @Override @NotNull Integer getOrder(); }
PrivateKeyEntityBuilder implements EntityBuilder { @Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { Map<String, PrivateKey> privateKeyMap = Optional.ofNullable(bundle.getPrivateKeys()).orElse(Collections.emptyMap()); return buildEntities(bundle, bundleType, privateKeyMap, document); } @Inject  PrivateKeyEntityBuilder(final KeystoreHelper keystoreHelper); @Override List<Entity> build(Bundle bundle, BundleType bundleType, Document document); @Override @NotNull Integer getOrder();  }