Revision 37599 branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/test/java/org/gvsig/installer/lib/impl/execution/InstallPackageServiceTest.java
InstallPackageServiceTest.java | ||
---|---|---|
46 | 46 |
*/ |
47 | 47 |
public class InstallPackageServiceTest extends InstallerServiceTest { |
48 | 48 |
|
49 |
@Override
|
|
50 |
protected void doSetUp() throws Exception {
|
|
51 |
// TODO Auto-generated method stub
|
|
49 |
@Override
|
|
50 |
protected void doSetUp() throws Exception {
|
|
51 |
// TODO Auto-generated method stub
|
|
52 | 52 |
|
53 |
}
|
|
53 |
}
|
|
54 | 54 |
|
55 |
public void testReadPlugins() throws LocatorException,
|
|
56 |
MakePluginPackageServiceException, InstallPackageServiceException,
|
|
57 |
IOException {
|
|
58 |
File installersDirectory = super.getInstallersDirectory();
|
|
55 |
public void testReadPlugins() throws LocatorException,
|
|
56 |
MakePluginPackageServiceException, InstallPackageServiceException,
|
|
57 |
IOException {
|
|
58 |
File installersDirectory = super.getInstallersDirectory();
|
|
59 | 59 |
|
60 |
InstallPackageService installPackageService =
|
|
61 |
InstallerLocator.getInstallerManager().getInstallPackageService();
|
|
62 |
installPackageService.addBundlesFromDirectory(installersDirectory);
|
|
60 |
InstallPackageService installPackageService = InstallerLocator
|
|
61 |
.getInstallerManager().getInstallPackageService();
|
|
62 |
installPackageService.addBundlesFromDirectory(installersDirectory);
|
|
63 | 63 |
|
64 |
Assert.assertEquals(3, installPackageService.getPackageCount());
|
|
64 |
Assert.assertEquals(3, installPackageService.getPackageCount());
|
|
65 | 65 |
|
66 |
int pluginsNumber = 0; |
|
67 |
for (int i = 0; i < 3; i++) { |
|
68 |
PackageInfo packageInfo = installPackageService.getPackageInfo(i); |
|
69 |
if (packageInfo.getCode().equals("org.gvsig.plugin1")) { |
|
70 |
assertNotNull(packageInfo.getState()); |
|
71 |
pluginsNumber++; |
|
72 |
} else |
|
73 |
if (packageInfo.getCode().equals("org.gvsig.plugin2")) { |
|
74 |
assertEquals("RC1", packageInfo.getState()); |
|
75 |
pluginsNumber++; |
|
76 |
} else |
|
77 |
if (packageInfo.getCode().equals("org.gvsig.plugin3")) { |
|
78 |
assertEquals("Testing", packageInfo.getState()); |
|
79 |
pluginsNumber++; |
|
80 |
} |
|
81 |
} |
|
66 |
int pluginsNumber = 0; |
|
67 |
for (int i = 0; i < 3; i++) { |
|
68 |
PackageInfo packageInfo = installPackageService.getPackageInfo(i); |
|
69 |
if (packageInfo.getCode().equals("org.gvsig.plugin1")) { |
|
70 |
assertNotNull(packageInfo.getState()); |
|
71 |
pluginsNumber++; |
|
72 |
} else if (packageInfo.getCode().equals("org.gvsig.plugin2")) { |
|
73 |
assertEquals("RC1", packageInfo.getState()); |
|
74 |
pluginsNumber++; |
|
75 |
} else if (packageInfo.getCode().equals("org.gvsig.plugin3")) { |
|
76 |
assertEquals("Testing", packageInfo.getState()); |
|
77 |
pluginsNumber++; |
|
78 |
} |
|
79 |
} |
|
82 | 80 |
|
83 |
Assert.assertEquals(3, pluginsNumber);
|
|
84 |
}
|
|
81 |
Assert.assertEquals(3, pluginsNumber);
|
|
82 |
}
|
|
85 | 83 |
|
86 |
public void testInstallPluginFromApplication()
|
|
87 |
throws InstallPackageServiceException, IOException, LocatorException,
|
|
88 |
MakePluginPackageServiceException {
|
|
89 |
File installersDirectory = super.getInstallersDirectory();
|
|
90 |
File pluginsDirectory = super.getPluginsDirectory();
|
|
91 |
File applicationDirectory = super.getApplicationDirectory();
|
|
84 |
public void testInstallPluginFromApplication()
|
|
85 |
throws InstallPackageServiceException, IOException,
|
|
86 |
LocatorException, MakePluginPackageServiceException {
|
|
87 |
File installersDirectory = super.getInstallersDirectory();
|
|
88 |
File pluginsDirectory = super.getPluginsDirectory();
|
|
89 |
File applicationDirectory = super.getApplicationDirectory();
|
|
92 | 90 |
|
93 |
InstallPackageService installerExecutionService =
|
|
94 |
InstallerLocator.getInstallerManager().getInstallPackageService();
|
|
95 |
installerExecutionService.addBundlesFromDirectory(installersDirectory);
|
|
91 |
InstallPackageService installerExecutionService = InstallerLocator
|
|
92 |
.getInstallerManager().getInstallPackageService();
|
|
93 |
installerExecutionService.addBundlesFromDirectory(installersDirectory);
|
|
96 | 94 |
|
97 |
PackageInfo packageInfo =
|
|
98 |
installerExecutionService.getPackageInfo("org.gvsig.plugin1");
|
|
99 |
installerExecutionService.installPackage(applicationDirectory,
|
|
100 |
packageInfo);
|
|
95 |
PackageInfo packageInfo = installerExecutionService
|
|
96 |
.getPackageInfo("org.gvsig.plugin1");
|
|
97 |
installerExecutionService.installPackage(applicationDirectory,
|
|
98 |
packageInfo);
|
|
101 | 99 |
|
102 |
Assert.assertEquals(3, installerExecutionService.getPackageCount());
|
|
100 |
Assert.assertEquals(3, installerExecutionService.getPackageCount());
|
|
103 | 101 |
|
104 |
// Reading the excution and check that the file is installed |
|
105 |
MakePluginPackageService installerCreationService = |
|
106 |
InstallerLocator.getInstallerManager().getMakePluginPackageService( |
|
107 |
pluginsDirectory); |
|
108 |
Assert |
|
109 |
.assertEquals(4, installerCreationService.getPluginPackageCount()); |
|
110 |
} |
|
102 |
// Reading the excution and check that the file is installed |
|
103 |
MakePluginPackageService installerCreationService = InstallerLocator |
|
104 |
.getInstallerManager().getMakePluginPackageService( |
|
105 |
pluginsDirectory); |
|
106 |
Assert |
|
107 |
.assertEquals(4, installerCreationService |
|
108 |
.getPluginPackageCount()); |
|
109 |
} |
|
111 | 110 |
|
112 |
public void testInstallPluginFromExternal()
|
|
113 |
throws InstallPackageServiceException, IOException, LocatorException,
|
|
114 |
MakePluginPackageServiceException {
|
|
115 |
File applicationDirectory = super.getApplicationDirectory();
|
|
116 |
File externalInstallationFile =
|
|
117 |
new File(applicationDirectory.getAbsoluteFile() + File.separator
|
|
118 |
+ "install" + File.separator + "bundle1.zip");
|
|
119 |
File pluginsDirectory = super.getPluginsDirectory();
|
|
111 |
public void testInstallPluginFromExternal()
|
|
112 |
throws InstallPackageServiceException, IOException,
|
|
113 |
LocatorException, MakePluginPackageServiceException {
|
|
114 |
File applicationDirectory = super.getApplicationDirectory();
|
|
115 |
File externalInstallationFile = new File(applicationDirectory
|
|
116 |
.getAbsoluteFile()
|
|
117 |
+ File.separator + "install" + File.separator + "bundle1.zip");
|
|
118 |
File pluginsDirectory = super.getPluginsDirectory();
|
|
120 | 119 |
|
121 |
InstallPackageService installerExecutionService =
|
|
122 |
InstallerLocator.getInstallerManager().getInstallPackageService();
|
|
123 |
installerExecutionService.addBundle(externalInstallationFile);
|
|
120 |
InstallPackageService installerExecutionService = InstallerLocator
|
|
121 |
.getInstallerManager().getInstallPackageService();
|
|
122 |
installerExecutionService.addBundle(externalInstallationFile);
|
|
124 | 123 |
|
125 |
PackageInfo packageInfo =
|
|
126 |
installerExecutionService.getPackageInfo("org.gvsig.plugin1");
|
|
124 |
PackageInfo packageInfo = installerExecutionService
|
|
125 |
.getPackageInfo("org.gvsig.plugin1");
|
|
127 | 126 |
|
128 |
Assert.assertEquals(3, installerExecutionService.getPackageCount());
|
|
127 |
Assert.assertEquals(3, installerExecutionService.getPackageCount());
|
|
129 | 128 |
|
130 |
installerExecutionService.installPackage(applicationDirectory,
|
|
131 |
packageInfo);
|
|
129 |
installerExecutionService.installPackage(applicationDirectory,
|
|
130 |
packageInfo);
|
|
132 | 131 |
|
133 |
// Reading the excution and check that the file is installed |
|
134 |
MakePluginPackageService installerCreationService = |
|
135 |
InstallerLocator.getInstallerManager().getMakePluginPackageService( |
|
136 |
pluginsDirectory); |
|
137 |
Assert |
|
138 |
.assertEquals(4, installerCreationService.getPluginPackageCount()); |
|
139 |
} |
|
132 |
// Reading the excution and check that the file is installed |
|
133 |
MakePluginPackageService installerCreationService = InstallerLocator |
|
134 |
.getInstallerManager().getMakePluginPackageService( |
|
135 |
pluginsDirectory); |
|
136 |
Assert |
|
137 |
.assertEquals(4, installerCreationService |
|
138 |
.getPluginPackageCount()); |
|
139 |
} |
|
140 | 140 |
|
141 |
// public void testInstallPluginWithAntScript() throws
|
|
142 |
// InstallPackageServiceException, LocatorException,
|
|
143 |
// MakePluginPackageServiceException, IOException{
|
|
144 |
// File applicationDirectory = super.getApplicationDirectory();
|
|
145 |
// File installersDirectory = super.getInstallersDirectory();
|
|
146 |
// File pluginsDirectory = super.getPluginsDirectory();
|
|
147 |
//
|
|
148 |
// InstallPackageService installerExecutionService =
|
|
149 |
// InstallerLocator.getInstallerManager().getInstallPackageService();
|
|
150 |
// installerExecutionService.addBundlesFromDirectory(installersDirectory);
|
|
151 |
//
|
|
152 |
// PackageInfo packageInfo =
|
|
153 |
// installerExecutionService.getPackageInfo("org.gvsig.plugin2");
|
|
154 |
//
|
|
155 |
// Assert.assertEquals(3, installerExecutionService.getPackageCount());
|
|
156 |
//
|
|
157 |
// installerExecutionService.installPackage(applicationDirectory,
|
|
158 |
// packageInfo);
|
|
159 |
//
|
|
160 |
// //Reading the excution and check that the file is installed
|
|
161 |
// MakePluginPackageService installerCreationService =
|
|
162 |
// InstallerLocator.getInstallerManager().getMakePluginPackageService(pluginsDirectory);
|
|
163 |
//
|
|
164 |
// Assert.assertEquals(5, installerCreationService.getPluginPackageCount());
|
|
165 |
// }
|
|
141 |
// public void testInstallPluginWithAntScript() throws
|
|
142 |
// InstallPackageServiceException, LocatorException,
|
|
143 |
// MakePluginPackageServiceException, IOException{
|
|
144 |
// File applicationDirectory = super.getApplicationDirectory();
|
|
145 |
// File installersDirectory = super.getInstallersDirectory();
|
|
146 |
// File pluginsDirectory = super.getPluginsDirectory();
|
|
147 |
//
|
|
148 |
// InstallPackageService installerExecutionService =
|
|
149 |
// InstallerLocator.getInstallerManager().getInstallPackageService();
|
|
150 |
// installerExecutionService.addBundlesFromDirectory(installersDirectory);
|
|
151 |
//
|
|
152 |
// PackageInfo packageInfo =
|
|
153 |
// installerExecutionService.getPackageInfo("org.gvsig.plugin2");
|
|
154 |
//
|
|
155 |
// Assert.assertEquals(3, installerExecutionService.getPackageCount());
|
|
156 |
//
|
|
157 |
// installerExecutionService.installPackage(applicationDirectory,
|
|
158 |
// packageInfo);
|
|
159 |
//
|
|
160 |
// //Reading the excution and check that the file is installed
|
|
161 |
// MakePluginPackageService installerCreationService =
|
|
162 |
// InstallerLocator.getInstallerManager().getMakePluginPackageService(pluginsDirectory);
|
|
163 |
//
|
|
164 |
// Assert.assertEquals(5, installerCreationService.getPluginPackageCount());
|
|
165 |
// }
|
|
166 | 166 |
|
167 | 167 |
} |
Also available in: Unified diff