001 /**
002 * Copyright 2004-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.student.mock.mojo;
017
018 import org.kuali.student.contract.model.Service;
019 import org.kuali.student.contract.model.ServiceContractModel;
020 import org.kuali.student.contract.model.util.ServicesFilter;
021 import org.slf4j.Logger;
022 import org.slf4j.LoggerFactory;
023
024 /**
025 * This class writers the conformance tests for service
026 *
027 * @author Mezba Mahtab (mezba.mahtab@utoronto.ca)
028 */
029 public class ConformanceTestWriter extends MockImplWriter {
030
031 private static final Logger log = LoggerFactory.getLogger(ConformanceTestWriter.class);
032
033 ///////////////////////
034 // CONSTRUCTOR
035 ///////////////////////
036
037 public ConformanceTestWriter(ServiceContractModel model, String directory, String rootPackage, ServicesFilter filter, boolean isR1) {
038 super (model, directory, rootPackage, filter, isR1);
039 }
040
041 ////////////////////////
042 // FUNCTIONAL
043 ////////////////////////
044
045 /**
046 * Write out the entire file
047 */
048 public void write() {
049 this.validate();
050 for (Service service : filterServices()) {
051 log.info ("************** generating conformance test for service = " + service.getKey() + " **************");
052
053 try {
054 new ConformanceTestWriterForOneService(model, directory, rootPackage, service.getKey(), isR1).write();
055 } catch (Exception e) {
056 log.error ("Failed to generate conformance test for service = " + service.getKey(), e);
057 }
058 }
059 }
060
061 }