From 786068031f03398bbfd3df84ea9593502230f213 Mon Sep 17 00:00:00 2001 From: zhangjiawei <349071347@qq.com> Date: Sat, 30 Dec 2023 22:02:11 +0800 Subject: [PATCH] optimize spring autoconfigure server unit test --- .../server/MetricsPropertiesTest.java | 39 ++++++++++++ .../server/ServerPropertiesTest.java | 53 +++++++++++++++++ .../server/ServerRaftPropertiesTest.java | 59 +++++++++++++++++++ .../server/ServerRecoveryPropertiesTest.java | 39 ++++++++++++ .../server/ServerUndoPropertiesTest.java | 35 +++++++++++ .../server/session/SessionPropertiesTest.java | 35 +++++++++++ .../server/store/StoreDBPropertiesTest.java | 59 +++++++++++++++++++ .../server/store/StoreFilePropertiesTest.java | 43 ++++++++++++++ .../server/store/StorePropertiesTest.java | 35 +++++++++++ .../store/StoreRedisPropertiesTest.java | 47 +++++++++++++++ 10 files changed, 444 insertions(+) create mode 100644 seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/MetricsPropertiesTest.java create mode 100644 seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerPropertiesTest.java create mode 100644 seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerRaftPropertiesTest.java create mode 100644 seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerRecoveryPropertiesTest.java create mode 100644 seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerUndoPropertiesTest.java create mode 100644 seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/session/SessionPropertiesTest.java create mode 100644 seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreDBPropertiesTest.java create mode 100644 seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreFilePropertiesTest.java create mode 100644 seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StorePropertiesTest.java create mode 100644 seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreRedisPropertiesTest.java diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/MetricsPropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/MetricsPropertiesTest.java new file mode 100644 index 00000000000..b5e1b05a2d8 --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/MetricsPropertiesTest.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed 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 specific language governing permissions and + * limitations under the License. + */ +package io.seata.spring.boot.autoconfigure.properties.server; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + */ +public class MetricsPropertiesTest { + + @Test + public void testMetricsProperties() { + MetricsProperties metricsProperties = new MetricsProperties(); + metricsProperties.setRegistryType("type"); + metricsProperties.setExporterList("list"); + metricsProperties.setEnabled(true); + metricsProperties.setExporterPrometheusPort(1); + + Assertions.assertEquals("type", metricsProperties.getRegistryType()); + Assertions.assertEquals("list", metricsProperties.getExporterList()); + Assertions.assertTrue(metricsProperties.getEnabled()); + Assertions.assertEquals(1, metricsProperties.getExporterPrometheusPort()); + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerPropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerPropertiesTest.java new file mode 100644 index 00000000000..7cb325354d7 --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerPropertiesTest.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed 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 specific language governing permissions and + * limitations under the License. + */ +package io.seata.spring.boot.autoconfigure.properties.server; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + */ +public class ServerPropertiesTest { + + @Test + public void testMetricsProperties() { + ServerProperties serverProperties = new ServerProperties(); + serverProperties.setXaerNotaRetryTimeout(1); + serverProperties.setRetryDeadThreshold(1); + serverProperties.setApplicationDataLimit(1); + serverProperties.setServicePort(1); + serverProperties.setEnableCheckAuth(true); + serverProperties.setApplicationDataLimitCheck(true); + serverProperties.setEnableParallelHandleBranch(true); + serverProperties.setEnableParallelRequestHandle(true); + serverProperties.setRollbackRetryTimeoutUnlockEnable(true); + serverProperties.setMaxCommitRetryTimeout(1L); + serverProperties.setMaxRollbackRetryTimeout(1L); + + Assertions.assertEquals(1, serverProperties.getXaerNotaRetryTimeout()); + Assertions.assertEquals(1, serverProperties.getRetryDeadThreshold()); + Assertions.assertEquals(1, serverProperties.getApplicationDataLimit()); + Assertions.assertEquals(1, serverProperties.getServicePort()); + Assertions.assertTrue(serverProperties.getEnableCheckAuth()); + Assertions.assertTrue(serverProperties.getApplicationDataLimitCheck()); + Assertions.assertTrue(serverProperties.getEnableParallelHandleBranch()); + Assertions.assertTrue(serverProperties.getEnableParallelRequestHandle()); + Assertions.assertTrue(serverProperties.getRollbackRetryTimeoutUnlockEnable()); + Assertions.assertEquals(1L, serverProperties.getMaxCommitRetryTimeout()); + Assertions.assertEquals(1L, serverProperties.getMaxRollbackRetryTimeout()); + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerRaftPropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerRaftPropertiesTest.java new file mode 100644 index 00000000000..4d13ae0cacc --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerRaftPropertiesTest.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed 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 specific language governing permissions and + * limitations under the License. + */ +package io.seata.spring.boot.autoconfigure.properties.server; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + */ +public class ServerRaftPropertiesTest { + + @Test + public void testServerRaftProperties() { + ServerRaftProperties serverRaftProperties = new ServerRaftProperties(); + serverRaftProperties.setServerAddr("server"); + serverRaftProperties.setGroup("group"); + serverRaftProperties.setCompressor("compressor"); + serverRaftProperties.setSerialization("serialization"); + serverRaftProperties.setApplyBatch(1); + serverRaftProperties.setDisruptorBufferSize(1); + serverRaftProperties.setElectionTimeoutMs(1); + serverRaftProperties.setMaxAppendBufferSize(1); + serverRaftProperties.setMaxReplicatorInflightMsgs(1); + serverRaftProperties.setReporterInitialDelay(1); + serverRaftProperties.setSnapshotInterval(1); + serverRaftProperties.setAutoJoin(true); + serverRaftProperties.setReporterEnabled(true); + serverRaftProperties.setSync(true); + + Assertions.assertEquals("server", serverRaftProperties.getServerAddr()); + Assertions.assertEquals("group", serverRaftProperties.getGroup()); + Assertions.assertEquals("compressor", serverRaftProperties.getCompressor()); + Assertions.assertEquals("serialization", serverRaftProperties.getSerialization()); + Assertions.assertEquals(1, serverRaftProperties.getApplyBatch()); + Assertions.assertEquals(1, serverRaftProperties.getDisruptorBufferSize()); + Assertions.assertEquals(1, serverRaftProperties.getElectionTimeoutMs()); + Assertions.assertEquals(1, serverRaftProperties.getMaxAppendBufferSize()); + Assertions.assertEquals(1, serverRaftProperties.getMaxReplicatorInflightMsgs()); + Assertions.assertEquals(1, serverRaftProperties.getReporterInitialDelay()); + Assertions.assertEquals(1, serverRaftProperties.getSnapshotInterval()); + Assertions.assertTrue(serverRaftProperties.getAutoJoin()); + Assertions.assertTrue(serverRaftProperties.isReporterEnabled()); + Assertions.assertTrue(serverRaftProperties.isSync()); + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerRecoveryPropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerRecoveryPropertiesTest.java new file mode 100644 index 00000000000..1fab3c98af4 --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerRecoveryPropertiesTest.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed 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 specific language governing permissions and + * limitations under the License. + */ +package io.seata.spring.boot.autoconfigure.properties.server; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + */ +public class ServerRecoveryPropertiesTest { + + @Test + public void testServerRecoveryProperties() { + ServerRecoveryProperties serverRecoveryProperties = new ServerRecoveryProperties(); + serverRecoveryProperties.setAsyncCommittingRetryPeriod(1L); + serverRecoveryProperties.setCommittingRetryPeriod(1L); + serverRecoveryProperties.setRollbackingRetryPeriod(1L); + serverRecoveryProperties.setTimeoutRetryPeriod(1L); + + Assertions.assertEquals(1L, serverRecoveryProperties.getAsyncCommittingRetryPeriod()); + Assertions.assertEquals(1L, serverRecoveryProperties.getCommittingRetryPeriod()); + Assertions.assertEquals(1L, serverRecoveryProperties.getRollbackingRetryPeriod()); + Assertions.assertEquals(1L, serverRecoveryProperties.getTimeoutRetryPeriod()); + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerUndoPropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerUndoPropertiesTest.java new file mode 100644 index 00000000000..98e7adfe8ef --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/ServerUndoPropertiesTest.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed 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 specific language governing permissions and + * limitations under the License. + */ +package io.seata.spring.boot.autoconfigure.properties.server; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + */ +public class ServerUndoPropertiesTest { + + @Test + public void testServerUndoProperties() { + ServerUndoProperties serverUndoProperties = new ServerUndoProperties(); + serverUndoProperties.setLogSaveDays((short) 1); + serverUndoProperties.setLogDeletePeriod(1); + + Assertions.assertEquals(1, serverUndoProperties.getLogSaveDays()); + Assertions.assertEquals(1, serverUndoProperties.getLogDeletePeriod()); + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/session/SessionPropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/session/SessionPropertiesTest.java new file mode 100644 index 00000000000..aab64dd0d45 --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/session/SessionPropertiesTest.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed 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 specific language governing permissions and + * limitations under the License. + */ +package io.seata.spring.boot.autoconfigure.properties.server.session; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + */ +public class SessionPropertiesTest { + + @Test + public void testSessionProperties() { + SessionProperties sessionProperties = new SessionProperties(); + sessionProperties.setEnableBranchAsync(true); + sessionProperties.setBranchAsyncQueueSize(1); + + Assertions.assertTrue(sessionProperties.getEnableBranchAsync()); + Assertions.assertEquals(1, sessionProperties.getBranchAsyncQueueSize()); + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreDBPropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreDBPropertiesTest.java new file mode 100644 index 00000000000..d28e50b578c --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreDBPropertiesTest.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed 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 specific language governing permissions and + * limitations under the License. + */ +package io.seata.spring.boot.autoconfigure.properties.server.store; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + */ +public class StoreDBPropertiesTest { + + @Test + public void testStoreDBProperties() { + StoreDBProperties storeDBProperties = new StoreDBProperties(); + storeDBProperties.setUrl("url"); + storeDBProperties.setUser("user"); + storeDBProperties.setPassword("pwd"); + storeDBProperties.setDatasource("datasource"); + storeDBProperties.setDbType("type"); + storeDBProperties.setGlobalTable("global"); + storeDBProperties.setBranchTable("branch"); + storeDBProperties.setLockTable("lock"); + storeDBProperties.setDistributedLockTable("distribute"); + storeDBProperties.setDriverClassName("driver"); + storeDBProperties.setMinConn(1); + storeDBProperties.setMaxConn(1); + storeDBProperties.setQueryLimit(1); + storeDBProperties.setMaxWait(1L); + + Assertions.assertEquals("url", storeDBProperties.getUrl()); + Assertions.assertEquals("user", storeDBProperties.getUser()); + Assertions.assertEquals("pwd", storeDBProperties.getPassword()); + Assertions.assertEquals("datasource", storeDBProperties.getDatasource()); + Assertions.assertEquals("type", storeDBProperties.getDbType()); + Assertions.assertEquals("global", storeDBProperties.getGlobalTable()); + Assertions.assertEquals("branch", storeDBProperties.getBranchTable()); + Assertions.assertEquals("lock", storeDBProperties.getLockTable()); + Assertions.assertEquals("distribute", storeDBProperties.getDistributedLockTable()); + Assertions.assertEquals("driver", storeDBProperties.getDriverClassName()); + Assertions.assertEquals(1, storeDBProperties.getMinConn()); + Assertions.assertEquals(1, storeDBProperties.getMaxConn()); + Assertions.assertEquals(1, storeDBProperties.getQueryLimit()); + Assertions.assertEquals(1L, storeDBProperties.getMaxWait()); + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreFilePropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreFilePropertiesTest.java new file mode 100644 index 00000000000..1ab334512fb --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreFilePropertiesTest.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed 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 specific language governing permissions and + * limitations under the License. + */ +package io.seata.spring.boot.autoconfigure.properties.server.store; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + */ +public class StoreFilePropertiesTest { + + @Test + public void testStoreFileProperties() { + StoreFileProperties storeFileProperties = new StoreFileProperties(); + storeFileProperties.setDir("dir"); + storeFileProperties.setFlushDiskMode("disk"); + storeFileProperties.setFileWriteBufferCacheSize(1); + storeFileProperties.setMaxBranchSessionSize(1); + storeFileProperties.setMaxGlobalSessionSize(1); + storeFileProperties.setSessionReloadReadSize(1); + + Assertions.assertEquals("dir", storeFileProperties.getDir()); + Assertions.assertEquals("disk", storeFileProperties.getFlushDiskMode()); + Assertions.assertEquals(1, storeFileProperties.getFileWriteBufferCacheSize()); + Assertions.assertEquals(1, storeFileProperties.getMaxGlobalSessionSize()); + Assertions.assertEquals(1, storeFileProperties.getMaxBranchSessionSize()); + Assertions.assertEquals(1, storeFileProperties.getSessionReloadReadSize()); + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StorePropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StorePropertiesTest.java new file mode 100644 index 00000000000..031821d2e78 --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StorePropertiesTest.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed 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 specific language governing permissions and + * limitations under the License. + */ +package io.seata.spring.boot.autoconfigure.properties.server.store; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + */ +public class StorePropertiesTest { + + @Test + public void testStoreProperties() { + StoreProperties storeProperties = new StoreProperties(); + storeProperties.setMode("mode"); + storeProperties.setPublicKey("public"); + + Assertions.assertEquals("mode", storeProperties.getMode()); + Assertions.assertEquals("public", storeProperties.getPublicKey()); + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreRedisPropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreRedisPropertiesTest.java new file mode 100644 index 00000000000..29ea0ebc90f --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreRedisPropertiesTest.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed 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 specific language governing permissions and + * limitations under the License. + */ +package io.seata.spring.boot.autoconfigure.properties.server.store; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + */ +public class StoreRedisPropertiesTest { + + @Test + public void testStoreRedisProperties() { + StoreRedisProperties storeRedisProperties = new StoreRedisProperties(); + storeRedisProperties.setMode("mode"); + storeRedisProperties.setType("type"); + storeRedisProperties.setPassword("pwd"); + storeRedisProperties.setDatabase(1); + storeRedisProperties.setMaxConn(1); + storeRedisProperties.setMinConn(1); + storeRedisProperties.setQueryLimit(1); + storeRedisProperties.setMaxTotal(1); + + Assertions.assertEquals("mode", storeRedisProperties.getMode()); + Assertions.assertEquals("type", storeRedisProperties.getType()); + Assertions.assertEquals("pwd", storeRedisProperties.getPassword()); + Assertions.assertEquals(1, storeRedisProperties.getDatabase()); + Assertions.assertEquals(1, storeRedisProperties.getMaxConn()); + Assertions.assertEquals(1, storeRedisProperties.getMinConn()); + Assertions.assertEquals(1, storeRedisProperties.getQueryLimit()); + Assertions.assertEquals(1, storeRedisProperties.getMaxTotal()); + } +}