org.apache.flink.testutils.oss.OSSTestCredentials Java Examples

The following examples show how to use org.apache.flink.testutils.oss.OSSTestCredentials. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HadoopOSSFileSystemITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testShadedConfigurations() {
	final Configuration conf = new Configuration();
	conf.setString("fs.oss.endpoint", OSSTestCredentials.getOSSEndpoint());
	conf.setString("fs.oss.accessKeyId", OSSTestCredentials.getOSSAccessKey());
	conf.setString("fs.oss.accessKeySecret", OSSTestCredentials.getOSSSecretKey());
	conf.setString("fs.oss.credentials.provider", "org.apache.hadoop.fs.aliyun.oss.AliyunCredentialsProvider");

	OSSFileSystemFactory ossfsFactory = new OSSFileSystemFactory();
	ossfsFactory.configure(conf);
	org.apache.hadoop.conf.Configuration configuration = ossfsFactory.getHadoopConfiguration();
	// shaded
	assertEquals("org.apache.flink.fs.shaded.hadoop3.org.apache.hadoop.fs.aliyun.oss.AliyunCredentialsProvider",
		configuration.get("fs.oss.credentials.provider"));
	// should not shaded
	assertEquals(OSSTestCredentials.getOSSEndpoint(), configuration.get("fs.oss.endpoint"));
	assertEquals(OSSTestCredentials.getOSSAccessKey(), configuration.get("fs.oss.accessKeyId"));
	assertEquals(OSSTestCredentials.getOSSSecretKey(), configuration.get("fs.oss.accessKeySecret"));
}
 
Example #2
Source File: HadoopOSSFileSystemITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testShadedConfigurations() {
	final Configuration conf = new Configuration();
	conf.setString("fs.oss.endpoint", OSSTestCredentials.getOSSEndpoint());
	conf.setString("fs.oss.accessKeyId", OSSTestCredentials.getOSSAccessKey());
	conf.setString("fs.oss.accessKeySecret", OSSTestCredentials.getOSSSecretKey());
	conf.setString("fs.oss.credentials.provider", "org.apache.hadoop.fs.aliyun.oss.AliyunCredentialsProvider");

	OSSFileSystemFactory ossfsFactory = new OSSFileSystemFactory();
	ossfsFactory.configure(conf);
	org.apache.hadoop.conf.Configuration configuration = ossfsFactory.getHadoopConfiguration();
	// shaded
	assertEquals("org.apache.flink.fs.shaded.hadoop3.org.apache.hadoop.fs.aliyun.oss.AliyunCredentialsProvider",
		configuration.get("fs.oss.credentials.provider"));
	// should not shaded
	assertEquals(OSSTestCredentials.getOSSEndpoint(), configuration.get("fs.oss.endpoint"));
	assertEquals(OSSTestCredentials.getOSSAccessKey(), configuration.get("fs.oss.accessKeyId"));
	assertEquals(OSSTestCredentials.getOSSSecretKey(), configuration.get("fs.oss.accessKeySecret"));
}
 
Example #3
Source File: HadoopOSSFileSystemITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testShadedConfigurations() {
	final Configuration conf = new Configuration();
	conf.setString("fs.oss.endpoint", OSSTestCredentials.getOSSEndpoint());
	conf.setString("fs.oss.accessKeyId", OSSTestCredentials.getOSSAccessKey());
	conf.setString("fs.oss.accessKeySecret", OSSTestCredentials.getOSSSecretKey());
	conf.setString("fs.oss.credentials.provider", "org.apache.hadoop.fs.aliyun.oss.AliyunCredentialsProvider");

	OSSFileSystemFactory ossfsFactory = new OSSFileSystemFactory();
	ossfsFactory.configure(conf);
	org.apache.hadoop.conf.Configuration configuration = ossfsFactory.getHadoopConfiguration();
	// shaded
	assertEquals("org.apache.flink.fs.osshadoop.shaded.org.apache.hadoop.fs.aliyun.oss.AliyunCredentialsProvider",
		configuration.get("fs.oss.credentials.provider"));
	// should not shaded
	assertEquals(OSSTestCredentials.getOSSEndpoint(), configuration.get("fs.oss.endpoint"));
	assertEquals(OSSTestCredentials.getOSSAccessKey(), configuration.get("fs.oss.accessKeyId"));
	assertEquals(OSSTestCredentials.getOSSSecretKey(), configuration.get("fs.oss.accessKeySecret"));
}
 
