1
+ package com .googlecode .scheme2ddl .dao ;
2
+
3
+ import com .googlecode .scheme2ddl .ConfigurationIT ;
4
+ import org .springframework .beans .factory .annotation .Autowired ;
5
+ import org .springframework .boot .test .context .SpringBootTest ;
6
+ import org .springframework .jdbc .UncategorizedSQLException ;
7
+ import org .springframework .jdbc .core .JdbcTemplate ;
8
+ import org .springframework .test .context .testng .AbstractTestNGSpringContextTests ;
9
+ import org .testng .annotations .BeforeClass ;
10
+ import org .testng .annotations .BeforeMethod ;
11
+ import org .testng .annotations .Test ;
12
+
13
+ import java .util .HashMap ;
14
+
15
+ import static org .testng .Assert .*;
16
+
17
+ /**
18
+ * Created by Anton Reshetnikov on 12 Dec 2016.
19
+ */
20
+ @ SpringBootTest (classes = ConfigurationIT .class , properties = "test-default.properties" )
21
+ public class UserObjectDaoImplIT extends AbstractTestNGSpringContextTests {
22
+
23
+
24
+
25
+ private UserObjectDaoImpl userObjectDao ;
26
+
27
+ @ Autowired
28
+ protected JdbcTemplate dbaJdbcTemplate ;
29
+
30
+
31
+ @ BeforeClass
32
+ public void setUp () throws Exception {
33
+ userObjectDao = new UserObjectDaoImpl ();
34
+
35
+ userObjectDao .setLaunchedByDBA (false );
36
+ userObjectDao .setJdbcTemplate (dbaJdbcTemplate );
37
+ userObjectDao .setSchemaName ("NONE" );
38
+ userObjectDao .setTransformParams (new HashMap <String , Boolean >());
39
+
40
+ }
41
+
42
+ @ Test
43
+ public void findRefGroupDDLNotDba (){
44
+ userObjectDao .setLaunchedByDBA (false );
45
+ String ddl = userObjectDao .findRefGroupDDL ("REFRESH_GROUP" , "testName" );
46
+ assertNull (ddl );
47
+
48
+ }
49
+
50
+ @ Test (expectedExceptions = UncategorizedSQLException .class )
51
+ public void findRefGroupDDLDba (){
52
+ userObjectDao .setLaunchedByDBA (true );
53
+ String ddl = userObjectDao .findRefGroupDDL ("REFRESH_GROUP" , "testName" );
54
+
55
+ }
56
+
57
+ }
0 commit comments