55import com .joyent .manta .client .MantaObject ;
66import com .joyent .manta .config .ConfigContext ;
77import com .joyent .manta .exception .MantaClientHttpResponseException ;
8+ import com .joyent .manta .exception .MantaErrorCode ;
89import org .apache .commons .codec .digest .DigestUtils ;
910import org .apache .commons .io .Charsets ;
1011import org .apache .commons .io .FileUtils ;
4243import static org .junit .Assert .assertEquals ;
4344import static org .junit .Assert .assertFalse ;
4445import static org .junit .Assert .assertTrue ;
46+ import static org .junit .Assert .fail ;
4547import static org .mockito .Mockito .mock ;
4648import static org .mockito .internal .verification .VerificationModeFactory .atLeast ;
4749
@@ -66,9 +68,9 @@ public static void setup() throws IOException {
6668 try {
6769 client .putDirectory (basePath );
6870 } catch (MantaClientHttpResponseException e ) {
69- if (e .getStatusCode () == 403 ) {
71+ if (e .getServerCode (). equals ( MantaErrorCode . ACCOUNT_BLOCKED_ERROR ) ) {
7072 throw new IOException ("You must have Manta credentials setup to "
71- + "run the integration test suite" );
73+ + "run the integration test suite" , e );
7274 }
7375 }
7476 }
@@ -82,7 +84,7 @@ public static void cleanup() throws IOException {
8284 }
8385 } finally {
8486 config = null ;
85- fs . close ();
87+ FileSystem . closeAll ();
8688 }
8789 }
8890
@@ -99,7 +101,10 @@ private static MantaFileSystem instance() {
99101
100102 try {
101103 FileSystem fs = FileSystem .get (uri , config );
102- @ SuppressWarnings ("unchecked" )
104+
105+ if (!(fs instanceof MantaFileSystem )) {
106+ fail ("FileSystem should be an instance of MantaFileSystem" );
107+ }
103108 MantaFileSystem mfs = (MantaFileSystem )fs ;
104109
105110 return mfs ;
0 commit comments