Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge branch 'master' into rhbz757621
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmason committed Dec 20, 2011
2 parents 575c14e + 1a421d8 commit e80374d
Show file tree
Hide file tree
Showing 167 changed files with 8,070 additions and 1,852 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,15 @@
# Zanata change log summary

## zanata-1.5
* Allow bookmarking of selected document, document list filter and current view: https://bugzilla.redhat.com/show_bug.cgi?id=757621
* Add workspace query string parameters for generating a custom doclist with a custom title: https://bugzilla.redhat.com/show_bug.cgi?id=758587
* e.g. &title=Custom%20title&doc=full/path/of/first/doc&doc=full/path/of/second/doc

## zanata-1.4.4
* Ensure final reindex batch is properly flushed: https://bugzilla.redhat.com/show_bug.cgi?id=747836
* Support UTF-8 Properties files, handle empty properties: https://bugzilla.redhat.com/show_bug.cgi?id=760390
* Fix bug: Editor table stops working after 'Source and Target' search returns no results: https://bugzilla.redhat.com/show_bug.cgi?id=759994

## zanata-1.4.3
* Show message context in editor info panel: https://bugzilla.redhat.com/show_bug.cgi?id=750690
* Update gwteventservice to 1.2.0-RC1
Expand Down
10 changes: 10 additions & 0 deletions client/zanata-adapter-properties/pom.xml
Expand Up @@ -48,5 +48,15 @@
<version>2.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Expand Up @@ -3,7 +3,8 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.io.OutputStreamWriter;
import java.io.Writer;

import org.fedorahosted.openprops.Properties;
import org.zanata.rest.dto.extensions.comment.SimpleComment;
Expand Down Expand Up @@ -35,7 +36,7 @@ private static void makeParentDirs(File f)
* @param baseDir
* @throws IOException
*/
public static void write(final Resource doc, final File baseDir) throws IOException
public static void write(final Resource doc, final File baseDir, String charset) throws IOException
{
File baseFile = new File(baseDir, doc.getName() + ".properties");
makeParentDirs(baseFile);
Expand All @@ -50,14 +51,19 @@ public static void write(final Resource doc, final File baseDir) throws IOExcept
props.setComment(textFlow.getId(), simpleComment.getValue());
}
// props.store(System.out, null);
PrintStream out = new PrintStream(new FileOutputStream(baseFile));
props.store(out, null);
out.close();
Writer out = new OutputStreamWriter(new FileOutputStream(baseFile), charset);
try
{
props.store(out, null);
}
finally
{
out.close();
}
}

