Commit f754dc26 by nobodyiam

abandon AllTests.java and fix some potential test issues

parent 2f23140b
package com.ctrip.framework.apollo.adminservice;
import com.ctrip.framework.apollo.adminservice.aop.NamespaceLockTest;
import com.ctrip.framework.apollo.adminservice.aop.NamespaceUnlockAspectTest;
import com.ctrip.framework.apollo.adminservice.controller.AppControllerTest;
import com.ctrip.framework.apollo.adminservice.controller.AppNamespaceControllerTest;
import com.ctrip.framework.apollo.adminservice.controller.ControllerExceptionTest;
import com.ctrip.framework.apollo.adminservice.controller.ControllerIntegrationExceptionTest;
import com.ctrip.framework.apollo.adminservice.controller.InstanceConfigControllerTest;
import com.ctrip.framework.apollo.adminservice.controller.ItemSetControllerTest;
import com.ctrip.framework.apollo.adminservice.controller.ReleaseControllerTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
AppControllerTest.class, ReleaseControllerTest.class, ItemSetControllerTest.class,
ControllerExceptionTest.class, ControllerIntegrationExceptionTest.class,
NamespaceLockTest.class, InstanceConfigControllerTest.class, AppNamespaceControllerTest.class,
NamespaceUnlockAspectTest.class
})
public class AllTests {
}
...@@ -12,6 +12,6 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -12,6 +12,6 @@ import org.springframework.transaction.annotation.Transactional;
@Transactional @Transactional
@WebIntegrationTest(randomPort = true) @WebIntegrationTest(randomPort = true)
@SpringApplicationConfiguration(classes = BizTestConfiguration.class) @SpringApplicationConfiguration(classes = BizTestConfiguration.class)
public class AbstractIntegrationTest { public abstract class AbstractIntegrationTest {
} }
...@@ -4,6 +4,6 @@ import org.junit.runner.RunWith; ...@@ -4,6 +4,6 @@ import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class AbstractUnitTest { public abstract class AbstractUnitTest {
} }
package com.ctrip.framework.apollo.biz;
import com.ctrip.framework.apollo.biz.config.BizConfigTest;
import com.ctrip.framework.apollo.biz.grayReleaseRule.GrayReleaseRulesHolderTest;
import com.ctrip.framework.apollo.biz.message.DatabaseMessageSenderTest;
import com.ctrip.framework.apollo.biz.message.ReleaseMessageScannerTest;
import com.ctrip.framework.apollo.biz.repository.AppNamespaceRepositoryTest;
import com.ctrip.framework.apollo.biz.repository.AppRepositoryTest;
import com.ctrip.framework.apollo.biz.service.AdminServiceTest;
import com.ctrip.framework.apollo.biz.service.AdminServiceTransactionTest;
import com.ctrip.framework.apollo.biz.service.ClusterServiceTest;
import com.ctrip.framework.apollo.biz.service.InstanceServiceTest;
import com.ctrip.framework.apollo.biz.service.NamespaceBranchServiceTest;
import com.ctrip.framework.apollo.biz.service.NamespacePublishInfoTest;
import com.ctrip.framework.apollo.biz.service.NamespaceServiceIntegrationTest;
import com.ctrip.framework.apollo.biz.service.NamespaceServiceTest;
import com.ctrip.framework.apollo.biz.service.ReleaseCreationTest;
import com.ctrip.framework.apollo.biz.service.ReleaseServiceTest;
import com.ctrip.framework.apollo.biz.service.BizDBPropertySourceTest;
import com.ctrip.framework.apollo.biz.utils.ReleaseKeyGeneratorTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
AppRepositoryTest.class,
AppNamespaceRepositoryTest.class,
AdminServiceTest.class,
AdminServiceTransactionTest.class,
DatabaseMessageSenderTest.class,
BizDBPropertySourceTest.class,
ReleaseServiceTest.class,
ReleaseMessageScannerTest.class,
ClusterServiceTest.class,
ReleaseKeyGeneratorTest.class,
InstanceServiceTest.class,
GrayReleaseRulesHolderTest.class,
NamespaceBranchServiceTest.class,
ReleaseCreationTest.class,
NamespacePublishInfoTest.class,
NamespaceServiceIntegrationTest.class,
BizConfigTest.class,
NamespaceServiceTest.class
})
public class AllTests {
}
package com.ctrip.framework.apollo;
import com.ctrip.framework.apollo.integration.ConfigIntegrationTest;
import com.ctrip.framework.apollo.internals.DefaultConfigManagerTest;
import com.ctrip.framework.apollo.internals.DefaultConfigTest;
import com.ctrip.framework.apollo.internals.JsonConfigFileTest;
import com.ctrip.framework.apollo.internals.LocalFileConfigRepositoryTest;
import com.ctrip.framework.apollo.internals.PropertiesConfigFileTest;
import com.ctrip.framework.apollo.internals.RemoteConfigLongPollServiceTest;
import com.ctrip.framework.apollo.internals.RemoteConfigRepositoryTest;
import com.ctrip.framework.apollo.internals.SimpleConfigTest;
import com.ctrip.framework.apollo.internals.XmlConfigFileTest;
import com.ctrip.framework.apollo.spi.DefaultConfigFactoryManagerTest;
import com.ctrip.framework.apollo.spi.DefaultConfigFactoryTest;
import com.ctrip.framework.apollo.spi.DefaultConfigRegistryTest;
import com.ctrip.framework.apollo.spring.BootstrapConfigTest;
import com.ctrip.framework.apollo.spring.JavaConfigAnnotationTest;
import com.ctrip.framework.apollo.spring.JavaConfigPlaceholderAutoUpdateTest;
import com.ctrip.framework.apollo.spring.JavaConfigPlaceholderTest;
import com.ctrip.framework.apollo.spring.XMLConfigAnnotationTest;
import com.ctrip.framework.apollo.spring.XmlConfigPlaceholderAutoUpdateTest;
import com.ctrip.framework.apollo.spring.XmlConfigPlaceholderTest;
import com.ctrip.framework.apollo.spring.config.ConfigPropertySourceTest;
import com.ctrip.framework.apollo.spring.property.PlaceholderHelperTest;
import com.ctrip.framework.apollo.util.ConfigUtilTest;
import com.ctrip.framework.apollo.util.ExceptionUtilTest;
import com.ctrip.framework.apollo.util.parser.DateParserTest;
import com.ctrip.framework.apollo.util.parser.DurationParserTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
ConfigServiceTest.class, DefaultConfigRegistryTest.class, DefaultConfigFactoryManagerTest.class,
DefaultConfigManagerTest.class, DefaultConfigTest.class, LocalFileConfigRepositoryTest.class,
RemoteConfigRepositoryTest.class, SimpleConfigTest.class, DefaultConfigFactoryTest.class,
ConfigIntegrationTest.class, ExceptionUtilTest.class, XmlConfigFileTest.class,
PropertiesConfigFileTest.class, RemoteConfigLongPollServiceTest.class, DateParserTest.class,
DurationParserTest.class, JsonConfigFileTest.class, XmlConfigPlaceholderTest.class,
JavaConfigPlaceholderTest.class, XMLConfigAnnotationTest.class, JavaConfigAnnotationTest.class,
ConfigUtilTest.class, BootstrapConfigTest.class, JavaConfigPlaceholderAutoUpdateTest.class,
XmlConfigPlaceholderAutoUpdateTest.class, ConfigPropertySourceTest.class,
PlaceholderHelperTest.class
})
public class AllTests {
}
package com.ctrip.framework.apollo.common;
import com.ctrip.framework.apollo.common.conditional.ConditionalOnProfileTest;
import com.ctrip.framework.apollo.common.utils.InputValidatorTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
InputValidatorTest.class, ConditionalOnProfileTest.class
})
public class AllTests {
}
package com.ctrip.framework.apollo.configservice;
import com.ctrip.framework.apollo.configservice.controller.ConfigControllerTest;
import com.ctrip.framework.apollo.configservice.controller.ConfigFileControllerTest;
import com.ctrip.framework.apollo.configservice.controller.NotificationControllerTest;
import com.ctrip.framework.apollo.configservice.controller.NotificationControllerV2Test;
import com.ctrip.framework.apollo.configservice.integration.ConfigControllerIntegrationTest;
import com.ctrip.framework.apollo.configservice.integration.ConfigFileControllerIntegrationTest;
import com.ctrip.framework.apollo.configservice.integration.NotificationControllerIntegrationTest;
import com.ctrip.framework.apollo.configservice.integration.NotificationControllerV2IntegrationTest;
import com.ctrip.framework.apollo.configservice.service.AppNamespaceServiceWithCacheTest;
import com.ctrip.framework.apollo.configservice.service.ReleaseMessageServiceWithCacheTest;
import com.ctrip.framework.apollo.configservice.service.config.ConfigServiceWithCacheTest;
import com.ctrip.framework.apollo.configservice.service.config.DefaultConfigServiceTest;
import com.ctrip.framework.apollo.configservice.util.InstanceConfigAuditUtilTest;
import com.ctrip.framework.apollo.configservice.util.NamespaceUtilTest;
import com.ctrip.framework.apollo.configservice.util.WatchKeysUtilTest;
import com.ctrip.framework.apollo.configservice.wrapper.CaseInsensitiveMapWrapperTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({ConfigControllerTest.class, NotificationControllerTest.class,
ConfigControllerIntegrationTest.class, NotificationControllerIntegrationTest.class,
NamespaceUtilTest.class, ConfigFileControllerTest.class,
ConfigFileControllerIntegrationTest.class, WatchKeysUtilTest.class,
NotificationControllerV2Test.class, NotificationControllerV2IntegrationTest.class,
InstanceConfigAuditUtilTest.class, AppNamespaceServiceWithCacheTest.class,
ReleaseMessageServiceWithCacheTest.class, DefaultConfigServiceTest.class, ConfigServiceWithCacheTest.class,
CaseInsensitiveMapWrapperTest.class
})
public class AllTests {
}
...@@ -35,6 +35,7 @@ import java.util.Objects; ...@@ -35,6 +35,7 @@ import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
...@@ -342,11 +343,13 @@ public class NotificationControllerV2Test { ...@@ -342,11 +343,13 @@ public class NotificationControllerV2Test {
controller.handleMessage(someReleaseMessage, Topics.APOLLO_RELEASE_TOPIC); controller.handleMessage(someReleaseMessage, Topics.APOLLO_RELEASE_TOPIC);
assertTrue(!anotherDeferredResult.hasResult()); //in batch mode, at most one of them should have result
assertFalse(deferredResult.hasResult() && anotherDeferredResult.hasResult());
TimeUnit.MILLISECONDS.sleep(someBatchInterval * 10); TimeUnit.MILLISECONDS.sleep(someBatchInterval * 10);
assertTrue(anotherDeferredResult.hasResult()); //now both of them should have result
assertTrue(deferredResult.hasResult() && anotherDeferredResult.hasResult());
} }
private String transformApolloConfigNotificationsToString( private String transformApolloConfigNotificationsToString(
......
...@@ -114,7 +114,8 @@ public abstract class AbstractBaseIntegrationTest { ...@@ -114,7 +114,8 @@ public abstract class AbstractBaseIntegrationTest {
private static class TestBizConfig extends BizConfig { private static class TestBizConfig extends BizConfig {
@Override @Override
public int appNamespaceCacheScanInterval() { public int appNamespaceCacheScanInterval() {
return 50; //should be short enough to update the AppNamespace cache in time
return 1;
} }
@Override @Override
......
package com.ctrip.framework.apollo;
import com.ctrip.framework.apollo.foundation.FoundationTest;
import com.ctrip.framework.apollo.foundation.internals.ServiceBootstrapTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import com.ctrip.framework.apollo.core.MetaDomainTest;
import com.ctrip.framework.apollo.foundation.internals.provider.DefaultApplicationProviderTest;
import com.ctrip.framework.apollo.foundation.internals.provider.DefaultServerProviderTest;
import com.ctrip.framework.apollo.tracer.TracerTest;
import com.ctrip.framework.apollo.tracer.internals.DefaultMessageProducerManagerTest;
import com.ctrip.framework.apollo.tracer.internals.NullMessageProducerManagerTest;
import com.ctrip.framework.apollo.tracer.internals.NullMessageProducerTest;
@RunWith(Suite.class)
@SuiteClasses({
MetaDomainTest.class, ServiceBootstrapTest.class, NullMessageProducerManagerTest.class,
NullMessageProducerTest.class, DefaultMessageProducerManagerTest.class, TracerTest.class,
DefaultApplicationProviderTest.class, DefaultServerProviderTest.class, FoundationTest.class})
public class AllTests {
}
package com.ctrip.framework.apollo.portal;
import com.ctrip.framework.apollo.openapi.filter.ConsumerAuthenticationFilterTest;
import com.ctrip.framework.apollo.openapi.service.ConsumerRolePermissionServiceTest;
import com.ctrip.framework.apollo.openapi.service.ConsumerServiceTest;
import com.ctrip.framework.apollo.openapi.util.ConsumerAuditUtilTest;
import com.ctrip.framework.apollo.openapi.util.ConsumerAuthUtilTest;
import com.ctrip.framework.apollo.portal.component.txtresolver.FileTextResolverTest;
import com.ctrip.framework.apollo.portal.component.txtresolver.PropertyResolverTest;
import com.ctrip.framework.apollo.portal.config.ConfigTest;
import com.ctrip.framework.apollo.portal.service.AppNamespaceServiceTest;
import com.ctrip.framework.apollo.portal.service.ConfigServiceTest;
import com.ctrip.framework.apollo.portal.service.FavoriteServiceTest;
import com.ctrip.framework.apollo.portal.service.NamespaceServiceTest;
import com.ctrip.framework.apollo.portal.spi.defaultImpl.RoleInitializationServiceTest;
import com.ctrip.framework.apollo.portal.spi.defaultImpl.RolePermissionServiceTest;
import com.ctrip.framework.apollo.portal.spi.ctrip.CtripUserServiceTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
ConfigServiceTest.class, PropertyResolverTest.class,
NamespaceServiceTest.class, ServiceExceptionTest.class, RolePermissionServiceTest.class,
AppNamespaceServiceTest.class, RoleInitializationServiceTest.class, FileTextResolverTest.class,
RetryableRestTemplateTest.class, ConsumerRolePermissionServiceTest.class,
ConsumerAuthenticationFilterTest.class, ConsumerAuthUtilTest.class, ConsumerServiceTest.class,
ConsumerAuditUtilTest.class, ConfigTest.class, FavoriteServiceTest.class,
CtripUserServiceTest.class
})
public class AllTests {
}
...@@ -329,11 +329,6 @@ ...@@ -329,11 +329,6 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version> <version>${maven-surefire-plugin.version}</version>
<configuration>
<includes>
<include>**/AllTests.java</include>
</includes>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment