Commit dbe2f02cc694dba51c3088173512705ad26af377
1 parent
f567a9a0
Exists in
master
Testando conexões sem Driver e sem Url
Showing
6 changed files
with
82 additions
and
44 deletions
Show diff stats
impl/extension/jdbc/src/test/java/connection/producer/ConnectionProducerNoConnectionDriverTest.java
0 → 100644
@@ -0,0 +1,38 @@ | @@ -0,0 +1,38 @@ | ||
1 | +package connection.producer; | ||
2 | + | ||
3 | +import java.sql.Connection; | ||
4 | + | ||
5 | +import javax.enterprise.inject.Instance; | ||
6 | +import javax.inject.Inject; | ||
7 | + | ||
8 | +import org.jboss.arquillian.container.test.api.Deployment; | ||
9 | +import org.jboss.arquillian.junit.Arquillian; | ||
10 | +import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
11 | +import org.junit.Test; | ||
12 | +import org.junit.runner.RunWith; | ||
13 | + | ||
14 | +import test.Tests; | ||
15 | +import br.gov.frameworkdemoiselle.annotation.Name; | ||
16 | + | ||
17 | +@RunWith(Arquillian.class) | ||
18 | +public class ConnectionProducerNoConnectionDriverTest { | ||
19 | + | ||
20 | + private static String PATH = "src/test/resources/producer/no-connection-driver"; | ||
21 | + | ||
22 | + @Inject | ||
23 | + @Name("conn1") | ||
24 | + private Instance<Connection> conn1; | ||
25 | + | ||
26 | + @Deployment | ||
27 | + public static WebArchive createDeployment() { | ||
28 | + WebArchive deployment = Tests.createDeployment(ConnectionProducerNoConnectionDriverTest.class); | ||
29 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | ||
30 | + return deployment; | ||
31 | + } | ||
32 | + | ||
33 | + @Test(expected = Exception.class) | ||
34 | + public void failOnCreateConnection() { | ||
35 | + conn1.get(); | ||
36 | + } | ||
37 | + | ||
38 | +} |
impl/extension/jdbc/src/test/java/connection/producer/ConnectionProducerNoConnectionTest.java
@@ -1,40 +0,0 @@ | @@ -1,40 +0,0 @@ | ||
1 | -package connection.producer; | ||
2 | - | ||
3 | -import java.sql.Connection; | ||
4 | -import java.sql.SQLException; | ||
5 | - | ||
6 | -import javax.enterprise.inject.Instance; | ||
7 | -import javax.inject.Inject; | ||
8 | - | ||
9 | -import org.jboss.arquillian.container.test.api.Deployment; | ||
10 | -import org.jboss.arquillian.junit.Arquillian; | ||
11 | -import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
12 | -import org.junit.Test; | ||
13 | -import org.junit.runner.RunWith; | ||
14 | - | ||
15 | -import test.Tests; | ||
16 | -import br.gov.frameworkdemoiselle.DemoiselleException; | ||
17 | -import br.gov.frameworkdemoiselle.annotation.Name; | ||
18 | - | ||
19 | -@RunWith(Arquillian.class) | ||
20 | -public class ConnectionProducerNoConnectionTest { | ||
21 | - | ||
22 | - private static String PATH = "src/test/resources/producer/no-connection"; | ||
23 | - | ||
24 | - @Inject | ||
25 | - @Name("conn1") | ||
26 | - private Instance<Connection> conn1; | ||
27 | - | ||
28 | - @Deployment | ||
29 | - public static WebArchive createDeployment() { | ||
30 | - WebArchive deployment = Tests.createDeployment(ConnectionProducerNoConnectionTest.class); | ||
31 | - deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | ||
32 | - return deployment; | ||
33 | - } | ||
34 | - | ||
35 | - @Test(expected = DemoiselleException.class) | ||
36 | - public void failOnCreateConnection() throws SQLException { | ||
37 | - String url = ((Connection)conn1).getMetaData().getURL(); | ||
38 | - } | ||
39 | - | ||
40 | -} |
impl/extension/jdbc/src/test/java/connection/producer/ConnectionProducerNoConnectionUrlTest.java
0 → 100644
@@ -0,0 +1,38 @@ | @@ -0,0 +1,38 @@ | ||
1 | +package connection.producer; | ||
2 | + | ||
3 | +import java.sql.Connection; | ||
4 | + | ||
5 | +import javax.enterprise.inject.Instance; | ||
6 | +import javax.inject.Inject; | ||
7 | + | ||
8 | +import org.jboss.arquillian.container.test.api.Deployment; | ||
9 | +import org.jboss.arquillian.junit.Arquillian; | ||
10 | +import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
11 | +import org.junit.Test; | ||
12 | +import org.junit.runner.RunWith; | ||
13 | + | ||
14 | +import test.Tests; | ||
15 | +import br.gov.frameworkdemoiselle.annotation.Name; | ||
16 | + | ||
17 | +@RunWith(Arquillian.class) | ||
18 | +public class ConnectionProducerNoConnectionUrlTest { | ||
19 | + | ||
20 | + private static String PATH = "src/test/resources/producer/no-connection-url"; | ||
21 | + | ||
22 | + @Inject | ||
23 | + @Name("conn1") | ||
24 | + private Instance<Connection> conn1; | ||
25 | + | ||
26 | + @Deployment | ||
27 | + public static WebArchive createDeployment() { | ||
28 | + WebArchive deployment = Tests.createDeployment(ConnectionProducerNoConnectionUrlTest.class); | ||
29 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | ||
30 | + return deployment; | ||
31 | + } | ||
32 | + | ||
33 | + @Test(expected = Exception.class) | ||
34 | + public void failOnCreateConnection() { | ||
35 | + conn1.get(); | ||
36 | + } | ||
37 | + | ||
38 | +} |
impl/extension/jdbc/src/test/resources/producer/no-connection-driver/demoiselle.properties
0 → 100644
impl/extension/jdbc/src/test/resources/producer/no-connection-url/demoiselle.properties
0 → 100644
impl/extension/jdbc/src/test/resources/producer/no-connection/demoiselle.properties
@@ -1,4 +0,0 @@ | @@ -1,4 +0,0 @@ | ||
1 | -frameworkdemoiselle.persistence.conn1.driver.class= | ||
2 | -frameworkdemoiselle.persistence.conn1.url=jdbc:hsqldb:hsql5 | ||
3 | -frameworkdemoiselle.persistence.conn1.username=sa | ||
4 | -frameworkdemoiselle.persistence.conn1.password= | ||
5 | \ No newline at end of file | 0 | \ No newline at end of file |