public static void write(final TranslationsResource doc, final File baseDir, String bundleName, String locale) throws IOException
public static void write(final TranslationsResource doc, final File baseDir, String bundleName, String locale, String charset) throws IOException
{

Properties targetProp = new Properties();
for (TextFlowTarget target : doc.getTextFlowTargets())
{
Expand All @@ -71,8 +77,15 @@ public static void write(final TranslationsResource doc, final File baseDir, Str
makeParentDirs(langFile);
logVerbose("Creating target file " + langFile);
// targetProp.store(System.out, null);
PrintStream out2 = new PrintStream(new FileOutputStream(langFile));
targetProp.store(out2, null);
Writer out2 = new OutputStreamWriter(new FileOutputStream(langFile), charset);
try
{
targetProp.store(out2, null);
}
finally
{
out2.close();
}
}

}
Expand Up @@ -27,13 +27,13 @@
import org.zanata.rest.dto.resource.TextFlow;
import org.zanata.rest.dto.resource.TranslationsResource;

public class PropReaderTests
public class PropReaderTest
{
private static final Logger log = LoggerFactory.getLogger(PropReaderTests.class);
private static final Logger log = LoggerFactory.getLogger(PropReaderTest.class);
private static final String TEST_OUTPUT_DIR_STRING = "target/test-output";
private static final File TEST_OUTPUT_DIR = new File(TEST_OUTPUT_DIR_STRING);

PropReader propReader;
static final String ISO_8859_1 = "ISO-8859-1";

@BeforeMethod
public void resetReader()
Expand All @@ -45,7 +45,6 @@ public void resetReader()
public void roundtripSrcPropsToDocXmlToProps() throws Exception
{
String docName = "test.properties";

Resource srcDoc = new Resource("test");
InputStream testStream = getResourceAsStream(docName);

Expand All @@ -60,7 +59,7 @@ public void roundtripSrcPropsToDocXmlToProps() throws Exception
Unmarshaller unmarshal = jc.createUnmarshaller();
Resource docIn = (Resource) unmarshal.unmarshal(new StringReader(sw.toString()));

PropWriter.write(docIn, TEST_OUTPUT_DIR);
PropWriter.write(docIn, TEST_OUTPUT_DIR, ISO_8859_1);

assertInputAndOutputDocContentSame(docName);
}
Expand All @@ -84,8 +83,8 @@ public void roundtripTransPropsToDocXmlToProps() throws Exception
Unmarshaller unmarshal = jc.createUnmarshaller();
TranslationsResource docIn = (TranslationsResource) unmarshal.unmarshal(new StringReader(sw.toString()));

PropWriter.write(docIn, TEST_OUTPUT_DIR, "test", locale);
PropWriter.write(docIn, TEST_OUTPUT_DIR, "test", locale, ISO_8859_1);

assertInputAndOutputDocContentSame(docName);
}

Expand Down Expand Up @@ -115,7 +114,7 @@ private void assertInputAndOutputDocContentSame(String docName) throws FileNotFo

private InputStream getResourceAsStream(String relativeResourceName) throws FileNotFoundException
{
InputStream stream = PropReaderTests.class.getResourceAsStream(relativeResourceName);
InputStream stream = PropReaderTest.class.getResourceAsStream(relativeResourceName);
if (stream == null)
throw new FileNotFoundException(relativeResourceName);
return stream;
Expand Down
10 changes: 10 additions & 0 deletions client/zanata-adapter-xliff/pom.xml
Expand Up @@ -43,5 +43,15 @@
<artifactId>stax</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
@@ -1,14 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/zanata-client-ant-po"/>
<listEntry value="/zanata-client-ant-po/src/main/java/org/zanata/client/ant/po/DownloadPoTask.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.maven.ide.eclipse.launchconfig.classpathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.zanata.client.ant.po.DownloadPoTask"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--help"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="zanata-client-ant-po"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.maven.ide.eclipse.launchconfig.sourcepathProvider"/>
</launchConfiguration>
7 changes: 2 additions & 5 deletions client/zanata-client-ant-po/eclipse/DownloadPoTask.launch
@@ -1,14 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/zanata-client-ant-po"/>
<listEntry value="/zanata-client-ant-po/src/main/java/org/zanata/client/ant/po/DownloadPoTask.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.maven.ide.eclipse.launchconfig.classpathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.zanata.client.ant.po.DownloadPoTask"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--debug --user admin --key b6d7044e9ee3b2447c28fb7c50d86d98 --src http://localhost:8080/zanata/seam/resource/restv1/projects/p/sample-project/iterations/i/1.1/documents --dst target/test-output"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="zanata-client-ant-po"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.maven.ide.eclipse.launchconfig.sourcepathProvider"/>
</launchConfiguration>
@@ -1,14 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/zanata-client-ant-po"/>
<listEntry value="/zanata-client-ant-po/src/main/java/org/zanata/client/ant/po/UploadPoTask.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.maven.ide.eclipse.launchconfig.classpathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.zanata.client.ant.po.UploadPoTask"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--help"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="zanata-client-ant-po"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.maven.ide.eclipse.launchconfig.sourcepathProvider"/>
</launchConfiguration>
14 changes: 0 additions & 14 deletions client/zanata-client-ant-po/eclipse/UploadPoTask hudson.launch

This file was deleted.

Expand Up @@ -6,9 +6,7 @@
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.maven.ide.eclipse.launchconfig.classpathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.zanata.client.ant.po.UploadPoTask"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--debug --user admin --key b6d7044e9ee3b2447c28fb7c50d86d98 --src src/test/resources/test-input --dst http://localhost:8080/zanata/seam/resource/restv1/projects/p/sample-project/iterations/i/1.1/documents"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="zanata-client-ant-po"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.maven.ide.eclipse.launchconfig.sourcepathProvider"/>
</launchConfiguration>
6 changes: 3 additions & 3 deletions client/zanata-client-ant-po/pom.xml
Expand Up @@ -42,7 +42,7 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.7.1</version>
<version>1.8.2</version>
<scope>compile</scope>
</dependency>
<!--
Expand All @@ -55,13 +55,13 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
<version>1.7.1</version>
<version>1.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-testutil</artifactId>
<version>1.7.1</version>
<version>1.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
@@ -1,12 +1,16 @@
package org.zanata.client.ant.po;


import java.io.File;

import org.kohsuke.args4j.Option;
import org.zanata.client.commands.ConfigurableProjectOptions;
import org.zanata.client.config.LocaleList;

public abstract class ConfigurableProjectTask extends ConfigurableTask
public abstract class ConfigurableProjectTask extends ConfigurableTask implements ConfigurableProjectOptions
{
private String projectConfig = "zanata.xml";
// FIXME when running in Ant, interpret relative to getProject().getBaseDir()
private File projectConfig = new File("zanata.xml");

private String project;
private String projectVersion;
Expand All @@ -25,7 +29,7 @@ public void setProj(String projectSlug)
}

@Option(name = "--project-config", metaVar = "FILENAME", usage = "Project configuration, eg zanata.xml", required = false)
public void setProjectConfig(String projectConfig)
public void setProjectConfig(File projectConfig)
{
this.projectConfig = projectConfig;
}
Expand All @@ -52,7 +56,7 @@ public void setProjectType(String projectType)
this.projectType = projectType;
}

public String getProjectConfig()
public File getProjectConfig()
{
return projectConfig;
}
Expand Down
Expand Up @@ -2,21 +2,14 @@

import java.io.File;


import org.kohsuke.args4j.Option;
import org.zanata.client.commands.ArgsUtil;
import org.zanata.client.commands.PublicanPullCommand;
import org.zanata.client.commands.PublicanPullOptions;
import org.zanata.client.commands.ZanataCommand;
import org.zanata.client.config.LocaleList;

public class DownloadPoTask extends ConfigurableProjectTask implements PublicanPullOptions
{
private String projectConfig = "zanata.xml";

private String project;
private String projectVersion;
private LocaleList locales;
private File dstDir;
private File dstDirPot;
private boolean exportPot;
Expand Down Expand Up @@ -45,55 +38,6 @@ public ZanataCommand initCommand()
return new PublicanPullCommand(this);
}

public String getProj()
{
return project;
}

@Option(name = "--project", metaVar = "PROJ", usage = "Project ID. This value is required unless specified in zanata.xml.")
public void setProj(String projectSlug)
{
this.project = projectSlug;
}

@Override
@Option(name = "--project-config", metaVar = "FILENAME", usage = "Project configuration file, eg zanata.xml", required = false)
public void setProjectConfig(String projectConfig)
{
this.projectConfig = projectConfig;
}

@Override
public String getProjectVersion()
{
return projectVersion;
}

@Override
@Option(name = "--project-version", metaVar = "VER", usage = "Project version ID This value is required unless specified in zanata.xml.")
public void setProjectVersion(String versionSlug)
{
this.projectVersion = versionSlug;
}

@Override
public String getProjectConfig()
{
return projectConfig;
}

@Override
public LocaleList getLocales()
{
return locales;
}

@Override
public void setLocales(LocaleList locales)
{
this.locales = locales;
}

@Override
public void setDstDir(File dstDir)
{
Expand Down
Expand Up @@ -30,7 +30,8 @@ protected String getBuildFile()
public static Test suite()
{
TestSuite suite = new TestSuite(LocalTest.class.getName());
// FIXME
suite.addTest(new LocalTest("dummy"));
// FIXME get the other tests working
// suite.addTest(new LocalTest("uploadpo"));
// suite.addTest(new LocalTest("downloadpo"));
// suite.addTest(new LocalTest("roundtriplocal"));
Expand Down

0 comments on commit e80374d

Please sign in to comment.