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

The following examples show how to use org.apache.flink.testutils.oss.OSSTestCredentials. These examples are extracted from open source projects. 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 Project: Flink-CEPplus   Source File: HadoopOSSFileSystemITCase.java    License: 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 Project: flink   Source File: HadoopOSSFileSystemITCase.java    License: 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 Project: flink   Source File: HadoopOSSFileSystemITCase.java    License: 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
@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 Project: Flink-CEPplus   Source File: HadoopOSSFileSystemITCase.java    License: 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 Project: flink   Source File: HadoopOSSFileSystemBehaviorITCase.java    License: 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 Project: flink   Source File: HadoopOSSFileSystemITCase.java    License: 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 Project: flink   Source File: HadoopOSSFileSystemBehaviorITCase.java    License: 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 Project: flink   Source File: HadoopOSSFileSystemITCase.java    License: 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
@Override
public Path getBasePath() throws Exception {
	return new Path(OSSTestCredentials.getTestBucketUri() + TEST_DATA_DIR);
}
 
Example 11
Source Project: flink   Source File: HadoopOSSFileSystemBehaviorITCase.java    License: 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 Project: flink   Source File: HadoopOSSFileSystemBehaviorITCase.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Path getBasePath() throws Exception {
	return new Path(OSSTestCredentials.getTestBucketUri() + TEST_DATA_DIR);
}