Example #4
Source File: HadoopOSSFileSystemBehaviorITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setup() throws IOException {
	OSSTestCredentials.assumeCredentialsAvailable();

	final Configuration conf = new Configuration();
	conf.setString("fs.oss.endpoint", OSSTestCredentials.getOSSEndpoint());
	conf.setString("fs.oss.accessKeyId", OSSTestCredentials.getOSSAccessKey());
	conf.setString("fs.oss.accessKeySecret", OSSTestCredentials.getOSSSecretKey());
	FileSystem.initialize(conf);
}
 
Example #5
Source File: HadoopOSSFileSystemITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setup() throws IOException {
	OSSTestCredentials.assumeCredentialsAvailable();

	final Configuration conf = new Configuration();
	conf.setString("fs.oss.endpoint", OSSTestCredentials.getOSSEndpoint());
	conf.setString("fs.oss.accessKeyId", OSSTestCredentials.getOSSAccessKey());
	conf.setString("fs.oss.accessKeySecret", OSSTestCredentials.getOSSSecretKey());
	FileSystem.initialize(conf);
	basePath = new Path(OSSTestCredentials.getTestBucketUri() + TEST_DATA_DIR);
	fs = basePath.getFileSystem();
	deadline = 0;
}
 
Example #6
Source File: HadoopOSSFileSystemBehaviorITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setup() throws IOException {
	OSSTestCredentials.assumeCredentialsAvailable();

	final Configuration conf = new Configuration();
	conf.setString("fs.oss.endpoint", OSSTestCredentials.getOSSEndpoint());
	conf.setString("fs.oss.accessKeyId", OSSTestCredentials.getOSSAccessKey());
	conf.setString("fs.oss.accessKeySecret", OSSTestCredentials.getOSSSecretKey());
	FileSystem.initialize(conf);
}
 
Example #7
Source File: HadoopOSSFileSystemITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setup() throws IOException {
	OSSTestCredentials.assumeCredentialsAvailable();

	final Configuration conf = new Configuration();
	conf.setString("fs.oss.endpoint", OSSTestCredentials.getOSSEndpoint());
	conf.setString("fs.oss.accessKeyId", OSSTestCredentials.getOSSAccessKey());
	conf.setString("fs.oss.accessKeySecret", OSSTestCredentials.getOSSSecretKey());
	FileSystem.initialize(conf);
	basePath = new Path(OSSTestCredentials.getTestBucketUri() + TEST_DATA_DIR);
	fs = basePath.getFileSystem();
	deadline = 0;
}
 
Example #8
Source File: HadoopOSSFileSystemBehaviorITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setup() throws IOException {
	OSSTestCredentials.assumeCredentialsAvailable();

	final Configuration conf = new Configuration();
	conf.setString("fs.oss.endpoint", OSSTestCredentials.getOSSEndpoint());
	conf.setString("fs.oss.accessKeyId", OSSTestCredentials.getOSSAccessKey());
	conf.setString("fs.oss.accessKeySecret", OSSTestCredentials.getOSSSecretKey());
	FileSystem.initialize(conf);
}
 
Example #9
Source File: HadoopOSSFileSystemITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setup() throws IOException {
	OSSTestCredentials.assumeCredentialsAvailable();

	final Configuration conf = new Configuration();
	conf.setString("fs.oss.endpoint", OSSTestCredentials.getOSSEndpoint());
	conf.setString("fs.oss.accessKeyId", OSSTestCredentials.getOSSAccessKey());
	conf.setString("fs.oss.accessKeySecret", OSSTestCredentials.getOSSSecretKey());
	FileSystem.initialize(conf);
	basePath = new Path(OSSTestCredentials.getTestBucketUri() + TEST_DATA_DIR);
	fs = basePath.getFileSystem();
	consistencyToleranceNS = 0;
}
 
Example #10
Source File: HadoopOSSFileSystemBehaviorITCase.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public Path getBasePath() throws Exception {
	return new Path(OSSTestCredentials.getTestBucketUri() + TEST_DATA_DIR);
}
 
Example #11
Source File: HadoopOSSFileSystemBehaviorITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Path getBasePath() throws Exception {
	return new Path(OSSTestCredentials.getTestBucketUri() + TEST_DATA_DIR);
}
 
Example #12
Source File: HadoopOSSFileSystemBehaviorITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Path getBasePath() throws Exception {
	return new Path(OSSTestCredentials.getTestBucketUri() + TEST_DATA_DIR);
}