View Javadoc
1   /**
2    * Copyright 2004-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.student.mock.mojo;
17  
18  import org.kuali.student.contract.model.Service;
19  import org.kuali.student.contract.model.ServiceContractModel;
20  import org.kuali.student.contract.model.util.ServicesFilter;
21  import org.slf4j.Logger;
22  import org.slf4j.LoggerFactory;
23  
24  /**
25   * This class writers the conformance tests for service
26   *
27   * @author Mezba Mahtab (mezba.mahtab@utoronto.ca)
28   */
29  public class ConformanceTestWriter extends MockImplWriter {
30  
31      private static final Logger log = LoggerFactory.getLogger(ConformanceTestWriter.class);
32      
33      ///////////////////////
34      // CONSTRUCTOR
35      ///////////////////////
36  
37      public ConformanceTestWriter(ServiceContractModel model, String directory, String rootPackage, ServicesFilter filter, boolean isR1) {
38          super (model, directory, rootPackage, filter, isR1);
39      }
40  
41      ////////////////////////
42      // FUNCTIONAL
43      ////////////////////////
44  
45      /**
46       * Write out the entire file
47       */
48      public void write() {
49          this.validate();
50          for (Service service : filterServices()) {
51              log.info ("************** generating conformance test for service = " + service.getKey() + " **************");
52              
53              try {
54                  new ConformanceTestWriterForOneService(model, directory, rootPackage, service.getKey(), isR1).write();
55              } catch (Exception e) {
56                  log.error ("Failed to generate conformance test for service = " + service.getKey(), e);
57              }
58          }
59      }
60  
61  }