-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request !314 from KamToHung/my-test
- Loading branch information
Showing
11 changed files
with
482 additions
and
12 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
.../streamquery/stream/plugin/mybatisplus/annotation/AbstractMybatisPlusTestApplication.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 @@ | ||
/* | ||
* 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 org.dromara.streamquery.stream.plugin.mybatisplus.annotation; | ||
|
||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.context.ConfigurableApplicationContext; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
|
||
/** | ||
* MybatisPlusTestApplication less Create Retrieve Update Delete | ||
* | ||
* @author VampireAchao Cizai_ | ||
* @since 2022/5/21 | ||
*/ | ||
@ExtendWith(SpringExtension.class) | ||
public abstract class AbstractMybatisPlusTestApplication { | ||
|
||
protected ConfigurableApplicationContext context; | ||
|
||
@BeforeEach | ||
void before() { | ||
context = SpringApplication.run(this.getClass()); | ||
} | ||
|
||
@AfterEach | ||
void after() { | ||
context.close(); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...ugin/mybatisplus/annotation/EnableMybatisPlusPluginByAnnotationAndInterfaceClassTest.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,58 @@ | ||
/* | ||
* 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 org.dromara.streamquery.stream.plugin.mybatisplus.annotation; | ||
|
||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.annotation.EnableMybatisPlusPlugin; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.annotation.GenerateMapper; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.configuration.StreamScannerConfigurer; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.mapper.IGenerateMapper; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.RoleInfo; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.UserInfo; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.UserRole; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.inner.AddressInfo; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
/** | ||
* EnableMybatisPlusPluginByClassesTest | ||
* | ||
* @author <a href = "[email protected]">KamTo Hung</a> | ||
*/ | ||
@EnableAutoConfiguration | ||
@EnableMybatisPlusPlugin( | ||
basePackages = "org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po", | ||
annotation = GenerateMapper.class, | ||
interfaceClass = IGenerateMapper.class) | ||
public class EnableMybatisPlusPluginByAnnotationAndInterfaceClassTest | ||
extends AbstractMybatisPlusTestApplication { | ||
|
||
@Test | ||
void testScanByValue() { | ||
StreamScannerConfigurer bean = context.getBean(StreamScannerConfigurer.class); | ||
assertNotNull(bean); | ||
assertNotNull(bean.getEntityClasses()); | ||
assertTrue(bean.getEntityClasses().contains(RoleInfo.class)); | ||
assertTrue(bean.getEntityClasses().contains(UserInfo.class)); | ||
assertFalse(bean.getEntityClasses().contains(UserRole.class)); | ||
assertTrue(bean.getEntityClasses().contains(AddressInfo.class)); | ||
assertFalse(bean.getEntityClasses().contains(AddressInfo.InnerAddressInfo.class)); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...amquery/stream/plugin/mybatisplus/annotation/EnableMybatisPlusPluginByAnnotationTest.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,55 @@ | ||
/* | ||
* 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 org.dromara.streamquery.stream.plugin.mybatisplus.annotation; | ||
|
||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.annotation.EnableMybatisPlusPlugin; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.annotation.GenerateMapper; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.configuration.StreamScannerConfigurer; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.RoleInfo; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.UserInfo; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.UserRole; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.inner.AddressInfo; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
/** | ||
* EnableMybatisPlusPluginByClassesTest | ||
* | ||
* @author <a href = "[email protected]">KamTo Hung</a> | ||
*/ | ||
@EnableAutoConfiguration | ||
@EnableMybatisPlusPlugin( | ||
basePackages = "org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po", | ||
annotation = GenerateMapper.class) | ||
public class EnableMybatisPlusPluginByAnnotationTest extends AbstractMybatisPlusTestApplication { | ||
|
||
@Test | ||
void testScanByValue() { | ||
StreamScannerConfigurer bean = context.getBean(StreamScannerConfigurer.class); | ||
assertNotNull(bean); | ||
assertNotNull(bean.getEntityClasses()); | ||
assertTrue(bean.getEntityClasses().contains(RoleInfo.class)); | ||
assertFalse(bean.getEntityClasses().contains(UserInfo.class)); | ||
assertFalse(bean.getEntityClasses().contains(UserRole.class)); | ||
assertTrue(bean.getEntityClasses().contains(AddressInfo.class)); | ||
assertFalse(bean.getEntityClasses().contains(AddressInfo.InnerAddressInfo.class)); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...stream/plugin/mybatisplus/annotation/EnableMybatisPlusPluginByBasePackageClassesTest.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,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 org.dromara.streamquery.stream.plugin.mybatisplus.annotation; | ||
|
||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.annotation.EnableMybatisPlusPlugin; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.configuration.StreamScannerConfigurer; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.RoleInfo; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.UserInfo; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.UserRole; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.inner.AddressInfo; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
/** | ||
* EnableMybatisPlusPluginByBasePackageClassesTest | ||
* | ||
* @author <a href = "[email protected]">KamTo Hung</a> | ||
*/ | ||
@EnableAutoConfiguration | ||
@EnableMybatisPlusPlugin(basePackageClasses = {UserInfo.class}) | ||
public class EnableMybatisPlusPluginByBasePackageClassesTest | ||
extends AbstractMybatisPlusTestApplication { | ||
|
||
@Test | ||
void testScanByValue() { | ||
StreamScannerConfigurer bean = context.getBean(StreamScannerConfigurer.class); | ||
assertNotNull(bean); | ||
assertNotNull(bean.getEntityClasses()); | ||
assertTrue(bean.getEntityClasses().contains(RoleInfo.class)); | ||
assertTrue(bean.getEntityClasses().contains(UserInfo.class)); | ||
assertTrue(bean.getEntityClasses().contains(UserRole.class)); | ||
assertTrue(bean.getEntityClasses().contains(AddressInfo.class)); | ||
assertFalse(bean.getEntityClasses().contains(AddressInfo.InnerAddressInfo.class)); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...tream/plugin/mybatisplus/annotation/EnableMybatisPlusPluginByBasePackagesGeneralTest.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,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 org.dromara.streamquery.stream.plugin.mybatisplus.annotation; | ||
|
||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.annotation.EnableMybatisPlusPlugin; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.configuration.StreamScannerConfigurer; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.RoleInfo; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.UserInfo; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.UserRole; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.inner.AddressInfo; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
/** | ||
* EnableMybatisPlusPluginByBasePackagesGeneralTest | ||
* | ||
* @author <a href = "[email protected]">KamTo Hung</a> | ||
*/ | ||
@EnableAutoConfiguration | ||
@EnableMybatisPlusPlugin(basePackages = "org.dromara.streamquery.stream.plugin.*.pojo.po") | ||
public class EnableMybatisPlusPluginByBasePackagesGeneralTest | ||
extends AbstractMybatisPlusTestApplication { | ||
|
||
@Test | ||
void testScanByValue() { | ||
StreamScannerConfigurer bean = context.getBean(StreamScannerConfigurer.class); | ||
assertNotNull(bean); | ||
assertNotNull(bean.getEntityClasses()); | ||
assertTrue(bean.getEntityClasses().contains(RoleInfo.class)); | ||
assertTrue(bean.getEntityClasses().contains(UserInfo.class)); | ||
assertTrue(bean.getEntityClasses().contains(UserRole.class)); | ||
assertTrue(bean.getEntityClasses().contains(AddressInfo.class)); | ||
assertFalse(bean.getEntityClasses().contains(AddressInfo.InnerAddressInfo.class)); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...query/stream/plugin/mybatisplus/annotation/EnableMybatisPlusPluginByBasePackagesTest.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,52 @@ | ||
/* | ||
* 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 org.dromara.streamquery.stream.plugin.mybatisplus.annotation; | ||
|
||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.annotation.EnableMybatisPlusPlugin; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.configuration.StreamScannerConfigurer; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.RoleInfo; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.UserInfo; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.UserRole; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.inner.AddressInfo; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
/** | ||
* EnableMybatisPlusPluginByBasePackagesTest | ||
* | ||
* @author <a href = "[email protected]">KamTo Hung</a> | ||
*/ | ||
@EnableAutoConfiguration | ||
@EnableMybatisPlusPlugin(basePackages = "org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po") | ||
public class EnableMybatisPlusPluginByBasePackagesTest extends AbstractMybatisPlusTestApplication { | ||
|
||
@Test | ||
void testScanByValue() { | ||
StreamScannerConfigurer bean = context.getBean(StreamScannerConfigurer.class); | ||
assertNotNull(bean); | ||
assertNotNull(bean.getEntityClasses()); | ||
assertTrue(bean.getEntityClasses().contains(RoleInfo.class)); | ||
assertTrue(bean.getEntityClasses().contains(UserInfo.class)); | ||
assertTrue(bean.getEntityClasses().contains(UserRole.class)); | ||
assertTrue(bean.getEntityClasses().contains(AddressInfo.class)); | ||
assertFalse(bean.getEntityClasses().contains(AddressInfo.InnerAddressInfo.class)); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...treamquery/stream/plugin/mybatisplus/annotation/EnableMybatisPlusPluginByClassesTest.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,52 @@ | ||
/* | ||
* 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 org.dromara.streamquery.stream.plugin.mybatisplus.annotation; | ||
|
||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.annotation.EnableMybatisPlusPlugin; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.engine.configuration.StreamScannerConfigurer; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.RoleInfo; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.UserInfo; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.UserRole; | ||
import org.dromara.streamquery.stream.plugin.mybatisplus.pojo.po.inner.AddressInfo; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
/** | ||
* EnableMybatisPlusPluginByClassesTest | ||
* | ||
* @author <a href = "[email protected]">KamTo Hung</a> | ||
*/ | ||
@EnableAutoConfiguration | ||
@EnableMybatisPlusPlugin(classes = {UserInfo.class}) | ||
public class EnableMybatisPlusPluginByClassesTest extends AbstractMybatisPlusTestApplication { | ||
|
||
@Test | ||
void testScanByValue() { | ||
StreamScannerConfigurer bean = context.getBean(StreamScannerConfigurer.class); | ||
assertNotNull(bean); | ||
assertNotNull(bean.getEntityClasses()); | ||
assertFalse(bean.getEntityClasses().contains(RoleInfo.class)); | ||
assertTrue(bean.getEntityClasses().contains(UserInfo.class)); | ||
assertFalse(bean.getEntityClasses().contains(UserRole.class)); | ||
assertFalse(bean.getEntityClasses().contains(AddressInfo.class)); | ||
assertFalse(bean.getEntityClasses().contains(AddressInfo.InnerAddressInfo.class)); | ||
} | ||
} |
Oops, something went wrong.