@Test void load() throws DocumentParseException { Document realDocument = DocumentTools.INSTANCE.getDocumentBuilder().newDocument(); Document mockDocument = mock(Document.class); when(mockDocument.getElementsByTagName(eq(ITEM))).thenReturn(new NodeList() { private List<Element> elements = Stream.of( TestUtils.createJdbcXml(realDocument), TestUtils.createCassandraXml(realDocument, true, true), TestUtils.createUnsupportedElement(realDocument) ).collect(toList()); @Override public Node item(int index) { return elements.get(index); } @Override public int getLength() { return elements.size(); } }); when(documentTools.parse(any(File.class))).thenReturn(mockDocument); EntityBundleLoader loader = new EntityBundleLoader(documentTools, registry, JsonFileUtils.INSTANCE); final Bundle bundle = loader.load(mock(File.class), BundleLoadingOperation.EXPORT); assertNotNull(bundle); assertFalse(bundle.getCassandraConnections().isEmpty()); assertFalse(bundle.getJdbcConnections().isEmpty()); assertEquals(1, bundle.getCassandraConnections().size()); assertEquals(1, bundle.getJdbcConnections().size()); }
public Bundle load(List<File> fileSet, BundleLoadingOperation loadingMode, String... entityTypes) { final Bundle bundle = new Bundle(); fileSet.forEach(f -> loadBundleFile(f, bundle, loadingMode, entityTypes)); return bundle; }
EntityBundleLoader { public Bundle load(List<File> fileSet, BundleLoadingOperation loadingMode, String... entityTypes) { final Bundle bundle = new Bundle(); fileSet.forEach(f -> loadBundleFile(f, bundle, loadingMode, entityTypes)); return bundle; } }
EntityBundleLoader { public Bundle load(List<File> fileSet, BundleLoadingOperation loadingMode, String... entityTypes) { final Bundle bundle = new Bundle(); fileSet.forEach(f -> loadBundleFile(f, bundle, loadingMode, entityTypes)); return bundle; } @Inject  EntityBundleLoader(final DocumentTools documentTools, final BundleEntityLoaderRegistry entityLoaderRegistry, final JsonFileUtils jsonFileUtils); }
EntityBundleLoader { public Bundle load(List<File> fileSet, BundleLoadingOperation loadingMode, String... entityTypes) { final Bundle bundle = new Bundle(); fileSet.forEach(f -> loadBundleFile(f, bundle, loadingMode, entityTypes)); return bundle; } @Inject  EntityBundleLoader(final DocumentTools documentTools, final BundleEntityLoaderRegistry entityLoaderRegistry, final JsonFileUtils jsonFileUtils); Bundle load(List<File> fileSet, BundleLoadingOperation loadingMode, String... entityTypes); Bundle load(File dependencyBundlePath, BundleLoadingOperation loadingMode, String... entityTypes); Bundle loadMetadata(File dependencyMetadataPath, BundleLoadingOperation loadingMode); }
EntityBundleLoader { public Bundle load(List<File> fileSet, BundleLoadingOperation loadingMode, String... entityTypes) { final Bundle bundle = new Bundle(); fileSet.forEach(f -> loadBundleFile(f, bundle, loadingMode, entityTypes)); return bundle; } @Inject  EntityBundleLoader(final DocumentTools documentTools, final BundleEntityLoaderRegistry entityLoaderRegistry, final JsonFileUtils jsonFileUtils); Bundle load(List<File> fileSet, BundleLoadingOperation loadingMode, String... entityTypes); Bundle load(File dependencyBundlePath, BundleLoadingOperation loadingMode, String... entityTypes); Bundle loadMetadata(File dependencyMetadataPath, BundleLoadingOperation loadingMode);  }