|
|
@ -13,10 +13,9 @@
|
|
|
|
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
|
|
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
|
|
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
|
|
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations under the License.
|
|
|
|
* specific language governing permissions and limitations under the License.
|
|
|
|
*
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
package com.tencent.cloud.metadata.core.filter;
|
|
|
|
package com.tencent.cloud.metadata.core;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
import java.net.URLDecoder;
|
|
|
|
import java.net.URLDecoder;
|
|
|
@ -25,9 +24,7 @@ import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
import com.tencent.cloud.common.constant.MetadataConstant;
|
|
|
|
import com.tencent.cloud.common.constant.MetadataConstant;
|
|
|
|
import com.tencent.cloud.common.util.JacksonUtils;
|
|
|
|
import com.tencent.cloud.common.util.JacksonUtils;
|
|
|
|
import com.tencent.cloud.metadata.core.EncodeTransferMedataScgFilter;
|
|
|
|
|
|
|
|
import org.assertj.core.api.Assertions;
|
|
|
|
import org.assertj.core.api.Assertions;
|
|
|
|
import org.junit.Assert;
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
import org.mockito.Mock;
|
|
|
|
import org.mockito.Mock;
|
|
|
@ -44,6 +41,8 @@ import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
|
|
|
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Test for {@link EncodeTransferMedataScgFilter}.
|
|
|
|
|
|
|
|
*
|
|
|
|
* @author quan
|
|
|
|
* @author quan
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@RunWith(SpringRunner.class)
|
|
|
|
@RunWith(SpringRunner.class)
|
|
|
@ -68,7 +67,7 @@ public class EncodeTransferMedataScgFilterTest {
|
|
|
|
String decode = URLDecoder.decode(metadataStr, StandardCharsets.UTF_8.name());
|
|
|
|
String decode = URLDecoder.decode(metadataStr, StandardCharsets.UTF_8.name());
|
|
|
|
Map<String, String> transitiveMap = JacksonUtils.deserialize2Map(decode);
|
|
|
|
Map<String, String> transitiveMap = JacksonUtils.deserialize2Map(decode);
|
|
|
|
Assertions.assertThat(transitiveMap.size()).isEqualTo(1);
|
|
|
|
Assertions.assertThat(transitiveMap.size()).isEqualTo(1);
|
|
|
|
Assert.assertEquals(transitiveMap.get("b"), "2");
|
|
|
|
Assertions.assertThat(transitiveMap.get("b")).isEqualTo("2");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootApplication
|
|
|
|
@SpringBootApplication
|