@@ -42,46 +42,33 @@ class AbfsFileSystemBehaviorITCase extends FileSystemBehaviorTestSuite {
4242 public static final String ABFS_FS_PATH =
"abfs://[email protected] /test" ;
4343
4444 private static MockAuthServer mockGSServer ;
45- private static FileSystem fileSystem ;
4645
4746 @ BeforeAll
48- static void setup () throws IOException {
47+ static void setup () {
4948 mockGSServer = MockAuthServer .create ();
50- fileSystem = createFileSystem ();
49+ final Configuration configuration = new Configuration ();
50+ configuration .setString (CONFIG_PREFIX + ".oauth2.client.id" , CLIENT_ID );
51+ configuration .setString (CONFIG_PREFIX + ".oauth2.client.secret" , CLIENT_SECRET );
52+ configuration .setString (CONFIG_PREFIX + ".oauth2.client.endpoint" , ENDPOINT_KEY );
53+ configuration .setString (CONFIG_PREFIX + ".key" , AZURE_ACCOUNT_KEY );
54+ FileSystem .initialize (configuration , null );
5155 }
5256
53- void testPathAndScheme () throws Exception {}
54-
5557 @ Override
56- protected FileSystem getFileSystem () {
57- return fileSystem ;
58+ protected FileSystem getFileSystem () throws IOException {
59+ return getBasePath (). getFileSystem () ;
5860 }
5961
6062 @ Override
61- protected FsPath getBasePath () {
62- return new FsPath (ABFS_FS_PATH );
63- }
64-
65- private static FileSystem createFileSystem () throws IOException {
66- AbfsFileSystemPlugin abfsFileSystemPlugin = new AbfsFileSystemPlugin ();
67- Configuration configuration = new Configuration ();
68- configuration .setString (CONFIG_PREFIX + ".oauth2.id" , CLIENT_ID );
69- configuration .setString (CONFIG_PREFIX + ".oauth2.secret" , CLIENT_SECRET );
70- configuration .setString (CONFIG_PREFIX + ".oauth2.endpoint" , ENDPOINT_KEY );
71- configuration .setString (CONFIG_PREFIX + ".key" , AZURE_ACCOUNT_KEY );
72-
73- FileSystem fileSystem =
74- abfsFileSystemPlugin .create (
75- URI .
create (
"abfs://[email protected] /test" ),
configuration );
76-
77- applyMockStorage (fileSystem );
78-
79- return fileSystem ;
63+ protected FsPath getBasePath () throws IOException {
64+ FsPath fsPath = new FsPath (ABFS_FS_PATH );
65+ applyMockStorage (fsPath .getFileSystem ());
66+ return fsPath ;
8067 }
8168
8269 private static void applyMockStorage (FileSystem fileSystem ) throws IOException {
8370 try {
84- MemoryFileSystem memoryFileSystem = new MemoryFileSystem ();
71+ MemoryFileSystem memoryFileSystem = new MemoryFileSystem (URI . create ( ABFS_FS_PATH ) );
8572 FieldUtils .writeField (fileSystem , "fs" , memoryFileSystem , true );
8673 } catch (IllegalAccessException e ) {
8774 throw new RuntimeException (e );
0 commit comments