Bael 4461 2 (#4444)

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* Fix verification times
This commit is contained in:
Amit Pandey
2018-06-11 10:18:30 +02:00
committed by Grzegorz Piwowarek
parent 096826cc07
commit a54c9e0c9e
40 changed files with 201 additions and 101 deletions
@@ -1,25 +1,30 @@
package com.baeldung.poi.powerpoint;
import java.io.File;
import java.util.List;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFShape;
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import java.io.File;
import java.util.List;
import org.junit.rules.TemporaryFolder;
public class PowerPointIntegrationTest {
private PowerPointHelper pph;
private String fileLocation;
private static final String FILE_NAME = "presentation.pptx";
@Rule
public TemporaryFolder tempFolder = new TemporaryFolder();
@Before
public void setUp() throws Exception {
File currDir = new File(".");
File currDir = tempFolder.newFolder();
String path = currDir.getAbsolutePath();
fileLocation = path.substring(0, path.length() - 1) + FILE_NAME;
@@ -46,7 +46,7 @@ public class JaggedArrayUnitTest {
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
System.setOut(new PrintStream(outContent));
obj.printElements(jaggedArr);
assertEquals("[1, 2]\n[3, 4, 5]\n[6, 7, 8, 9]\n", outContent.toString());
assertEquals("[1, 2][3, 4, 5][6, 7, 8, 9]", outContent.toString().replace("\r", "").replace("\n", ""));
System.setOut(System.out);
}
@@ -179,7 +179,7 @@ public class JavaMoneyUnitManualTest {
MonetaryAmountFormat customFormat = MonetaryFormats.getAmountFormat(AmountFormatQueryBuilder
.of(Locale.US)
.set(CurrencyStyle.NAME)
.set("pattern", "00000.00 �")
.set("pattern", "00000.00 US Dollar")
.build());
String customFormatted = customFormat.format(oneDollar);
@@ -104,7 +104,7 @@ public class NashornUnitTest {
public void loadExamples() throws ScriptException {
Object loadResult = engine.eval("load('classpath:js/script.js');" + "increment(5)");
Assert.assertEquals(6.0, loadResult);
Assert.assertEquals(6, ((Double) loadResult).intValue());
Object math = engine.eval("var math = loadWithNewGlobal('classpath:js/math_module.js');" + "math.increment(5);");
@@ -5,6 +5,7 @@ import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.couchbase.client.java.Bucket;
@@ -18,6 +19,11 @@ public class ClusterServiceImpl implements ClusterService {
private Cluster cluster;
private Map<String, Bucket> buckets = new ConcurrentHashMap<>();
@Autowired
public ClusterServiceImpl(Cluster cluster) {
this.cluster = cluster;
}
@PostConstruct
private void init() {
@@ -18,6 +18,7 @@ public class TutorialBucketService extends AbstractBucketService {
@Autowired
public TutorialBucketService(ClusterService clusterService) {
super(clusterService);
openBucket();
}
@Override
@@ -0,0 +1,24 @@
package com.baeldung.couchbase.async.person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import com.couchbase.client.java.Cluster;
import com.couchbase.client.java.CouchbaseCluster;
import com.couchbase.client.java.env.CouchbaseEnvironment;
import com.couchbase.client.java.env.DefaultCouchbaseEnvironment;
@Configuration
@ComponentScan(basePackages = {"com.baeldung.couchbase.async.service", "com.baeldung.couchbase.n1ql"})
public class PersonCrudServiceIntegrationTestConfig {
@Bean
public Cluster cluster() {
CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
.connectTimeout(60000)
.build();
return CouchbaseCluster.create(env, "127.0.0.1");
}
}
@@ -1,27 +1,31 @@
package com.baeldung.couchbase.async.person;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.annotation.PostConstruct;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.baeldung.couchbase.async.AsyncIntegrationTest;
import com.baeldung.couchbase.async.person.Person;
import com.baeldung.couchbase.async.person.PersonCrudService;
import com.baeldung.couchbase.async.person.PersonDocumentConverter;
import com.baeldung.couchbase.async.service.BucketService;
import com.couchbase.client.java.Bucket;
import com.couchbase.client.java.document.JsonDocument;
public class PersonCrudServiceIntegrationTest extends AsyncIntegrationTest {
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {PersonCrudServiceIntegrationTestConfig.class})
public class PersonCrudServiceLiveTest extends AsyncIntegrationTest {
@Autowired
private PersonCrudService personService;
@@ -35,8 +39,8 @@ public class PersonCrudServiceIntegrationTest extends AsyncIntegrationTest {
private Bucket bucket;
@PostConstruct
private void init() {
@Before
public void init() {
bucket = bucketService.getBucket();
}
@@ -18,7 +18,7 @@ import com.couchbase.client.java.Bucket;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { AsyncIntegrationTestConfig.class })
@TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class })
public class ClusterServiceIntegrationTest extends AsyncIntegrationTest {
public class ClusterServiceLiveTest extends AsyncIntegrationTest {
@Autowired
private ClusterService couchbaseService;
@@ -14,8 +14,8 @@ import com.couchbase.client.java.document.JsonDocument;
import com.couchbase.client.java.view.ViewResult;
import com.couchbase.client.java.view.ViewRow;
public class StudentGradeServiceIntegrationTest {
private static final Logger logger = LoggerFactory.getLogger(StudentGradeServiceIntegrationTest.class);
public class StudentGradeServiceLiveTest {
private static final Logger logger = LoggerFactory.getLogger(StudentGradeServiceLiveTest.class);
static StudentGradeService studentGradeService;
static Set<String> gradeIds = new HashSet<>();
@@ -1,5 +1,23 @@
package com.baeldung.couchbase.n1ql;
import static com.baeldung.couchbase.n1ql.CodeSnippets.extractJsonResult;
import static com.couchbase.client.java.query.Select.select;
import static com.couchbase.client.java.query.dsl.Expression.i;
import static com.couchbase.client.java.query.dsl.Expression.s;
import static com.couchbase.client.java.query.dsl.Expression.x;
import static org.junit.Assert.assertNotNull;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.couchbase.client.java.Bucket;
import com.couchbase.client.java.Cluster;
import com.couchbase.client.java.document.JsonDocument;
@@ -10,28 +28,13 @@ import com.couchbase.client.java.query.N1qlQueryResult;
import com.couchbase.client.java.query.N1qlQueryRow;
import com.couchbase.client.java.query.Statement;
import com.fasterxml.jackson.databind.JsonNode;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import rx.Observable;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import static com.baeldung.couchbase.n1ql.CodeSnippets.extractJsonResult;
import static com.couchbase.client.java.query.Select.select;
import static com.couchbase.client.java.query.dsl.Expression.*;
import static org.junit.Assert.assertNotNull;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { IntegrationTestConfig.class })
public class N1QLIntegrationTest {
public class N1QLLiveTest {
@Autowired
@@ -10,7 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.baeldung.couchbase.spring.IntegrationTest;
public class PersonCrudServiceIntegrationTest extends IntegrationTest {
public class PersonCrudServiceLiveTest extends IntegrationTest {
private static final String CLARK_KENT = "Clark Kent";
private static final String SMALLVILLE = "Smallville";
@@ -17,7 +17,7 @@ import com.couchbase.client.java.Bucket;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { IntegrationTestConfig.class })
@TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class })
public class ClusterServiceIntegrationTest extends IntegrationTest {
public class ClusterServiceLiveTest extends IntegrationTest {
@Autowired
private ClusterService couchbaseService;
+5
View File
@@ -39,6 +39,11 @@
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
@@ -0,0 +1,9 @@
# Root logger
log4j.rootLogger=INFO, file, stdout
# Write to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
@@ -44,7 +44,7 @@ public class JaxbIntegrationTest {
File bookFile = new File(this.getClass().getResource("/book.xml").getFile());
String sampleBookXML = FileUtils.readFileToString(sampleBookFile, "UTF-8");
String marshallerBookXML = FileUtils.readFileToString(bookFile, "UTF-8");
Assert.assertEquals(sampleBookXML, marshallerBookXML);
Assert.assertEquals(sampleBookXML.replace("\r", "").replace("\n", ""), marshallerBookXML.replace("\r", "").replace("\n", ""));
}
@Test
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<book id="1">
<title>Book1</title>
<date>2016-12-16T17:28:49.718Z</date>
</book>
@@ -22,7 +22,7 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
@RunWith(Arquillian.class)
public class ConvListValIntegrationTest {
public class ConvListValLiveTest {
@ArquillianResource
private URL deploymentUrl;
@@ -21,7 +21,7 @@ import static org.hamcrest.Matchers.equalTo;
@RunWith(Arquillian.class)
public class AutomaticTimerBeanIntegrationTest {
public class AutomaticTimerBeanLiveTest {
//the @AutomaticTimerBean has a method called every 10 seconds
//testing the difference ==> 100000
@@ -21,7 +21,7 @@ import static org.hamcrest.Matchers.is;
@RunWith(Arquillian.class)
public class ProgrammaticAtFixedRateTimerBeanIntegrationTest {
public class ProgrammaticAtFixedRateTimerBeanLiveTest {
final static long TIMEOUT = 1000;
final static long TOLERANCE = 500l;
@@ -19,7 +19,7 @@ import static org.hamcrest.Matchers.is;
@RunWith(Arquillian.class)
public class ProgrammaticTimerBeanIntegrationTest {
public class ProgrammaticTimerBeanLiveTest {
final static long TIMEOUT = 5000l;
final static long TOLERANCE = 1000l;
@@ -21,7 +21,7 @@ import static org.hamcrest.Matchers.is;
@RunWith(Arquillian.class)
public class ProgrammaticWithFixedDelayTimerBeanIntegrationTest {
public class ProgrammaticWithFixedDelayTimerBeanLiveTest {
final static long TIMEOUT = 15000l;
final static long TOLERANCE = 1000l;
@@ -20,7 +20,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
@RunWith(Arquillian.class)
public class ScheduleTimerBeanIntegrationTest {
public class ScheduleTimerBeanLiveTest {
private final static long TIMEOUT = 5000l;
private final static long TOLERANCE = 1000l;
@@ -15,7 +15,7 @@ import org.junit.Test;
import com.baeldung.jpa.model.Car;
public class StoredProcedureIntegrationTest {
public class StoredProcedureLiveTest {
private static EntityManagerFactory factory = null;
private static EntityManager entityManager = null;
@@ -15,12 +15,13 @@ import static org.junit.Assert.assertEquals;
public class EntryProcessorIntegrationTest {
private static final String CACHE_NAME = "MyCache";
private static final String CACHE_PROVIDER_NAME = "com.hazelcast.cache.HazelcastCachingProvider";
private Cache<String, String> cache;
@Before
public void instantiateCache() {
CachingProvider cachingProvider = Caching.getCachingProvider();
CachingProvider cachingProvider = Caching.getCachingProvider(CACHE_PROVIDER_NAME);
CacheManager cacheManager = cachingProvider.getCacheManager();
MutableConfiguration<String, String> config = new MutableConfiguration<>();
this.cache = cacheManager.createCache(CACHE_NAME, config);
@@ -29,7 +30,7 @@ public class EntryProcessorIntegrationTest {
@After
public void tearDown() {
Caching.getCachingProvider().getCacheManager().destroyCache(CACHE_NAME);
Caching.getCachingProvider(CACHE_PROVIDER_NAME).getCacheManager().destroyCache(CACHE_NAME);
}
@Test
@@ -17,6 +17,7 @@ import static org.junit.Assert.assertEquals;
public class EventListenerIntegrationTest {
private static final String CACHE_NAME = "MyCache";
private static final String CACHE_PROVIDER_NAME = "com.hazelcast.cache.HazelcastCachingProvider";
private Cache<String, String> cache;
private SimpleCacheEntryListener listener;
@@ -24,7 +25,7 @@ public class EventListenerIntegrationTest {
@Before
public void setup() {
CachingProvider cachingProvider = Caching.getCachingProvider();
CachingProvider cachingProvider = Caching.getCachingProvider(CACHE_PROVIDER_NAME);
CacheManager cacheManager = cachingProvider.getCacheManager();
MutableConfiguration<String, String> config = new MutableConfiguration<String, String>();
this.cache = cacheManager.createCache("MyCache", config);
@@ -33,7 +34,7 @@ public class EventListenerIntegrationTest {
@After
public void tearDown() {
Caching.getCachingProvider().getCacheManager().destroyCache(CACHE_NAME);
Caching.getCachingProvider(CACHE_PROVIDER_NAME).getCacheManager().destroyCache(CACHE_NAME);
}
@Test
@@ -14,7 +14,7 @@ public class JCacheIntegrationTest {
@Test
public void instantiateCache() {
CachingProvider cachingProvider = Caching.getCachingProvider();
CachingProvider cachingProvider = Caching.getCachingProvider("com.hazelcast.cache.HazelcastCachingProvider");
CacheManager cacheManager = cachingProvider.getCacheManager();
MutableConfiguration<String, String> config = new MutableConfiguration<>();
Cache<String, String> cache = cacheManager.createCache("simpleCache", config);
@@ -2,6 +2,6 @@
<ConnectionManager className="com.gs.fw.common.mithra.test.ConnectionManagerForTests">
<Property name="resourceName" value="testDb"/>
<MithraObjectConfiguration className="com.baeldung.reladomo.Department" cacheType="partial"/>
<MithraObjectConfiguration className="com.baeldung.reladomo.Employee " cacheType="partial"/>
<MithraObjectConfiguration className="com.baeldung.reladomo.Employee" cacheType="partial"/>
</ConnectionManager>
</MithraRuntime>
@@ -12,6 +12,7 @@ import org.apache.logging.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
public class JSONLayoutIntegrationTest extends Log4j2BaseIntegrationTest {
@@ -0,0 +1,9 @@
# Root logger
log4j.rootLogger=INFO, file, stdout
# Write to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

Some files were not shown because too many files have changed in this diff Show More