1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.plugins.sqlpage.business;
35
36 import fr.paris.lutece.test.LuteceTestCase;
37
38 public class SQLPageBusinessTest extends LuteceTestCase
39 {
40 private final static String TITLE1 = "Title1";
41 private final static String TITLE2 = "Title2";
42 private final static String DESCRIPTION1 = "Description1";
43 private final static String DESCRIPTION2 = "Description2";
44 private final static String WORKGROUP1 = "Workgroup1";
45 private final static String WORKGROUP2 = "Workgroup2";
46
47 public void testBusiness( )
48 {
49
50 SQLPage sQLPage = new SQLPage( );
51 sQLPage.setTitle( TITLE1 );
52 sQLPage.setDescription( DESCRIPTION1 );
53 sQLPage.setWorkgroup( WORKGROUP1 );
54
55
56 SQLPageHome.create( sQLPage );
57
58 SQLPage sQLPageStored = SQLPageHome.findByPrimaryKey( sQLPage.getId( ) );
59 assertEquals( sQLPageStored.getTitle( ), sQLPage.getTitle( ) );
60 assertEquals( sQLPageStored.getDescription( ), sQLPage.getDescription( ) );
61 assertEquals( sQLPageStored.getWorkgroup( ), sQLPage.getWorkgroup( ) );
62
63
64 sQLPage.setTitle( TITLE2 );
65 sQLPage.setDescription( DESCRIPTION2 );
66 sQLPage.setWorkgroup( WORKGROUP2 );
67 SQLPageHome.update( sQLPage );
68 sQLPageStored = SQLPageHome.findByPrimaryKey( sQLPage.getId( ) );
69 assertEquals( sQLPageStored.getTitle( ), sQLPage.getTitle( ) );
70 assertEquals( sQLPageStored.getDescription( ), sQLPage.getDescription( ) );
71 assertEquals( sQLPageStored.getWorkgroup( ), sQLPage.getWorkgroup( ) );
72
73
74 SQLPageHome.getSQLPagesList( );
75
76
77 SQLPageHome.remove( sQLPage.getId( ) );
78 sQLPageStored = SQLPageHome.findByPrimaryKey( sQLPage.getId( ) );
79 assertNull( sQLPageStored );
80 }
81 }