##### Coverage Report - com.ctrip.framework.apollo.biz.service.AdminService

Classes in this File | Line Coverage | Branch Coverage | Complexity
AdminService |
100% | 8/8
N/A | N/A
| 1.0;1

1 |  |
     package com.ctrip.framework.apollo.biz.service;
2 |  |
3 |  |
     import org.springframework.beans.factory.annotation.Autowired;
4 |  |
     import org.springframework.stereotype.Service;
5 |  |
     import org.springframework.transaction.annotation.Transactional;
6 |  |
7 |  |
     import com.ctrip.framework.apollo.common.entity.App;
8 |  |
     import com.ctrip.framework.apollo.core.ConfigConsts;
9 |  |
10 |  |
     @Service
11 | 1 |
     public class AdminService {
12 |  |
13 |  |
       @Autowired
14 |  |
       private AppService appService;
15 |  |
16 |  |
       @Autowired
17 |  |
       private AppNamespaceService appNamespaceService;
18 |  |
19 |  |
       @Autowired
20 |  |
       private ClusterService clusterService;
21 |  |
22 |  |
       @Autowired
23 |  |
       private NamespaceService namespaceService;
24 |  |
25 |  |
       @Transactional
26 |  |
       public App createNewApp(App app) {
27 | 6 |
         String createBy = app.getDataChangeCreatedBy();
28 | 6 |
         App createdApp = appService.save(app);
29 |  |
30 | 5 |
         String appId = createdApp.getAppId();
31 |  |
32 | 5 |
         appNamespaceService.createDefaultAppNamespace(appId, createBy);
33 |  |
34 | 5 |
         clusterService.createDefaultCluster(appId, createBy);
35 |  |
36 | 5 |
         namespaceService.createPrivateNamespace(appId, ConfigConsts.CLUSTER_NAME_DEFAULT, createBy);
37 |  |
38 | 5 |
         return app;
39 |  |
       }
40 |  |
41 |  |
     }