Skip to content
This repository has been archived by the owner on Aug 13, 2020. It is now read-only.

Commit

Permalink
Remove directory creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaun Francis committed Mar 14, 2016
1 parent b6bc062 commit 6382346
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,16 @@ public class JmsEndpointGenerator implements Generator {
*/
@Override
public void run(final Raml raml, final GeneratorConfig configuration) {
final File outputDirectory = createOutputDirectories(configuration);
final String jmsTemplate = jmsListenerTemplate();
final Collection<Resource> ramlResourceModels = raml.getResources().values();

ramlResourceModels.stream()
.map(resource -> templateAttributesFrom(resource, configuration))
.forEach(attribute -> writeToTemplateFile(attribute, jmsTemplate, outputDirectory));
.forEach(attribute -> writeToTemplateFile(attribute, jmsListenerTemplate(), outputDirFrom(configuration)));

}

private File createOutputDirectories(final GeneratorConfig configuration) {
final File packageFolder = new File(format("%s/%s", configuration.getOutputDirectory(),
private File outputDirFrom(final GeneratorConfig configuration) {
return new File(format("%s/%s", configuration.getOutputDirectory(),
configuration.getBasePackageName().replace(".", "/")));
packageFolder.mkdirs();
return packageFolder;
}

@SuppressWarnings("resource")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import org.raml.model.ActionType;
import org.raml.model.Raml;
import uk.gov.justice.raml.core.Generator;
import uk.gov.justice.raml.core.GeneratorConfig;
import uk.gov.justice.services.adapters.test.utils.compiler.JavaCompilerUtil;
Expand Down Expand Up @@ -72,17 +71,6 @@ public void setup() throws Exception {
compiler = new JavaCompilerUtil(outputFolder.getRoot(), outputFolder.getRoot());
}

@Test
public void shouldCreatePackageFolder() throws Exception {
generator.run(new Raml(), configurationWithBasePackage(BASE_PACKAGE));

String path = outputFolder.getRoot().getAbsolutePath() + BASE_PACKAGE_FOLDER;
File packageDir = new File(path);
assertThat(packageDir.exists(), is(true));
assertThat(packageDir.isDirectory(), is(true));

}

@Test
public void shouldCreateJmsClass() throws Exception {
generator.run(
Expand Down

0 comments on commit 6382346

Please sign in to comment.