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 project-page
Browse files Browse the repository at this point in the history
Conflicts:
	zanata-war/src/main/java/org/zanata/action/ViewAllStatusAction.java
	zanata-war/src/main/webapp/resources/script/components-script.js
	zanata-war/src/test/java/org/zanata/webtrans/server/rpc/GetLocaleListHandlerTest.java
  • Loading branch information
Alex Eng committed Apr 3, 2014
2 parents 78e782a + 5e0a2e9 commit 35ab5a3
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 50 deletions.
4 changes: 2 additions & 2 deletions .gitattributes
@@ -1,7 +1,7 @@
# See https://help.github.com/articles/dealing-with-line-endings

# This setting tells git to always normalize the files specified.
# When committed they are stored with LF, on checkout they are
# This setting tells git always to normalize the files specified.
# When committed they are stored with LF, on checkout they are
# converted to the OS's native line endings.
* text

Expand Down
1 change: 0 additions & 1 deletion branch-release.sh
Expand Up @@ -19,4 +19,3 @@ git commit pom.xml */pom.xml -m "prepare for next development iteration"

# push all the changes back to the server
git push origin legacy release integration/master

7 changes: 7 additions & 0 deletions pom.xml
Expand Up @@ -124,6 +124,13 @@
<scope>import</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>1.6.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.opensymphony.quartz</groupId>
<artifactId>quartz</artifactId>
Expand Down
Expand Up @@ -69,6 +69,7 @@ public ConfigurableNgramAnalyzer(int ngramMinLength, int ngramMaxLength,
this.foldCase = foldCase;
}

