Search in sources :

Example 1 with NamespaceService

use of com.ctrip.framework.apollo.biz.service.NamespaceService in project apollo by ctripcorp.

the class ReleaseControllerTest method testMessageSendAfterBuildRelease.

@Test
public void testMessageSendAfterBuildRelease() throws Exception {
    String someAppId = "someAppId";
    String someNamespaceName = "someNamespace";
    String someCluster = "someCluster";
    String someName = "someName";
    String someComment = "someComment";
    String someUserName = "someUser";
    NamespaceService someNamespaceService = mock(NamespaceService.class);
    ReleaseService someReleaseService = mock(ReleaseService.class);
    MessageSender someMessageSender = mock(MessageSender.class);
    Namespace someNamespace = mock(Namespace.class);
    ReleaseController releaseController = new ReleaseController(someReleaseService, someNamespaceService, someMessageSender, null);
    when(someNamespaceService.findOne(someAppId, someCluster, someNamespaceName)).thenReturn(someNamespace);
    releaseController.publish(someAppId, someCluster, someNamespaceName, someName, someComment, "test", false);
    verify(someMessageSender, times(1)).sendMessage(Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR).join(someAppId, someCluster, someNamespaceName), Topics.APOLLO_RELEASE_TOPIC);
}
Also used : ReleaseService(com.ctrip.framework.apollo.biz.service.ReleaseService) NamespaceService(com.ctrip.framework.apollo.biz.service.NamespaceService) MessageSender(com.ctrip.framework.apollo.biz.message.MessageSender) Namespace(com.ctrip.framework.apollo.biz.entity.Namespace) Test(org.junit.Test)

Aggregations

Namespace (com.ctrip.framework.apollo.biz.entity.Namespace)1 MessageSender (com.ctrip.framework.apollo.biz.message.MessageSender)1 NamespaceService (com.ctrip.framework.apollo.biz.service.NamespaceService)1 ReleaseService (com.ctrip.framework.apollo.biz.service.ReleaseService)1 Test (org.junit.Test)1