Add one more export test.

This commit is contained in:
Paulo Gustavo Veiga 2011-03-27 13:54:16 -03:00
parent fd5a122cc9
commit 334c9820b3
5 changed files with 369 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,263 @@
<map name="32489">
<topic central="true" text="corona">
<topic position="-238,-100" text="Modelo in world">
<topic order="0" text="International market protected Modelo from unstable peso"/>
<topic order="1" text="Fifth largest distributor in world">
<topic order="0" text="Can they sustain that trend"/>
<topic order="1" text="in 12 years"/>
</topic>
<topic order="2" text="One of top 10 breweries in world"/>
</topic>
<topic position="-341,-350" text="Carloz Fernandez CEO">
<topic order="0" text="CEO Since 1997">
<topic order="0" text="29 years old">
<topic order="0" text="working there since 13"/>
</topic>
</topic>
<topic order="1" text="vision: top five brewers">
<topic order="0" text="International Business model">
<topic order="0" text="experienced local distributors"/>
<topic order="1" text="Growing international demand"/>
<topic order="2" text="Capitalize on NAFTA"/>
</topic>
<topic order="1" text="top 10 beer producers in world">
<topic order="0" text="7.8 % sales growth compounded over ten years"/>
<topic order="1" text="2005">
<topic order="0" text="12.3 % exports"/>
<topic order="1" text="4% increase domestically"/>
<topic order="2" text="export sales 30%"/>
</topic>
<topic order="2" text="Corona Extra">
<topic order="0" text="worlds fourth best selling beer"/>
<topic order="1" text="56% shar of domestic market"/>
<topic order="2" text="Since 1997 #1 import in US">
<topic order="0" text="outsold competitor by 50%"/>
</topic>
</topic>
</topic>
</topic>
<topic order="2" text="Expanding production ">
<topic order="0" text="renovate facility in Zacatecas"/>
<topic order="1" text="300 million investment"/>
</topic>
</topic>
<topic position="-427,450" text="US Beer Market">
<topic order="0" text="2nd largest nest to China"/>
<topic order="1" text="Consumption six times higher per cap"/>
<topic order="2" text="Groth expectations reduced"/>
<topic order="3" text="80% of market">
<topic order="0" text="AB">
<topic order="0" text="75% of industry profits"/>
</topic>
<topic order="1" text="adolf coors"/>
<topic order="2" text="Miller"/>
</topic>
<topic order="4" text="dense network of regional craft brewing"/>
<topic order="5" text="volume main driver"/>
</topic>
<topic position="-355,100" text="Modelo in Mexico">
<topic order="0" text="History to 1970">
<topic order="0" text="formed in 1922">
<topic order="0" text="Pablo Diez Fernandez, Braulio Irare, Marin Oyamburr"/>
<topic order="1" text="Iriarte died in 1932"/>
<topic order="2" text="Diez sole owner 1936"/>
<topic order="3" text="Fernandez Family Sole owner since 1936"/>
</topic>
<topic order="1" text="focus on Mexico City"/>
<topic order="2" text="Modelo 1st Brand"/>
<topic order="3" text="Corona 2nd Brand">
<topic order="0" text="Clear Glass Customers preference"/>
</topic>
<topic order="4" text="1940s period of strong growth ">
<topic order="0" text="concentrate domesti¬cally "/>
<topic order="1" text="improve distribution methods and produc¬tion facilities ">
<topic order="0" text="distribution: direct with profit sharing"/>
</topic>
</topic>
<topic order="5" text="bought the brands and assets of the Toluca y Mexico Brewery">
<topic order="0" text="1935"/>
<topic order="1" text="country's oldest brand of beer"/>
</topic>
</topic>
<topic order="1" text="1971, Antonino Fernandez was appointed CEO">
<topic order="0" text="Mexican Stock exchange in 1994"/>
<topic order="1" text="Anheuser-Busch 17.7 % of the equity">
<topic order="0" text="The 50.2 % represented 43.9% voting"/>
</topic>
</topic>
<topic order="2" text="Largest Beer producer and distrubutor in Mexico">
<topic order="0" text="corona 56% share"/>
</topic>
</topic>
<topic position="196,700" text="Modelo in US">
<topic order="0" text="History">
<topic order="0" text="1979"/>
<topic order="1" text="Amalgamated Distillery Products Inc. (">
<topic order="0" text="later renamed Barton Beers Ltd."/>
</topic>
<topic order="2" text="gained popularity in southern states"/>
<topic order="3" text="rapid growth 1980s">
<topic order="0" text="second most popular imported beer"/>
</topic>
<topic order="4" text="1991">
<topic order="0" text="doubling of federal excise tax on beer">
<topic order="0" text="sales decrease of 15 percent"/>
<topic order="1" text="distributor absorb the tax 92"/>
</topic>
<topic order="1" text="distributors took the loss"/>
</topic>
</topic>
<topic order="1" text="2007 5 beers to us">
<topic order="0" text="3 of top 8 beers in US"/>
<topic order="1" text="Heineken">
<topic order="0" text="Main Import Comptitor"/>
</topic>
<topic order="2" text="131 million cases"/>
</topic>
<topic order="2" text="Marketing">
<topic order="0" text="surfing mythology"/>
<topic order="1" text="not selling premium quality"/>
<topic order="2" text="not testosterone driven"/>
<topic order="3" text="found new following"/>
<topic order="4" text="beer for non beer drinkers"/>
<topic order="5" text="dependable second choise"/>
<topic order="6" text="Fun in the sun">
<topic order="0" text="Barton Beer's idea"/>
<topic order="1" text="escape"/>
<topic order="2" text="relaxation"/>
</topic>
<topic order="7" text="1996ad budget">
<topic order="0" text="Corona 5.1 mil"/>
<topic order="1" text="Heiniken 15 mil"/>
<topic order="2" text="an bsch 192 mil"/>
</topic>
</topic>
<topic order="3" text="Us dist contracts">
<topic order="0" text="importer/distributors">
<topic order="0" text="Local Companies"/>
<topic order="1" text="Autonomous"/>
<topic order="2" text="competitive relationship"/>
<topic order="3" text="transportation"/>
<topic order="4" text="insurance"/>
<topic order="5" text="pricing"/>
<topic order="6" text="customs"/>
<topic order="7" text="advertixing"/>
</topic>
<topic order="1" text="procermex inc">
<topic order="0" text="Modelo us subsidiary"/>
<topic order="1" text="Support"/>
<topic order="2" text="Supervise"/>
<topic order="3" text="Coordinate"/>
</topic>
<topic order="2" text="Modelo had final say on brand image"/>
<topic order="3" text="production in Mexico"/>
<topic order="4" text="Chicago based Barton Beers 1st">
<topic order="0" text="largest importer in 25 western states"/>
</topic>
<topic order="5" text="Gambrinus">
<topic order="0" text="1986"/>
<topic order="1" text="eastern dist"/>
</topic>
</topic>
</topic>
<topic position="286,-650" text="The Beer market">
<topic order="0" text="traditionally a clustered market"/>
<topic order="1" text="many local breweries"/>
<topic order="2" text="no means of transport"/>
<topic order="3" text="colsolition happened in 1800s"/>
<topic order="4" text="different countries had different tastes"/>
<topic order="5" text="90s national leaders expanded abroad"/>
<topic order="6" text="startup costs high">
<topic order="0" text="industry supported conectration"/>
</topic>
<topic order="7" text="Interbrew">
<topic order="0" text="Belgian"/>
<topic order="1" text="aquired breweries in 20 countries"/>
<topic order="2" text="sales in 110 countries"/>
<topic order="3" text="local managers controlling brands"/>
<topic order="4" text="flagship brand: Stella Artois"/>
</topic>
<topic order="8" text="2004 merger">
<topic order="0" text="#1 Interbrew"/>
<topic order="1" text="#5 Am Bev - Brazil"/>
<topic order="2" text="largest merge">
<topic order="0" text="worth 12.8 billion"/>
</topic>
</topic>
<topic order="9" text="2007">
<topic order="0" text="inbev"/>
<topic order="1" text="SAP Miller"/>
<topic order="2" text="Heineken">
<topic order="0" text="produces beer domestically">
<topic order="0" text="parent of local distributors">
<topic order="0" text="marketing"/>
<topic order="1" text="importing">
<topic order="0" text="import taxes passed on to consumer"/>
</topic>
<topic order="2" text="distribution"/>
</topic>
</topic>
<topic order="4" text="marketing">
<topic order="4" text="premium beer"/>
<topic order="0" text="premium brand"/>
<topic order="1" text="no mythology"/>
<topic order="2" text="superior taste"/>
<topic order="3" text="2006 aggressive marketing campaign">
<topic order="0" text="Heineken Premium Light"/>
</topic>
</topic>
<topic order="2" text="reputation of top selling beer in world"/>
<topic order="3" text="Dutch"/>
</topic>
<topic order="3" text="Anh Bush">
<topic order="0" text="produces in foreign markets"/>
</topic>
</topic>
<topic order="10" text="Beer Marketing">
<topic order="0" text="People drink marketing"/>
</topic>
<topic order="11" text="Future">
<topic order="0" text="domestic and foreign threats"/>
<topic order="1" text="other merger talks"/>
<topic order="2" text="Inbev in talks with Anh Bush">
<topic order="0" text="Two biggest companies will create huge company"/>
</topic>
<topic order="3" text="Sales were decreasing due to competitive media budgets"/>
</topic>
</topic>
<topic position="337,0" text="Mexico Industry">
<topic order="0" text="has most trade agreements in world"/>
<topic order="1" text="one of the largest domestic beer markets"/>
<topic order="2" text="imported beer only 1% sales">
<topic order="0" text="half were anh bcsh dist by modelo"/>
</topic>
<topic order="3" text="modelo">
<topic order="0" text="NAFTA S.A. An Bucsh"/>
<topic order="1" text="62.8% of market"/>
</topic>
<topic order="4" text="FEMSA">
<topic order="0" text="domestic market">
<topic order="0" text="37% of domestic market"/>
<topic order="1" text="production and distribution in Mexico: peso not a threat"/>
<topic order="2" text="Owns Oxxo C">
<topic order="0" text="CA largest chain of conv stores"/>
</topic>
<topic order="3" text="leads domestic premium beer market"/>
<topic order="4" text="997 to 2004 taking domestic market share"/>
<topic order="5" text="NAFTA SACoca cola">
<topic order="0" text="Exclusive distributor"/>
</topic>
</topic>
<topic order="1" text="foriegn market">
<topic order="0" text="Partnership Heiniken">
<topic order="0" text="Distribution in US"/>
</topic>
<topic order="1" text="90s entry to us market failed"/>
<topic order="2" text="Recently partnered with Heiniken for US market">
<topic order="0" text="2005 18.7% growth"/>
</topic>
</topic>
</topic>
</topic>
</topic>
</map>

View File

@ -0,0 +1,103 @@
package com.wisemapping.test.freemind;
import com.wisemapping.exporter.ExportException;
import com.wisemapping.exporter.freemind.FreemindExporter;
import com.wisemapping.importer.ImporterException;
import com.wisemapping.model.MindMap;
import org.jetbrains.annotations.NotNull;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.io.*;
@Test
public class ExportTest {
private static final String DATA_DIR_PATH = "src/test/data/wisemaps/";
@Test(dataProvider = "Data-Provider-Function")
public void exportImportExportTest(@NotNull final File wisemap, @NotNull final File recFile) throws ImporterException, IOException, ExportException {
final MindMap mindmap = load(wisemap);
final FreemindExporter freemindExporter = new FreemindExporter();
if (recFile.exists()) {
// Compare rec and file ...
// Load rec file co
final FileInputStream fis = new FileInputStream(recFile);
final InputStreamReader isr = new InputStreamReader(fis);
final BufferedReader br = new BufferedReader(isr);
final StringBuilder recContent = new StringBuilder();
String line = br.readLine();
while (line != null) {
recContent.append(line);
line = br.readLine();
}
fis.close();
// Export mile content ...
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
freemindExporter.export(mindmap, bos);
final String exportContent = new String(bos.toByteArray());
Assert.assertEquals(recContent.toString(), exportContent);
} else {
final FileOutputStream fos = new FileOutputStream(recFile);
freemindExporter.export(mindmap, fos);
fos.close();
}
}
private MindMap load(@NotNull File wisemap) throws IOException {
final FileInputStream fis = new FileInputStream(wisemap);
final InputStreamReader isr = new InputStreamReader(fis);
final BufferedReader br = new BufferedReader(isr);
final StringBuilder content = new StringBuilder();
String line = br.readLine();
while (line != null) {
content.append(line);
line = br.readLine();
}
fis.close();
final MindMap result = new MindMap();
result.setXml(content.toString().getBytes());
result.setNativeXml(content.toString());
return result;
}
//This function will provide the parameter data
@DataProvider(name = "Data-Provider-Function")
public Object[][] parameterIntTestProvider() {
final File dataDir = new File(DATA_DIR_PATH);
final File[] freeMindFiles = dataDir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".xml");
}
});
final Object[][] result = new Object[freeMindFiles.length][2];
for (int i = 0; i < freeMindFiles.length; i++) {
File freeMindFile = freeMindFiles[i];
final String name = freeMindFile.getName();
result[i] = new Object[]{freeMindFile, new File(DATA_DIR_PATH, name.substring(0, name.lastIndexOf(".")) + ".mmr")};
}
return result;
}
}

View File

@ -6,7 +6,6 @@ import com.wisemapping.importer.ImportFormat;
import com.wisemapping.importer.Importer;
import com.wisemapping.importer.ImporterException;
import com.wisemapping.importer.ImporterFactory;
import com.wisemapping.model.MindMap;
import org.jetbrains.annotations.NotNull;
import org.testng.Assert;
@ -14,11 +13,9 @@ import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.io.*;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
@Test
public class FreeMindExportTest {
public class ImportExportTest {
private static final String DATA_DIR_PATH = "src/test/data/freemind/";
@Test(dataProvider = "Data-Provider-Function")

View File

@ -1,7 +1,7 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="WiseMapping Java Tests" verbose="1">
<test name="FreeMind Import Export Tests">
<test name="FreeMind Export Tests">
<packages>
<package name="com.wisemapping.test.freemind"/>
<package name="com.wisemapping.test.export"/>