Skip to content

change of build directory #317

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

Merged
merged 1 commit into from
Jul 16, 2015
Merged
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
8 changes: 8 additions & 0 deletions jpa/schema-gen-scripts-generate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Java EE 7 Sample: jpa - schema-gen-scripts-generate</name>
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<persistence-unit name="MyPU" transaction-type="JTA">
<properties>
<property name="javax.persistence.schema-generation.scripts.action" value="drop-and-create"/>
<property name="javax.persistence.schema-generation.scripts.create-target" value="file:/tmp/create.sql"/>
<property name="javax.persistence.schema-generation.scripts.drop-target" value="file:/tmp/drop.sql"/>
<property name="javax.persistence.schema-generation.scripts.create-target" value="${project.build.directory}/create-script.sql"/>
<property name="javax.persistence.schema-generation.scripts.drop-target" value="${project.build.directory}/drop-script.sql"/>
</properties>
</persistence-unit>
</persistence>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.jboss.arquillian.container.test.api.RunAsClient;

import static org.junit.Assert.assertTrue;

Expand All @@ -22,27 +23,30 @@
*/
@RunWith(Arquillian.class)
public class SchemaGenScriptsTest {

@Deployment
public static WebArchive createDeployment() {
WebArchive war = ShrinkWrap.create(WebArchive.class)
.addPackage("org.javaee7.jpasamples.schema.gen.scripts.generate")
.addAsResource("META-INF/persistence.xml");
.addPackage("org.javaee7.jpasamples.schema.gen.scripts.generate")
.addAsResource("META-INF/persistence.xml");
System.out.println(war.toString(true));
return war;
}

@After
public void tearDown() throws Exception {
new File("/tmp/create.sql").delete();
new File("/tmp/drop.sql").delete();
System.out.println(new File("target/create-script.sql").getAbsolutePath());
new File("target/create-script.sql").delete();
new File("target/drop-script.sql").delete();
}

@Test
@RunAsClient
public void testSchemaGenIndex() throws Exception {
Path create = Paths.get("/tmp/create.sql");
Path create = Paths.get("target","create-script.sql");
assertTrue(Files.exists(create));

Path drop = Paths.get("/tmp/drop.sql");
Path drop = Paths.get("target","drop-script.sql");
assertTrue(Files.exists(create));

String line;
Expand Down