@Test public void testEnvironmentBuild(){ UnsupportedEntityBuilder unsupportedEntityBuilder = new UnsupportedEntityBuilder(); Bundle bundle = new Bundle(); String entityName = "TestEntity"; String elementName = "TestElement"; Document document = DocumentTools.INSTANCE.getDocumentBuilder().newDocument(); Element element = document.createElement(elementName); Map<String, UnsupportedGatewayEntity> unsupportedGatewayEntityMap = bundle.getUnsupportedEntities(); UnsupportedGatewayEntity unsupportedGatewayEntity = new UnsupportedGatewayEntity(); unsupportedGatewayEntity.setName(entityName); unsupportedGatewayEntity.setType("SSG_ACTIVE_CONNECTOR"); unsupportedGatewayEntity.setId("testId"); unsupportedGatewayEntity.setElement(element); unsupportedGatewayEntityMap.put(entityName, unsupportedGatewayEntity); List<Entity> entities = unsupportedEntityBuilder.build(bundle, EntityBuilder.BundleType.ENVIRONMENT, document); Assert.assertEquals(1, entities.size()); Entity entity = entities.get(0); Assert.assertNotNull(entity.getXml()); Assert.assertEquals(entityName, entity.getName()); Assert.assertEquals("SSG_ACTIVE_CONNECTOR", entity.getType()); Assert.assertEquals(elementName, entity.getXml().getTagName()); AnnotatedBundle annotatedBundle = new AnnotatedBundle(null, null, null); unsupportedGatewayEntityMap = annotatedBundle.getUnsupportedEntities(); unsupportedGatewayEntityMap.put("TestEntity", unsupportedGatewayEntity); entities = unsupportedEntityBuilder.build(annotatedBundle, EntityBuilder.BundleType.ENVIRONMENT, document); Assert.assertEquals(1, entities.size()); entity = entities.get(0); Assert.assertNotNull(entity.getXml()); Assert.assertEquals(entityName, entity.getName()); Assert.assertEquals("SSG_ACTIVE_CONNECTOR", entity.getType()); Assert.assertEquals(elementName, entity.getXml().getTagName()); }
@Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { List<Entity> unsupportedEntities = new ArrayList<>(); Map<String, UnsupportedGatewayEntity> unsupportedGatewayEntityMap = bundle.getUnsupportedEntities(); unsupportedGatewayEntityMap.forEach((key, value) -> { if (bundleType != ENVIRONMENT || value.isExcluded()) { unsupportedEntities.add(EntityBuilderHelper.getEntityWithOnlyMapping(value.getType(), value.getName() , value.getId())); } else { Element resourceElement = (Element) document.adoptNode(value.getElement()); unsupportedEntities.add(EntityBuilderHelper.getEntityWithNameMapping(value.getType(), value.getName() , value.getId(), resourceElement)); } }); return unsupportedEntities; }
UnsupportedEntityBuilder implements EntityBuilder { @Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { List<Entity> unsupportedEntities = new ArrayList<>(); Map<String, UnsupportedGatewayEntity> unsupportedGatewayEntityMap = bundle.getUnsupportedEntities(); unsupportedGatewayEntityMap.forEach((key, value) -> { if (bundleType != ENVIRONMENT || value.isExcluded()) { unsupportedEntities.add(EntityBuilderHelper.getEntityWithOnlyMapping(value.getType(), value.getName() , value.getId())); } else { Element resourceElement = (Element) document.adoptNode(value.getElement()); unsupportedEntities.add(EntityBuilderHelper.getEntityWithNameMapping(value.getType(), value.getName() , value.getId(), resourceElement)); } }); return unsupportedEntities; } }
UnsupportedEntityBuilder implements EntityBuilder { @Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { List<Entity> unsupportedEntities = new ArrayList<>(); Map<String, UnsupportedGatewayEntity> unsupportedGatewayEntityMap = bundle.getUnsupportedEntities(); unsupportedGatewayEntityMap.forEach((key, value) -> { if (bundleType != ENVIRONMENT || value.isExcluded()) { unsupportedEntities.add(EntityBuilderHelper.getEntityWithOnlyMapping(value.getType(), value.getName() , value.getId())); } else { Element resourceElement = (Element) document.adoptNode(value.getElement()); unsupportedEntities.add(EntityBuilderHelper.getEntityWithNameMapping(value.getType(), value.getName() , value.getId(), resourceElement)); } }); return unsupportedEntities; }  }
UnsupportedEntityBuilder implements EntityBuilder { @Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { List<Entity> unsupportedEntities = new ArrayList<>(); Map<String, UnsupportedGatewayEntity> unsupportedGatewayEntityMap = bundle.getUnsupportedEntities(); unsupportedGatewayEntityMap.forEach((key, value) -> { if (bundleType != ENVIRONMENT || value.isExcluded()) { unsupportedEntities.add(EntityBuilderHelper.getEntityWithOnlyMapping(value.getType(), value.getName() , value.getId())); } else { Element resourceElement = (Element) document.adoptNode(value.getElement()); unsupportedEntities.add(EntityBuilderHelper.getEntityWithNameMapping(value.getType(), value.getName() , value.getId(), resourceElement)); } }); return unsupportedEntities; }  @Override List<Entity> build(Bundle bundle, BundleType bundleType, Document document); @Override @NotNull Integer getOrder(); }
UnsupportedEntityBuilder implements EntityBuilder { @Override public List<Entity> build(Bundle bundle, BundleType bundleType, Document document) { List<Entity> unsupportedEntities = new ArrayList<>(); Map<String, UnsupportedGatewayEntity> unsupportedGatewayEntityMap = bundle.getUnsupportedEntities(); unsupportedGatewayEntityMap.forEach((key, value) -> { if (bundleType != ENVIRONMENT || value.isExcluded()) { unsupportedEntities.add(EntityBuilderHelper.getEntityWithOnlyMapping(value.getType(), value.getName() , value.getId())); } else { Element resourceElement = (Element) document.adoptNode(value.getElement()); unsupportedEntities.add(EntityBuilderHelper.getEntityWithNameMapping(value.getType(), value.getName() , value.getId(), resourceElement)); } }); return unsupportedEntities; }  @Override List<Entity> build(Bundle bundle, BundleType bundleType, Document document); @Override @NotNull Integer getOrder();  }