Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
seanf committed Sep 27, 2017
1 parent 5c1b553 commit f7e3691
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 18 deletions.
5 changes: 3 additions & 2 deletions server/functional-test/pom.xml
Expand Up @@ -298,9 +298,10 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>

<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>

<dependency>
Expand Down
@@ -1,7 +1,6 @@
package org.zanata.feature.manual;

import com.google.common.collect.ImmutableList;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -15,6 +14,8 @@
import org.zanata.util.SampleDataRule;
import org.zanata.util.ZanataRestCaller;
import java.util.List;

import static org.zanata.util.RandomStringUtils.randomAlphabetic;
import static org.zanata.util.ZanataRestCaller.*;

/**
Expand Down Expand Up @@ -72,7 +73,7 @@ private static TextFlow[] generateTextFlows(int numOfTextFlows) {
TextFlow[] textFlows = new TextFlow[numOfTextFlows];
for (int i = 0; i < textFlows.length; i++) {
textFlows[i] = buildTextFlow("res" + i,
RandomStringUtils.randomAlphabetic(10));
randomAlphabetic(10));
}
return textFlows;
}
Expand Down
Expand Up @@ -27,7 +27,6 @@
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.commons.lang3.RandomStringUtils;
import org.apache.deltaspike.jpa.api.transaction.Transactional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -40,6 +39,7 @@
import org.zanata.service.UserAccountService;
import org.zanata.ui.faces.FacesMessages;

import static org.zanata.util.RandomStringUtils.randomAlphanumeric;

@Named("adminCreateUserAction")
@ViewScoped
Expand Down Expand Up @@ -92,7 +92,7 @@ public String saveNewUser() {

String activationKey =
registerService.register(username,
RandomStringUtils.randomAlphanumeric(8), username,
randomAlphanumeric(8), username,
email);
log.info("get register key:" + activationKey);

Expand Down
Expand Up @@ -22,7 +22,7 @@

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.infinispan.Cache;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.stats.Stats;
Expand Down
Expand Up @@ -31,7 +31,7 @@
import javax.validation.constraints.Size;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;
import javax.annotation.PostConstruct;
Expand Down
Expand Up @@ -247,7 +247,7 @@ public void getDetailedIterationStatisticsForSpecificLocales() {
@Test
public void getSimpleDocumentStatisticsForAllLocales() {
ContainerTranslationStatistics stats =
statisticsService.getStatistics("sample-project", "1.0",
statisticsService.getStatisticsWithDocId("sample-project", "1.0",
"my/path/document.txt", false, new String[] {});

// Make sure the id matches
Expand Down Expand Up @@ -280,7 +280,7 @@ public void getDetailedDocumentStatisticsForSpecificLocales() {
String[] locales = new String[] { "en-US", "es", "as" };

ContainerTranslationStatistics stats =
statisticsService.getStatistics("sample-project", "1.0",
statisticsService.getStatisticsWithDocId("sample-project", "1.0",
"my/path/document.txt", true, locales);

// Make sure the id matches
Expand Down
Expand Up @@ -22,6 +22,7 @@

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
Expand All @@ -36,7 +37,6 @@
import javax.persistence.TemporalType;
import javax.persistence.Version;

import org.apache.commons.lang3.ObjectUtils;
import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FieldBridge;
Expand Down Expand Up @@ -136,14 +136,14 @@ public boolean equals(Object obj) {
assert overridesEquals(this);
assert overridesEquals(obj);
ModelEntityBase other = (ModelEntityBase) obj;
if (!ObjectUtils.equals(getCreationDate(), other.getCreationDate()))
if (!Objects.equals(getCreationDate(), other.getCreationDate()))
return false;
if (getId() == null) {
if (other.getId() != null)
return false;
} else if (!getId().equals(other.getId()))
return false;
if (!ObjectUtils.equals(getLastChanged(), other.getLastChanged()))
if (!Objects.equals(getLastChanged(), other.getLastChanged()))
return false;
return true;
}
Expand Down
Expand Up @@ -4,7 +4,6 @@
import javax.inject.Provider;
import javax.validation.ConstraintValidatorContext;

import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
Expand All @@ -14,6 +13,7 @@
import static java.util.Collections.emptySet;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
import static org.zanata.util.RandomStringUtils.randomAlphabetic;

public class EmailDomainValidatorTest {

Expand All @@ -37,9 +37,9 @@ public void nullOrBlankStringIsValid() {
}

@Test
public void anyEmailIsvalidWhenNoRestrictionOnEmailDomain() {
public void anyEmailIsValidWhenNoRestrictionOnEmailDomain() {
when(emailDomainsProvider.get()).thenReturn(emptySet());
assertThat(validator.isValid(RandomStringUtils.randomAlphabetic(5), context)).isTrue();
assertThat(validator.isValid(randomAlphabetic(5), context)).isTrue();

}

Expand Down
Expand Up @@ -36,8 +36,8 @@
import org.zanata.security.ZanataIdentity;
import com.google.common.base.Charsets;

import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
import static org.zanata.util.RandomStringUtils.randomAlphabetic;
import static org.zanata.util.RandomStringUtils.randomAlphanumeric;

/**
* @author Patrick Huang <a href="mailto:pahuang@redhat.com">pahuang@redhat.com</a>
Expand Down

0 comments on commit f7e3691

Please sign in to comment.