@Test void buildServicesWithoutPolicy() { ServiceEntityBuilder builder = new ServiceEntityBuilder(DocumentTools.INSTANCE, new IdGenerator()); Bundle bundle = new Bundle(projectInfo); Folder parentFolder = new Folder(); parentFolder.setId("asd"); parentFolder.setName("my"); parentFolder.setPath("my"); parentFolder.setParentFolder(Folder.ROOT_FOLDER); Folder serviceParentFolder = new Folder(); serviceParentFolder.setId("test"); serviceParentFolder.setName("policy"); serviceParentFolder.setPath("my/v1"); serviceParentFolder.setParentFolder(parentFolder); bundle.putAllFolders(new HashMap<String, Folder>() {{ put(parentFolder.getPath(), parentFolder); put(serviceParentFolder.getPath(), serviceParentFolder); put(Folder.ROOT_FOLDER.getPath(), Folder.ROOT_FOLDER); }}); Service service = new Service(); service.setHttpMethods(Stream.of("POST", "GET").collect(Collectors.toSet())); service.setUrl("/my/service/url"); service.setProperties(new HashMap<String, Object>() {{ put("key1", "value1"); put("key2", "value2"); }}); service.setName("path"); service.setParentFolder(serviceParentFolder); bundle.putAllServices(new HashMap<String, Service>() {{ put("/my/policy/path", service); }}); assertThrows(EntityBuilderException.class, () -> builder.build(bundle, EntityBuilder.BundleType.DEPLOYMENT, DocumentTools.INSTANCE.getDocumentBuilder().newDocument())); }
public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { return buildEntities(bundle.getServices(), bundle, bundleType, document); }
ServiceEntityBuilder implements EntityBuilder { public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { return buildEntities(bundle.getServices(), bundle, bundleType, document); } }
ServiceEntityBuilder implements EntityBuilder { public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { return buildEntities(bundle.getServices(), bundle, bundleType, document); } @Inject  ServiceEntityBuilder(DocumentTools documentTools, IdGenerator idGenerator); }
ServiceEntityBuilder implements EntityBuilder { public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { return buildEntities(bundle.getServices(), bundle, bundleType, document); } @Inject  ServiceEntityBuilder(DocumentTools documentTools, IdGenerator idGenerator); List<Entity> build(Bundle bundle, BundleType bundleType, Document document); @NotNull @Override Integer getOrder(); }
ServiceEntityBuilder implements EntityBuilder { public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { return buildEntities(bundle.getServices(), bundle, bundleType, document); } @Inject  ServiceEntityBuilder(DocumentTools documentTools, IdGenerator idGenerator); List<Entity> build(Bundle bundle, BundleType bundleType, Document document); @NotNull @Override Integer getOrder();  }