svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.installer / org.gvsig.installer.lib / org.gvsig.installer.lib.impl / src / test / java / org / gvsig / installer / lib / impl / info / InstallerInfoFileWriterTest.java @ 40560
History | View | Annotate | Download (2.93 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
/*
|
25 |
* AUTHORS (In addition to CIT):
|
26 |
* 2010 {Prodevelop} {Task}
|
27 |
*/
|
28 |
|
29 |
package org.gvsig.installer.lib.impl.info; |
30 |
|
31 |
import java.io.ByteArrayInputStream; |
32 |
import java.io.ByteArrayOutputStream; |
33 |
|
34 |
import org.gvsig.installer.lib.api.PackageInfo; |
35 |
import org.gvsig.installer.lib.impl.DefaultPackageInfo; |
36 |
import org.gvsig.installer.lib.spi.InstallerInfoFileException; |
37 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
38 |
import org.gvsig.tools.locator.LocatorException; |
39 |
|
40 |
/**
|
41 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
42 |
*/
|
43 |
public class InstallerInfoFileWriterTest extends |
44 |
AbstractLibraryAutoInitTestCase { |
45 |
|
46 |
@Override
|
47 |
protected void doSetUp() throws Exception { |
48 |
// TODO Auto-generated method stub
|
49 |
|
50 |
} |
51 |
|
52 |
public void testWriteFile() throws LocatorException, |
53 |
InstallerInfoFileException { |
54 |
DefaultPackageInfo installerInfo = new DefaultPackageInfo();
|
55 |
|
56 |
installerInfo.setCode("org.gvsig.myplugin");
|
57 |
installerInfo.setName("My name");
|
58 |
installerInfo.setDescription("My description");
|
59 |
installerInfo.setVersion("1.0.0");
|
60 |
installerInfo.setBuild(4);
|
61 |
installerInfo.setState("final");
|
62 |
installerInfo.setOfficial(false);
|
63 |
installerInfo.setType("plugin");
|
64 |
|
65 |
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
66 |
|
67 |
InstallerInfoFileWriter installerInfoFileWriter = new InstallerInfoFileWriter();
|
68 |
installerInfoFileWriter.write(installerInfo, out); |
69 |
|
70 |
PackageInfo installerInfo2 = new DefaultPackageInfo();
|
71 |
|
72 |
InstallerInfoFileReader installerInfoFileReader = new InstallerInfoFileReader();
|
73 |
installerInfoFileReader.read(installerInfo2, new ByteArrayInputStream( |
74 |
out.toByteArray())); |
75 |
|
76 |
assertEquals("org.gvsig.myplugin", installerInfo2.getCode());
|
77 |
assertEquals("My name", installerInfo2.getName());
|
78 |
assertEquals("My description", installerInfo2.getDescription());
|
79 |
assertEquals("1.0.0-4", installerInfo2.getVersion().toString());
|
80 |
assertEquals(4, installerInfo2.getBuild());
|
81 |
assertEquals("final", installerInfo2.getState());
|
82 |
assertEquals(false, installerInfo2.isOfficial());
|
83 |
} |
84 |
} |