##### Coverage Report - com.ctrip.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.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.apollo.biz.entity.App;
8 |  |
9 |  |
     @Service
10 | 1 |
     public class AdminService {
11 |  |
12 |  |
       @Autowired
13 |  |
       private AppService appService;
14 |  |
15 |  |
       @Autowired
16 |  |
       private AppNamespaceService appNamespaceService;
17 |  |
18 |  |
       @Autowired
19 |  |
       private ClusterService clusterService;
20 |  |
21 |  |
       @Autowired
22 |  |
       private NamespaceService namespaceService;
23 |  |
24 |  |
       @Transactional
25 |  |
       public App createNewApp(App app) {
26 | 5 |
         String createBy = app.getDataChangeCreatedBy();
27 | 5 |
         App createdApp = appService.save(app);
28 |  |
29 | 4 |
         String appId = createdApp.getAppId();
30 |  |
31 | 4 |
         appNamespaceService.createDefaultAppNamespace(appId, createBy);
32 |  |
33 | 4 |
         clusterService.createDefaultCluster(appId, createBy);
34 |  |
35 | 4 |
         namespaceService.createDefaultNamespace(appId, createBy);
36 |  |
37 | 4 |
         return app;
38 |  |
       }
39 |  |
40 |  |
     }