forked from halo-dev/halo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert huaweicloud-sdk-java-obs from 3.21.8.1 to 3.21.4 (halo-dev#2209)
Signed-off-by: johnniang <[email protected]>
- Loading branch information
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/test/java/run/halo/app/handler/file/HuaweiObsSdkTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package run.halo.app.handler.file; | ||
|
||
import com.obs.services.internal.ObsProperties; | ||
import com.obs.services.internal.RestConnectionService; | ||
import com.obs.services.internal.ServiceException; | ||
import com.obs.services.model.HttpMethodEnum; | ||
import java.util.Map; | ||
import okhttp3.Request; | ||
import okhttp3.RequestBody; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class HuaweiObsSdkTest { | ||
|
||
/** | ||
* See | ||
* <a href="https://github.com/halo-dev/halo/issues/1909"> | ||
* https://github.com/halo-dev/halo/issues/1909 | ||
* </a> | ||
* for more. | ||
*/ | ||
@Test | ||
void shouldSetUpConnectionCorrectly() { | ||
var connSvc = new RestConnectionService() { | ||
|
||
{ | ||
// We have to initialize the obsProperties, or we will get a NPE while setting up | ||
// connection. | ||
obsProperties = new ObsProperties(); | ||
} | ||
|
||
@Override | ||
public Request.Builder setupConnection(HttpMethodEnum method, String bucketName, | ||
String objectKey, | ||
Map<String, String> requestParameters, | ||
RequestBody body) throws ServiceException { | ||
return super.setupConnection(method, bucketName, objectKey, requestParameters, | ||
body); | ||
} | ||
}; | ||
var builder = connSvc.setupConnection(HttpMethodEnum.GET, "fake-bucket-name", | ||
"fake-object-key", Map.of(), null); | ||
Assertions.assertNotNull(builder); | ||
} | ||
|
||
} |