示例#1
0
 @Override
 public Test createTest(Test test) throws ServiceException {
   if (!userService.isLoggedUserInGroup(test.getGroupId())) {
     throw new org.perfrepo.web.security.SecurityException(
         "securityException.userNotInGroup.createTest",
         userService.getLoggedUser().getUsername(),
         test.getGroupId());
   }
   if (testDAO.findByUid(test.getUid()) != null) {
     throw new ServiceException("serviceException.testUidExists", test.getUid());
   }
   Test createdTest = testDAO.create(test);
   // store metrics
   if (test.getMetrics() != null) {
     for (Metric metric : test.getMetrics()) {
       addMetric(test, metric);
     }
   }
   return createdTest;
 }