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

Commit

Permalink
Merge branch 'integration/master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
definite committed Nov 10, 2015
2 parents 43d0413 + 36c2f55 commit ef42b4a
Show file tree
Hide file tree
Showing 23 changed files with 167 additions and 112 deletions.
10 changes: 9 additions & 1 deletion .travis.yml
@@ -1,8 +1,16 @@
# use http://docs.travis-ci.com/user/workers/container-based-infrastructure/
sudo: false

# cache local Maven repo: http://docs.travis-ci.com/user/caching/
cache:
directories:
- $HOME/.m2/repository

language: java

# Use the 'true' command to avoid up-front dependency fetching, for faster builds
# See http://docs.travis-ci.com/user/languages/java/#Dependency-Management
install: true
install: /bin/true

script: |
mvn test \
Expand Down
1 change: 1 addition & 0 deletions docs/.gitattributes
@@ -0,0 +1 @@
release-notes.md merge=union
5 changes: 5 additions & 0 deletions docs/index.md
Expand Up @@ -31,6 +31,11 @@ Contribute
- [Issue Tracker](http://bugzilla.redhat.com/buglist.cgi?product=Zanata)
- [Source Code on GitHub](http://github.com/zanata-client)

Release notes
-------

[Release notes](release-notes.md)

Contact us
-------

Expand Down
17 changes: 17 additions & 0 deletions docs/release-notes.md
@@ -0,0 +1,17 @@
## 3.8.0

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

-----------------------

##### Bug fixes
*

-----------------------

##### New Features
*

-----------------------

18 changes: 12 additions & 6 deletions pom.xml
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.7.5-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
<name>Zanata client modules</name>
<packaging>pom</packaging>
<parent>
<groupId>org.zanata</groupId>
<artifactId>zanata-parent</artifactId>
<version>24</version>
<version>25-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>

Expand All @@ -35,9 +35,9 @@
</repositories>

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

Expand Down Expand Up @@ -122,6 +122,12 @@
<groupId>org.zanata</groupId>
<artifactId>zanata-adapter-xliff</artifactId>
<version>${zanata.common.version}</version>
<exclusions>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.zanata</groupId>
Expand Down Expand Up @@ -193,7 +199,7 @@
<artifactId>httpclient</artifactId>
<!-- When we upgrade to 4.3 again, please remove the SSLSocketFactory
from ZanataProxyFactory -->
<version>4.2.5</version>
<version>4.2.6</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
Expand Down
8 changes: 7 additions & 1 deletion stub-server/pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.zanata</groupId>
<artifactId>client</artifactId>
<version>3.7.5-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
</parent>
<artifactId>stub-server</artifactId>
<name>stub-server</name>
Expand Down Expand Up @@ -79,6 +79,12 @@
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<exclusions>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
Expand Down
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
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.zanata</groupId>
<artifactId>client</artifactId>
<version>3.7.5-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
</parent>
<artifactId>zanata-cli</artifactId>
<name>Zanata command-line client</name>
Expand Down
22 changes: 21 additions & 1 deletion zanata-client-commands/pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.zanata</groupId>
<artifactId>client</artifactId>
<version>3.7.5-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>
</parent>
<artifactId>zanata-client-commands</artifactId>
<name>Zanata client commands</name>
Expand All @@ -21,6 +21,16 @@
<dependency>
<groupId>org.zanata</groupId>
<artifactId>zanata-common-api</artifactId>
<exclusions>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.zanata</groupId>
Expand All @@ -41,6 +51,16 @@
<dependency>
<groupId>org.zanata</groupId>
<artifactId>zanata-rest-client</artifactId>
<exclusions>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.zanata</groupId>
Expand Down
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
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();
}
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
@@ -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();
}
Expand Up @@ -127,6 +127,9 @@ public static void logOptions(Logger logger, PushOptions opts) {
copyTransMssg = "disabled since pushType=Trans";
}
logger.info("Copy previous translations: {}", copyTransMssg);
if (!opts.getCopyTrans() && opts.getPushType() != PushPullType.Trans) {
logger.warn("As of Zanata Client 3.8.0, copyTrans is disabled by default.");
}

logger.info("Merge type: {}", opts.getMergeType());
logger.info("Enable modules: {}", opts.getEnableModules());
Expand Down
Expand Up @@ -39,7 +39,7 @@ public class PushOptionsImpl extends AbstractPushPullOptionsImpl<PushOptions>
private static final boolean DEF_EXCLUDES = true;
private static final boolean DEF_CASE_SENSITIVE = true;
private static final boolean DEF_EXCLUDE_LOCALES = true;
private static final boolean DEF_COPYTRANS = true;
private static final boolean DEF_COPYTRANS = false;
private static final boolean DEF_MY_TRANS = false;
private static final int DEF_CHUNK_SIZE = 1024 * 1024;
/** @see org.zanata.common.MergeType for options */
Expand Down
2 changes: 1 addition & 1 deletion zanata-maven-plugin/pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.zanata</groupId>
<artifactId>client</artifactId>
<version>3.7.5-SNAPSHOT</version>
<version>3.8.0-SNAPSHOT</version>

</parent>
<artifactId>zanata-maven-plugin</artifactId>
Expand Down

0 comments on commit ef42b4a

Please sign in to comment.