Skip to content

Commit

Permalink
Revert huaweicloud-sdk-java-obs from 3.21.8.1 to 3.21.4 (halo-dev#2209)
Browse files Browse the repository at this point in the history
Signed-off-by: johnniang <[email protected]>
  • Loading branch information
JohnNiang authored Jul 6, 2022
1 parent b926fd0 commit 5798a28
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ext {
levelDbVersion = "0.12"
annotationsVersion = "3.0.1u2"
zxingVersion = '3.4.1'
huaweiObsVersion = '3.21.8.1'
huaweiObsVersion = '3.21.4'
templateInheritanceVersion = "0.4.RELEASE"
jsoupVersion = '1.14.3'
embeddedRedisVersion = '0.6'
Expand Down
46 changes: 46 additions & 0 deletions src/test/java/run/halo/app/handler/file/HuaweiObsSdkTest.java
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);
}

}

0 comments on commit 5798a28

Please sign in to comment.