Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple WSDL Test #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import static org.twdata.maven.mojoexecutor.MojoExecutor.*;

Expand Down Expand Up @@ -49,11 +52,27 @@ public class BootCxfMojo extends AbstractMojo {
@Component
private BuildPluginManager pluginManager;

public void execute() throws MojoExecutionException {
public void execute() {

logWithPrefix("STEP 0: Scanning for WSDL file in src/main/resources");

File wsdl = findWsdl(mavenProject.getBasedir());
List<File> WSDL_FILES = Arrays.stream(
mavenProject.getBasedir().listFiles())
.filter(file -> file.getName()
.contains(".wsdl"))
.collect(Collectors.toList()
);

WSDL_FILES.forEach(wsdl -> {
try {
parseWSDL(wsdl);
} catch (MojoExecutionException e) {
e.printStackTrace();
}
});
}

public void parseWSDL(File wsdl) throws MojoExecutionException {
String buildDirectory = mavenProject.getBuild().getOutputDirectory();

logWithPrefix("STEP 1: Found .wsdl-File: " + wsdl.getPath());
Expand Down Expand Up @@ -192,6 +211,9 @@ protected File findWsdl(File buildDirectory) throws MojoExecutionException {

filterOutWsdlsInsideBuildOutputFolder(wsdls);

wsdls.stream()
.forEach(file -> System.out.println(file.getName()));
System.out.println(wsdls.stream().count());
Optional<File> wsdl = wsdls.stream().findFirst();

if(wsdl.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

import static de.codecentric.cxf.BootCxfMojo.readWsdlIntoString;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

public class BootCxfMojoTest {

Expand All @@ -27,6 +29,7 @@ public class BootCxfMojoTest {
private BootCxfMojo bootCxfMojo = new BootCxfMojo();;
private File resourcesDirectory = new File("src/test/resources");
private String buildDirectory = new File("target/classes").getAbsolutePath();
private File wsld_search_directory = new File("src/test/resources");

@Test public void
find_Wsdl_in_classpath() throws IOException, MojoExecutionException {
Expand Down Expand Up @@ -110,6 +113,18 @@ public class BootCxfMojoTest {

}

@Test public void
multiple_wsdl_search() {
List<String> WSDL_FILES = Arrays.stream(
wsld_search_directory.listFiles())
.filter(file -> file.getName()
.contains(".wsdl"))
.map(String::valueOf)
.collect(Collectors.toList()
);
assertNotNull(WSDL_FILES);
}

@Test public void
does_clean_cxfSpringBootMavenProperties() throws MojoExecutionException, IOException {

Expand Down