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.portal.business.stylesheet;
35
36 import fr.paris.lutece.test.LuteceTestCase;
37
38 public class StyleSheetTest extends LuteceTestCase
39 {
40 private final static String DESCRIPTION1 = "Description 1";
41 private final static String DESCRIPTION2 = "Description 2";
42 private final static String FILE1 = "Filename 1";
43 private final static String FILE2 = "Fileamne 2";
44 private final static String SOURCE1 = "<xsl Source 1>";
45 private final static String SOURCE2 = "<xsl Source 2>";
46
47 public void testBusiness( )
48 {
49
50 StyleSheet styleSheet = new StyleSheet( );
51 styleSheet.setDescription( DESCRIPTION1 );
52 styleSheet.setFile( FILE1 );
53 styleSheet.setSource( SOURCE1.getBytes( ) );
54
55
56 StyleSheetHome.create( styleSheet );
57
58 StyleSheet styleSheetStored = StyleSheetHome.findByPrimaryKey( styleSheet.getId( ) );
59 assertEquals( styleSheetStored.getDescription( ), styleSheet.getDescription( ) );
60 assertEquals( styleSheetStored.getFile( ), styleSheet.getFile( ) );
61 assertEquals( styleSheetStored.getSource( ).length, styleSheet.getSource( ).length );
62
63
64 styleSheet.setDescription( DESCRIPTION2 );
65 styleSheet.setFile( FILE2 );
66 styleSheet.setSource( SOURCE2.getBytes( ) );
67
68 StyleSheetHome.update( styleSheet );
69 styleSheetStored = StyleSheetHome.findByPrimaryKey( styleSheet.getId( ) );
70 assertEquals( styleSheetStored.getDescription( ), styleSheet.getDescription( ) );
71 assertEquals( styleSheetStored.getFile( ), styleSheet.getFile( ) );
72 assertEquals( styleSheetStored.getSource( ).length, styleSheet.getSource( ).length );
73
74
75 StyleSheetHome.getStyleSheetList( 0 );
76
77
78 StyleSheetHome.remove( styleSheet.getId( ) );
79 styleSheetStored = StyleSheetHome.findByPrimaryKey( styleSheet.getId( ) );
80 assertNull( styleSheetStored );
81 }
82 }