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

Commit

Permalink
Merge remote-tracking branch 'origin/integration/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Nov 16, 2015
2 parents 077b02a + d8a0855 commit bd1b3de
Show file tree
Hide file tree
Showing 23 changed files with 100 additions and 112 deletions.
1 change: 1 addition & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 3.8.0

##### Changes
* [ZNTA-354](https://zanata.atlassian.net/browse/ZNTA-354) - Improve Zanata client installation documentation and workflow
* [ZNTA-664](https://zanata.atlassian.net/browse/ZNTA-664) - Change client push command not to run copy trans by default

-----------------------
Expand Down
13 changes: 10 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>client</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.9.0-SNAPSHOT</version>
<name>Zanata client modules</name>
<packaging>pom</packaging>
<parent>
<groupId>org.zanata</groupId>
<artifactId>zanata-parent</artifactId>
<version>25-SNAPSHOT</version>
<version>26-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>

Expand Down Expand Up @@ -36,13 +36,20 @@

<properties>
<zanata.api.version>3.9.0-SNAPSHOT</zanata.api.version>
<zanata.common.version>3.8.0-SNAPSHOT</zanata.common.version>
<zanata.common.version>3.9.0-SNAPSHOT</zanata.common.version>
<resteasy.version>3.0.11.Final</resteasy.version>
<jersey.version>1.17.1</jersey.version>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions stub-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.zanata</groupId>
<artifactId>client</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.9.0-SNAPSHOT</version>
</parent>
<artifactId>stub-server</artifactId>
<name>stub-server</name>
Expand All @@ -19,7 +19,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jetty.version>9.0.3.v20130506</jetty.version>
<jetty.version>9.3.5.v20151012</jetty.version>
</properties>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@

package org.zanata.rest.service;

import java.util.List;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;

import org.zanata.common.LocaleId;
import org.zanata.rest.dto.Glossary;
import org.zanata.rest.GlossaryFileUploadForm;
import org.zanata.rest.dto.GlossaryEntry;

/**
* @author Patrick Huang
Expand All @@ -39,28 +42,38 @@ public class MockGlossaryResource implements GlossaryResource {
UriInfo uriInfo;

@Override
public Response getEntries() {
return MockResourceUtil.notUsedByClient();
public Response getInfo() {
return null;
}

@Override
public Response get(LocaleId locale) {
public Response getEntries(LocaleId srcLocale,
LocaleId transLocale, int page, int sizePerPage, String filter,
String sort) {
return MockResourceUtil.notUsedByClient();
}

@Override
public Response put(Glossary messageBody) {
return Response.created(uriInfo.getAbsolutePath()).build();
public Response post(List<GlossaryEntry> glossaryEntries) {
GenericEntity<List<GlossaryEntry>> genericEntity =
new GenericEntity<List<GlossaryEntry>>(glossaryEntries) {
};
return Response.ok(genericEntity).build();
}

@Override
public Response upload(GlossaryFileUploadForm glossaryFileUploadForm) {
return MockResourceUtil.notUsedByClient();
}

@Override
public Response deleteGlossary(LocaleId locale) {
return Response.ok().build();
public Response deleteEntry(Long id) {
return MockResourceUtil.notUsedByClient();
}

@Override
public Response deleteGlossaries() {
return Response.ok().build();
public Response deleteAllEntries() {
return null;
}
}

2 changes: 1 addition & 1 deletion zanata-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.zanata</groupId>
<artifactId>client</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.9.0-SNAPSHOT</version>
</parent>
<artifactId>zanata-cli</artifactId>
<name>Zanata command-line client</name>
Expand Down
2 changes: 1 addition & 1 deletion zanata-client-commands/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.zanata</groupId>
<artifactId>client</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.9.0-SNAPSHOT</version>
</parent>
<artifactId>zanata-client-commands</artifactId>
<name>Zanata client commands</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.slf4j.LoggerFactory;
import org.zanata.client.commands.ConfigurableCommand;
import org.zanata.client.commands.OptionsUtil;
import org.zanata.common.LocaleId;
import org.zanata.rest.client.GlossaryClient;
import org.zanata.rest.client.RestClientFactory;

Expand Down Expand Up @@ -55,16 +54,15 @@ public GlossaryDeleteCommand(GlossaryDeleteOptions opts) {
public void run() throws Exception {
log.info("Server: {}", getOpts().getUrl());
log.info("Username: {}", getOpts().getUsername());
log.info("Locale to delete: {}", getOpts().getlang());
log.info("Entry id to delete: {}", getOpts().getId());
log.info("Delete entire glossary?: {}", getOpts().getAllGlossary());

if (getOpts().getAllGlossary()) {
glossaryClient.deleteAll();
} else if (!StringUtils.isEmpty(getOpts().getlang())) {
glossaryClient.delete(new LocaleId(getOpts()
.getlang()));
} else if (!StringUtils.isEmpty(getOpts().getId())) {
glossaryClient.delete(getOpts().getId());
} else {
throw new RuntimeException("Option 'zanata.lang' is required.");
throw new RuntimeException("Option 'zanata.resId' is required.");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.zanata.client.commands.ConfigurableProjectOptions;

public interface GlossaryDeleteOptions extends ConfigurableProjectOptions {
public String getlang();
public String getId();

public boolean getAllGlossary();
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import org.zanata.common.LocaleId;
import org.zanata.rest.client.GlossaryClient;
import org.zanata.rest.client.RestClientFactory;
import org.zanata.rest.dto.Glossary;
import org.zanata.rest.dto.GlossaryEntry;

/**
*
Expand Down Expand Up @@ -71,10 +71,11 @@ public GlossaryPushCommand(GlossaryPushOptions opts) {
glossaryReaders.put("po", new GlossaryPoReader(
getLocaleFromMap(getOpts().getSourceLang()),
getLocaleFromMap(getOpts().getTransLang()), getOpts()
.getTreatSourceCommentsAsTarget(), getOpts()
.getBatchSize()));
glossaryReaders.put("csv", new GlossaryCSVReader(getOpts()
.getCommentCols(), getOpts().getBatchSize()));
glossaryReaders
.put("csv", new GlossaryCSVReader(getLocaleFromMap(
getOpts().getSourceLang()),
getOpts().getBatchSize()));
}

private LocaleId getLocaleFromMap(String localLocale) {
Expand Down Expand Up @@ -117,8 +118,6 @@ public void run() throws Exception {
log.info("Username: {}", getOpts().getUsername());
log.info("Source language: {}", getOpts().getSourceLang());
log.info("Translation language: {}", getOpts().getTransLang());
log.info("All translation comment: {}", getOpts()
.getTreatSourceCommentsAsTarget());
log.info("Glossary file: {}", getOpts().getGlossaryFile());
log.info("Batch size: {}", getOpts().getBatchSize());

Expand All @@ -129,6 +128,10 @@ public void run() throws Exception {
+ "' does not exist - check glossaryFile option");
}

if (getOpts().getSourceLang() == null || getOpts().getSourceLang().length() < 0) {
throw new RuntimeException("Need to specify source language.");
}

if (getOpts().getBatchSize() <= 0) {
throw new RuntimeException("Batch size needs to be 1 or more.");
}
Expand All @@ -145,19 +148,18 @@ public void run() throws Exception {
"UTF-8");
BufferedReader br = new BufferedReader(inputStreamReader);

List<Glossary> glossaries = reader.extractGlossary(br);
List<List<GlossaryEntry>> glossaries = reader.extractGlossary(br);

int totalEntries = 0;
for (Glossary glossary : glossaries) {
totalEntries = totalEntries + glossary.getGlossaryEntries().size();
for (List<GlossaryEntry> entries : glossaries) {
totalEntries = totalEntries + entries.size();
log.debug("total entries:" + totalEntries);
}

int totalDone = 0;
for (Glossary glossary : glossaries) {
log.debug(glossary.toString());
client.put(glossary);
totalDone = totalDone + glossary.getGlossaryEntries().size();
for (List<GlossaryEntry> entries : glossaries) {
client.post(entries);
totalDone = totalDone + entries.size();
log.info("Pushed " + totalDone + " of " + totalEntries + " entries");
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.zanata.client.commands.glossary.push;

import java.io.File;
import java.util.List;

import org.zanata.client.commands.ConfigurableProjectOptions;

Expand All @@ -13,8 +12,4 @@ public interface GlossaryPushOptions extends ConfigurableProjectOptions {
public String getTransLang();

public int getBatchSize();

public boolean getTreatSourceCommentsAsTarget();

public List<String> getCommentCols();
}
2 changes: 1 addition & 1 deletion zanata-maven-plugin/demo-glossary/compendium/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<plugin>
<groupId>org.zanata</groupId>
<artifactId>zanata-maven-plugin</artifactId>
<version>1.5-SNAPSHOT</version>
<version>3.7.2-SNAPSHOT</version>
<configuration>
<glossaryFile>fr.po</glossaryFile>
<transLang>pl</transLang>
Expand Down
2 changes: 1 addition & 1 deletion zanata-maven-plugin/demo-glossary/csv/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<plugin>
<groupId>org.zanata</groupId>
<artifactId>zanata-maven-plugin</artifactId>
<version>1.5-SNAPSHOT</version>
<version>3.7.2-SNAPSHOT</version>
<configuration>
<glossaryFile>translate1.csv</glossaryFile>
</configuration>
Expand Down
2 changes: 1 addition & 1 deletion zanata-maven-plugin/demo-glossary/delete/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<plugin>
<groupId>org.zanata</groupId>
<artifactId>zanata-maven-plugin</artifactId>
<version>1.8.0-SNAPSHOT</version>
<version>3.7.2-SNAPSHOT</version>
<configuration>
<lang>zh</lang>
<allGlossary>true</allGlossary>
Expand Down
2 changes: 1 addition & 1 deletion zanata-maven-plugin/demo-glossary/fuel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<plugin>
<groupId>org.zanata</groupId>
<artifactId>zanata-maven-plugin</artifactId>
<version>1.8.0-SNAPSHOT</version>
<version>3.7.2-SNAPSHOT</version>
<configuration>
<glossaryFile>fuel_hi.po</glossaryFile>
<transLang>hi</transLang>
Expand Down
2 changes: 1 addition & 1 deletion zanata-maven-plugin/demo-publican/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<plugin>
<groupId>org.zanata</groupId>
<artifactId>zanata-maven-plugin</artifactId>
<version>1.5-SNAPSHOT</version>
<version>3.7.2-SNAPSHOT</version>
<configuration>
<srcDir>${zanata.srcDir}</srcDir>
<transDir>${zanata.transDir}</transDir>
Expand Down
2 changes: 1 addition & 1 deletion zanata-maven-plugin/demo-xliff/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<plugin>
<groupId>org.zanata</groupId>
<artifactId>zanata-maven-plugin</artifactId>
<version>1.5-SNAPSHOT</version>
<version>3.7.4-SNAPSHOT</version>
<configuration>
<projectType>xliff</projectType>
<srcDir>${zanata.srcDir}</srcDir>
Expand Down
2 changes: 1 addition & 1 deletion zanata-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.zanata</groupId>
<artifactId>client</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.9.0-SNAPSHOT</version>

</parent>
<artifactId>zanata-maven-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion zanata-maven-plugin/sample-scripts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<plugin>
<groupId>org.zanata</groupId>
<artifactId>zanata-maven-plugin</artifactId>
<version>1.4.4</version>
<version>3.7.4-SNAPSHOT</version>
<configuration>
<srcDir>.</srcDir>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public class GlossaryDeleteMojo extends
GlossaryDeleteOptions {

/**
* Locale of glossary to delete
* id of glossary to delete
*
* @parameter expression="${zanata.lang}"
* @parameter expression="${zanata.id}"
*/
private String lang;
private String id;

/**
* Delete entire glossaries
Expand All @@ -53,8 +53,8 @@ public class GlossaryDeleteMojo extends
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD",
justification = "Injected by Maven")
@Override
public String getlang() {
return lang;
public String getId() {
return id;
}

@Override
Expand Down
Loading

0 comments on commit bd1b3de

Please sign in to comment.