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.updater.service;
35
36 import fr.paris.lutece.plugins.updater.service.catalog.CatalogInfos;
37 import fr.paris.lutece.portal.service.plugin.Plugin;
38 import fr.paris.lutece.portal.service.plugin.PluginService;
39 import fr.paris.lutece.test.LuteceTestCase;
40
41 import java.util.Collection;
42
43
44
45
46
47 public class UpdateServiceTest extends LuteceTestCase
48 {
49 public UpdateServiceTest( String testName )
50 {
51 super( testName );
52 }
53
54
55
56
57 public void testGetUpdateInfos( )
58 {
59 System.out.println( "getUpdateInfos" );
60
61 Collection<Plugin> listPlugins = PluginService.getPluginList( );
62 UpdateService instance = new UpdateService( );
63 instance.getUpdateInfos( listPlugins );
64 }
65
66
67
68
69 public void testGetNewPluginsInfos( )
70 {
71 System.out.println( "getNewPluginsInfos" );
72
73 Collection<Plugin> listPlugins = PluginService.getPluginList( );
74 UpdateService instance = new UpdateService( );
75 instance.getNewPluginsInfos( listPlugins );
76 }
77
78
79
80
81 public void testDeployPlugin( )
82 {
83 System.out.println( "deployPlugin" );
84
85 String strPluginName = "calendar";
86 String strVersion = "2.0.1";
87 UpdateService instance = new UpdateService( );
88 instance.deployPlugin( strPluginName, strVersion );
89 }
90
91
92
93
94 public void testIsCompliantWithCurrentCore( )
95 {
96 System.out.println( "isCompliantWithCurrentCore" );
97
98 UpdateService instance = new UpdateService( );
99
100 CatalogInfos ci = new CatalogInfos( );
101 ci.setCoreVersionMin( "2.0.0" );
102 ci.setCoreVersionMax( "3.0.0" );
103 assertTrue( instance.isCompliantWithCurrentCore( ci ) );
104
105 ci.setCoreVersionMin( "2.0.0" );
106 ci.setCoreVersionMax( null );
107 assertTrue( instance.isCompliantWithCurrentCore( ci ) );
108
109 ci.setCoreVersionMin( "4.0.0" );
110 ci.setCoreVersionMax( "5.0.0" );
111 assertFalse( instance.isCompliantWithCurrentCore( ci ) );
112 }
113
114
115
116
117 public void testGetStatus( )
118 {
119 System.out.println( "getStatus" );
120
121 UpdateService instance = new UpdateService( );
122 int result = instance.getStatus( );
123 }
124
125
126
127
128 public void testCheckUpdate( )
129 {
130 System.out.println( "checkUpdate" );
131
132 Collection<Plugin> listPlugins = null;
133 UpdateService instance = new UpdateService( );
134 instance.checkUpdate( listPlugins );
135 }
136
137
138
139
140 public void testDownloadPlugin( ) throws UpdaterDownloadException
141 {
142 System.out.println( "downloadPlugin" );
143
144 String strPluginName = "calendar";
145 String strVersion = "2.0.2";
146 UpdateService instance = new UpdateService( );
147 instance.downloadPlugin( strPluginName, strVersion );
148 }
149
150
151
152
153 public void testDownloadPluginUpgrade( ) throws UpdaterDownloadException
154 {
155 System.out.println( "downloadPluginUpgrade" );
156
157 String strPluginName = "calendar";
158 String strVersion = "2.0.2";
159 String strVersionFrom = "2.0.1";
160 UpdateService instance = new UpdateService( );
161 instance.downloadPluginUpgrade( strPluginName, strVersion, strVersionFrom );
162 }
163 }