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