Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JayGreeeen committed Oct 29, 2019
1 parent 81f9251 commit 6743333
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,21 @@
*/
package com.hotels.bdp.circustrain.integration;

import static org.apache.hadoop.fs.s3a.Constants.ACCESS_KEY;
import static org.apache.hadoop.fs.s3a.Constants.ENDPOINT;
import static org.apache.hadoop.fs.s3a.Constants.SECRET_KEY;
import static org.apache.hadoop.hive.metastore.MetaStoreUtils.isExternalTable;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.junit.Assert.assertThat;

import static com.hotels.bdp.circustrain.api.CircusTrainTableParameter.REPLICATION_EVENT;
import static com.hotels.bdp.circustrain.integration.IntegrationTestHelper.DATABASE;
import static com.hotels.bdp.circustrain.integration.IntegrationTestHelper.PART_00000;
import static com.hotels.bdp.circustrain.integration.IntegrationTestHelper.PARTITIONED_TABLE;
import static com.hotels.bdp.circustrain.integration.IntegrationTestHelper.PART_00000;
import static com.hotels.bdp.circustrain.integration.IntegrationTestHelper.UNPARTITIONED_TABLE;
import static com.hotels.bdp.circustrain.integration.utils.TestUtils.DATA_COLUMNS;
import static com.hotels.bdp.circustrain.integration.utils.TestUtils.toUri;
import static com.hotels.bdp.circustrain.s3s3copier.aws.AmazonS3URIs.toAmazonS3URI;
import static org.apache.hadoop.fs.s3a.Constants.ACCESS_KEY;
import static org.apache.hadoop.fs.s3a.Constants.ENDPOINT;
import static org.apache.hadoop.fs.s3a.Constants.SECRET_KEY;
import static org.apache.hadoop.hive.metastore.MetaStoreUtils.isExternalTable;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.junit.Assert.assertThat;

import java.io.File;
import java.net.URI;
Expand All @@ -47,14 +46,10 @@
import org.junit.contrib.java.lang.system.ExpectedSystemExit;
import org.junit.rules.TemporaryFolder;

import fm.last.commons.test.file.ClassDataFolder;
import fm.last.commons.test.file.DataFolder;

import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3URI;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.google.common.collect.ImmutableMap;

import com.hotels.bdp.circustrain.api.conf.Security;
import com.hotels.bdp.circustrain.common.test.base.CircusTrainRunner;
import com.hotels.bdp.circustrain.integration.utils.TestUtils;
Expand All @@ -64,6 +59,9 @@
import com.hotels.bdp.circustrain.s3s3copier.aws.JceksAmazonS3ClientFactory;
import com.hotels.beeju.ThriftHiveMetaStoreJUnitRule;

import fm.last.commons.test.file.ClassDataFolder;
import fm.last.commons.test.file.DataFolder;

public class CircusTrainHdfsS3IntegrationTest {

private static final String S3_ACCESS_KEY = "access";
Expand Down Expand Up @@ -129,7 +127,7 @@ private AmazonS3 newS3Client(String tableUri) {
.<String, Object> builder()
.put(S3S3CopierOptions.Keys.S3_ENDPOINT_URI.keyName(), s3Proxy.getUri().toString())
.build());
return s3ClientFactory.newInstance(base, s3s3CopierOptions);
return s3ClientFactory.newSourceInstance(base, s3s3CopierOptions);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,20 @@
*/
package com.hotels.bdp.circustrain.integration;

import static org.apache.hadoop.fs.s3a.Constants.ACCESS_KEY;
import static org.apache.hadoop.fs.s3a.Constants.ENDPOINT;
import static org.apache.hadoop.fs.s3a.Constants.SECRET_KEY;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.junit.Assert.assertThat;

import static com.hotels.bdp.circustrain.api.CircusTrainTableParameter.REPLICATION_EVENT;
import static com.hotels.bdp.circustrain.integration.IntegrationTestHelper.DATABASE;
import static com.hotels.bdp.circustrain.integration.IntegrationTestHelper.PART_00000;
import static com.hotels.bdp.circustrain.integration.IntegrationTestHelper.PARTITIONED_TABLE;
import static com.hotels.bdp.circustrain.integration.IntegrationTestHelper.PART_00000;
import static com.hotels.bdp.circustrain.integration.IntegrationTestHelper.UNPARTITIONED_TABLE;
import static com.hotels.bdp.circustrain.integration.utils.TestUtils.DATA_COLUMNS;
import static com.hotels.bdp.circustrain.integration.utils.TestUtils.toUri;
import static com.hotels.bdp.circustrain.s3s3copier.aws.AmazonS3URIs.toAmazonS3URI;
import static org.apache.hadoop.fs.s3a.Constants.ACCESS_KEY;
import static org.apache.hadoop.fs.s3a.Constants.ENDPOINT;
import static org.apache.hadoop.fs.s3a.Constants.SECRET_KEY;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.junit.Assert.assertThat;

import java.io.File;
import java.net.URI;
Expand All @@ -47,14 +46,10 @@
import org.junit.contrib.java.lang.system.ExpectedSystemExit;
import org.junit.rules.TemporaryFolder;

import fm.last.commons.test.file.ClassDataFolder;
import fm.last.commons.test.file.DataFolder;

import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3URI;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.google.common.collect.ImmutableMap;

import com.hotels.bdp.circustrain.api.conf.Security;
import com.hotels.bdp.circustrain.common.test.base.CircusTrainRunner;
import com.hotels.bdp.circustrain.integration.utils.TestUtils;
Expand All @@ -63,6 +58,9 @@
import com.hotels.bdp.circustrain.s3s3copier.aws.JceksAmazonS3ClientFactory;
import com.hotels.beeju.ThriftHiveMetaStoreJUnitRule;

import fm.last.commons.test.file.ClassDataFolder;
import fm.last.commons.test.file.DataFolder;

public class CircusTrainS3S3IntegrationTest {

private static final String S3_ACCESS_KEY = "access";
Expand Down Expand Up @@ -123,7 +121,7 @@ private AmazonS3 newS3Client(String tableUri) {
.<String, Object> builder()
.put(S3S3CopierOptions.Keys.S3_ENDPOINT_URI.keyName(), s3Proxy.getUri().toString())
.build());
return s3ClientFactory.newInstance(base, s3s3CopierOptions);
return s3ClientFactory.newSourceInstance(base, s3s3CopierOptions);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ public void setUp() throws Exception {
client.createBucket("source");
client.createBucket("target");

when(s3ClientFactory.newInstance(any(AmazonS3URI.class), any(S3S3CopierOptions.class))).thenReturn(newClient());
when(s3ClientFactory.newSourceInstance(any(AmazonS3URI.class), any(S3S3CopierOptions.class)))
.thenReturn(newClient());

when(s3ClientFactory.newTargetInstance(any(AmazonS3URI.class), any(S3S3CopierOptions.class)))
.thenReturn(newClient());
Expand Down

0 comments on commit 6743333

Please sign in to comment.