@SuppressWarnings("resource") // caller should close
@Override
public TokenStream tokenStream(String fieldName, Reader reader) {
TokenStream tokenStream;
Expand Down
Expand Up @@ -20,12 +20,15 @@
*/
package org.zanata.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import javax.validation.constraints.NotNull;

import lombok.NoArgsConstructor;
Expand All @@ -46,7 +49,8 @@
@Setter
@NoArgsConstructor
@ToString(of = "comment")
public class HTermComment {
public class HTermComment implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;

private String comment;
Expand Down
3 changes: 1 addition & 2 deletions zanata-model/src/main/java/org/zanata/model/HTextFlow.java
Expand Up @@ -447,8 +447,7 @@ private void updateContentHash() {
this.setContentHash(HashUtil.generateHash(contents));
}

private String toBCP47(HLocale hLocale) {
HLocale docLocale = document.getLocale();
private static String toBCP47(HLocale docLocale) {
if (docLocale == null) {
// *should* only happen in tests
log.warn("null locale, assuming 'en'");
Expand Down
22 changes: 11 additions & 11 deletions zanata-model/src/test/java/org/zanata/model/HGlossaryEntryTest.java
Expand Up @@ -40,13 +40,13 @@ public class HGlossaryEntryTest {
@BeforeTest
public void setup() {
entry = new HGlossaryEntry();
entry.setId(new Long(1));
entry.setId(1L);
entry.setVersionNum(1);
entry.setCreationDate(new Date());
entry.setLastChanged(new Date());

HLocale srcLang = new HLocale(LocaleId.EN_US);
setupHLocale(srcLang, new Long(1));
setupHLocale(srcLang, 1L);

entry.setSrcLocale(srcLang);
entry.setSourceRef("source ref");
Expand All @@ -59,7 +59,7 @@ public void hashMapDataTerm1Test() {

// Glossary Term 1 - EN_US
HLocale term1Locale =
setupTerm(new Long(1), "TERM 1", LocaleId.EN_US, new Long(1));
setupTerm(1L, "TERM 1", LocaleId.EN_US, 1L);

assertEquals(1, entry.getGlossaryTerms().size());
assertEquals(true, entry.getGlossaryTerms().containsKey(term1Locale));
Expand All @@ -74,11 +74,11 @@ public void hashMapDataTerm2Test() {

// Glossary Term 1 - EN_US
HLocale term1Locale =
setupTerm(new Long(1), "TERM 1", LocaleId.EN_US, new Long(1));
setupTerm(1L, "TERM 1", LocaleId.EN_US, 1L);

// Glossary Term 2 - DE
HLocale term2Locale =
setupTerm(new Long(2), "TERM 2", LocaleId.DE, new Long(2));
setupTerm(2L, "TERM 2", LocaleId.DE, 2L);

assertEquals(2, entry.getGlossaryTerms().size());
assertEquals(true, entry.getGlossaryTerms().containsKey(term2Locale));
Expand All @@ -93,15 +93,15 @@ public void hashMapDataTerm3Test() {

// Glossary Term 1 - EN_US
HLocale term1Locale =
setupTerm(new Long(1), "TERM 1", LocaleId.EN_US, new Long(1));
setupTerm(1L, "TERM 1", LocaleId.EN_US, 1L);

// Glossary Term 2 - DE
HLocale term2Locale =
setupTerm(new Long(2), "TERM 2", LocaleId.DE, new Long(2));
setupTerm(2L, "TERM 2", LocaleId.DE, 2L);

// Glossary Term 3 - ES
HLocale term3Locale =
setupTerm(new Long(3), "TERM 3", LocaleId.ES, new Long(3));
setupTerm(3L, "TERM 3", LocaleId.ES, 3L);

assertEquals(3, entry.getGlossaryTerms().size());
assertEquals(true, entry.getGlossaryTerms().containsKey(term3Locale));
Expand All @@ -115,13 +115,13 @@ public void hashMapDataTest() {
entry.getGlossaryTerms().clear();

// Glossary Term 1 - EN_US
setupTerm(new Long(1), "TERM 1", LocaleId.EN_US, new Long(1));
setupTerm(1L, "TERM 1", LocaleId.EN_US, 1L);

// Glossary Term 2 - DE
setupTerm(new Long(2), "TERM 2", LocaleId.DE, new Long(2));
setupTerm(2L, "TERM 2", LocaleId.DE, 2L);

// Glossary Term 3 - ES
setupTerm(new Long(3), "TERM 3", LocaleId.ES, new Long(3));
setupTerm(3L, "TERM 3", LocaleId.ES, 3L);

for (HLocale key : entry.getGlossaryTerms().keySet()) {
assertTrue(entry.getGlossaryTerms().containsKey(key));
Expand Down
21 changes: 11 additions & 10 deletions zanata-war/pom.xml
Expand Up @@ -129,7 +129,6 @@
<usedDependency>javax.xml.bind:jaxb-api</usedDependency>
<!-- runtime dep for liquibase logging -->
<usedDependency>com.mattbertolini:liquibase-slf4j</usedDependency>
<usedDependency>com.google.code.findbugs:annotations</usedDependency>
<usedDependency>org.opensymphony.quartz:quartz</usedDependency>
<!-- Used indirectly by org.zanata.arquillian.Deployments -->
<usedDependency>org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api</usedDependency>
Expand Down Expand Up @@ -442,22 +441,17 @@

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<argLine>-Dconcordion.output.dir=${concordion.output.dir}</argLine>
<junitArtifactName>none:none</junitArtifactName>
<testNGArtifactName>org.testng:testng</testNGArtifactName>
<forkMode>once</forkMode>
<argLine xml:space="preserve">-Xmx1024m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=${project.build.directory} -Dsun.lang.ClassLoader.allowArraySyntax=true</argLine>
<forkCount>1.5C</forkCount>
<reuseForks>false</reuseForks>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/AllNonContainerTests.tng.xml</suiteXmlFile>
</suiteXmlFiles>
<runOrder>alphabetical</runOrder>
<!-- TODO try parallel execution
<parallel>methods</parallel>
<threadCount>4</threadCount>
-->
</configuration>
<!-- below trick is to let surefire run both junit and testng.
see http://stackoverflow.com/questions/1232853/how-to-execute-junit-and-testng-tests-in-same-project-using-maven-surefire-plugi-->
Expand Down Expand Up @@ -1115,6 +1109,13 @@

<dependencies>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>


<!-- Zanata-specific dependencies -->

<dependency>
Expand Down Expand Up @@ -1926,7 +1927,7 @@
<dependency>
<groupId>org.ocpsoft.prettytime</groupId>
<artifactId>prettytime</artifactId>
<version>3.2.4.Final</version>
<version>3.0.2.Final</version>
</dependency>

<!-- openid4java -->
Expand Down
1 change: 0 additions & 1 deletion zanata-war/src/etc/FillInTranslationGap.groovy
Expand Up @@ -70,4 +70,3 @@ genPropNames.each {
}
log.info("processed {}", skeleton.name)
}

2 changes: 1 addition & 1 deletion zanata-war/src/main/java/org/zanata/dao/AccountDAO.java
Expand Up @@ -157,6 +157,6 @@ public List<HAccount> getAllMergedAccounts(HAccount mergedInto) {
"from HAccount as a where a.mergedInto = :mergedInto");
query.setParameter("mergedInto", mergedInto);
query.setComment("AccountDAO.getAllMergedAccounts");
return query.list();
return (List<HAccount>) query.list();
}
}
2 changes: 1 addition & 1 deletion zanata-war/src/main/java/org/zanata/dao/ActivityDAO.java
Expand Up @@ -134,7 +134,7 @@ public List<Activity> findLatestActivities(long personId, int offset,
query.setFirstResult(offset);
query.setCacheable(true);
query.setComment("activityDAO.findLatestActivities");
return query.list();
return (List<Activity>) query.list();
}

public int getActivityCountByActor(Long personId) {
Expand Down
8 changes: 4 additions & 4 deletions zanata-war/src/main/java/org/zanata/dao/PersonDAO.java
Expand Up @@ -185,13 +185,13 @@ public boolean isUserInLanguageTeamWithRoles(HPerson person,
.setParameter("language", language);

if (isTranslator != null) {
q.setParameter("isTranslator", isTranslator.booleanValue());
q.setParameter("isTranslator", isTranslator);
}
if (isReviewer != null) {
q.setParameter("isReviewer", isReviewer.booleanValue());
q.setParameter("isReviewer", isReviewer);
}
if (isCoordinator != null) {
q.setParameter("isCoordinator", isCoordinator.booleanValue());
q.setParameter("isCoordinator", isCoordinator);
}

q.setCacheable(false).setComment(
Expand All @@ -207,7 +207,7 @@ public List<HLocaleMember> getAllLanguageTeamMemberships(HPerson person) {
.setParameter("person", person);
q.setCacheable(false).setComment(
"PersonDAO.getAllLanguageTeamMemberships");
return q.list();
return (List<HLocaleMember>) q.list();
}

}
Expand Up @@ -35,6 +35,7 @@
// Implementation copied from
// https://source.jboss.org/browse/Seam/branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/navigation/SafeActions.java?r=14141
// following https://community.jboss.org/message/688860#688860
// TODO see if this can be removed - see also https://issues.jboss.org/browse/JBSEAM-4800
public class FixedSafeActions extends org.jboss.seam.navigation.SafeActions {

private Set<String> safeActions = Collections
Expand Down
Expand Up @@ -33,6 +33,8 @@
import com.google.gwt.user.client.rpc.IsSerializable;
import com.google.inject.Singleton;

import javax.annotation.Nonnull;

@Singleton
public class UserConfigHolder {
public static final Predicate<ContentState> INCOMPLETE_PREDICATE =
Expand All @@ -46,7 +48,7 @@ public boolean apply(ContentState contentState) {
public static final Predicate<ContentState> DRAFT_PREDICATE =
new Predicate<ContentState>() {
@Override
public boolean apply(ContentState contentState) {
public boolean apply(@Nonnull ContentState contentState) {
return contentState.isRejectedOrFuzzy();
}
};
Expand Down
Expand Up @@ -299,7 +299,7 @@ public void renderTable(List<TransMemoryResultItem> memories,
resultTable.getFlexCellFormatter().setStyleName(i + 1,
NUM_TRANS_COL, "txt--align-center");

if (i % 2 == 1) {
if (odd(i)) {
resultTable.getRowFormatter().setStyleName(i + 1, "oddRow");
}

Expand Down Expand Up @@ -348,6 +348,10 @@ public void onClick(ClickEvent event) {
}
}

private static boolean odd(int n) {
return n % 2 != 0;
}

@Override
public void redrawTable(List<TransMemoryResultItem> memories) {
for (int i = 0; i < memories.size(); i++) {
Expand Down
Expand Up @@ -34,11 +34,11 @@ public TabValidation(ValidationId id, ValidationMessages messages) {
super(id, messages.tabValidatorDesc(), messages);
}

@edu.umd.cs.findbugs.annotations.SuppressWarnings("GBU_GUAVA_BETA_CLASS_USAGE")
@Override
public List<String> doValidate(String source, String target) {
ArrayList<String> errors = new ArrayList<String>();

@edu.umd.cs.findbugs.annotations.SuppressWarnings("GBU_GUAVA_BETA_CLASS_USAGE")
CharMatcher tabs = CharMatcher.is('\t');
int sourceTabs = tabs.countIn(source);
int targetTabs = tabs.countIn(target);
Expand Down
Expand Up @@ -8,12 +8,12 @@
# SCRIPT Embedded scripting language - pass to another extractor
# SERVER Embedded server language tags such as JSP, PHP, Mason etc.
# ATTRIBUTE_TRANS, ATTRIBUTE_WRITABLE, ATTRIBUTE_READONLY, ATTRIBUTE_ID these rules list an attribute, not an element
# ATTRIBUTES_ONLY only attribute is translatable or localizable
# ATTRIBUTES_ONLY only attribute is translatable or localizable

#*********************************************************************************************
#*********************************************************************************************
# Operators for attribute value compare
#
# Rules are of the form:
# Rules are of the form:
# TO_EXTRACT_ATTRIBUTE:[IF_HAS_ATTRIBUTE, OPERATOR, VALUE]
# 'content':['http-equiv', EQUALS, 'keywords']
#
Expand All @@ -23,12 +23,12 @@
# Multiple attribute values may be included in a list:
# 'content':['http-equiv', EQUALS, ['content-language', 'content-type']]
#
# This rule would be read:
# extract the value of 'content' if the value of 'http-equiv' equals 'content-language' or 'content-type'
# This rule would be read:
# extract the value of 'content' if the value of 'http-equiv' equals 'content-language' or 'content-type'
#*******************************************************************************************/

# EQUALS
# NOT_EQUALS
# NOT_EQUALS
# MATCH regex match. Must match the entire attribute value

# ELEMENT AND ATTRIBUTE NAMES MUST BE LOWER CASED!!!!!!
Expand Down Expand Up @@ -61,7 +61,7 @@ attributes:
elements:
# only attributes are localizable or translatable - no PCDATA
# ATTRIBUTES_ONLY with translatableAttributes implies the tag will be a TEXTUNIT
# with embedded skeleton
# with embedded skeleton
meta:
ruleTypes: [ATTRIBUTES_ONLY]
translatableAttributes: {content: [[http-equiv, EQUALS, keywords], [name, EQUALS, [keywords, description]]]}
Expand Down Expand Up @@ -124,7 +124,7 @@ elements:

li:
ruleTypes: [TEXTUNIT]
translatableAttributes: [value]
translatableAttributes: [value]
idAttributes: [id]

marquee:
Expand Down Expand Up @@ -233,10 +233,10 @@ elements:

input:
ruleTypes: [INLINE]
translatableAttributes:
alt: [type, NOT_EQUALS, [file, hidden, image, Password]]
value: [type, NOT_EQUALS, [file, hidden, image, Password]]
accesskey: [type, NOT_EQUALS, [file, hidden, image, Password]]
translatableAttributes:
alt: [type, NOT_EQUALS, [file, hidden, image, Password]]
value: [type, NOT_EQUALS, [file, hidden, image, Password]]
accesskey: [type, NOT_EQUALS, [file, hidden, image, Password]]
title: [type, NOT_EQUALS, [file, hidden, image, Password]]
placeholder: null

Expand Down Expand Up @@ -371,4 +371,4 @@ elements:

# javascript etc.
script:
ruleTypes: [EXCLUDE]
ruleTypes: [EXCLUDE]

1 comment on commit 35ab5a3

@seanf
Copy link
Contributor

@seanf seanf commented on 35ab5a3 Apr 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aeng Careful! This merge threw away my changes to use AssertJ in GetLocaleListHandlerTest. Which broke the build because you left AssertJ in as an unused dependency. I'm in the process of applying the same changes to LocaleServiceImplTest, but the merge conflicts should have warned you that we had some integration to do!

Please sign in to comment.