Coverage Report - org.kuali.student.contract.command.run.PureJavaInterfaceWriterRun
 
Classes in this File Line Coverage Branch Coverage Complexity
PureJavaInterfaceWriterRun
0%
0/25
0%
0/4
1.75
 
 1  
 /*
 2  
  * Copyright 2009 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.osedu.org/licenses/ECL-2.0
 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.contract.command.run;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.Collection;
 20  
 import java.util.List;
 21  
 
 22  
 import org.kuali.student.contract.model.ServiceContractModel;
 23  
 import org.kuali.student.contract.model.impl.ServiceContractModelCache;
 24  
 import org.kuali.student.contract.model.impl.ServiceContractModelQDoxLoader;
 25  
 import org.kuali.student.contract.model.validation.ServiceContractModelValidator;
 26  
 import org.kuali.student.contract.writer.service.PureJavaInfcWriter;
 27  
 
 28  
 /**
 29  
  *
 30  
  * @author nwright
 31  
  */
 32  
 public class PureJavaInterfaceWriterRun
 33  
 {
 34  
 
 35  
  public PureJavaInterfaceWriterRun ()
 36  0
  {
 37  0
  }
 38  
  private static final String CORE_DIRECTORY =
 39  
                              "C:/svn/student/ks-core/ks-core-api/src/main/java";
 40  
 //                           "C:/svn/maven-dictionary-generator/trunk/src/main/java/org/kuali/student/core";
 41  
  private static final String COMMON_DIRECTORY =
 42  
                              "C:/svn/student/ks-common/ks-common-api/src/main/java";
 43  
  private static final String LUM_DIRECTORY =
 44  
                              "C:/svn/student/ks-lum/ks-lum-api/src/main/java";
 45  
 
 46  
  private static ServiceContractModel getModel ()
 47  
  {
 48  0
   List<String> srcDirs = new ArrayList ();
 49  0
   srcDirs.add (CORE_DIRECTORY);
 50  0
   srcDirs.add (COMMON_DIRECTORY);
 51  0
   srcDirs.add (LUM_DIRECTORY);
 52  0
   ServiceContractModel instance = new ServiceContractModelQDoxLoader (srcDirs);
 53  0
   return new ServiceContractModelCache (instance);
 54  
  }
 55  
 
 56  
  private static void validate (ServiceContractModel model)
 57  
  {
 58  0
   Collection<String> errors =
 59  
                      new ServiceContractModelValidator (model).validate ();
 60  0
   if (errors.size () > 0)
 61  
   {
 62  0
    StringBuffer buf = new StringBuffer ();
 63  0
    buf.append (errors.size () + " errors found while validating the data.");
 64  0
    int cnt = 0;
 65  0
    for (String msg : errors)
 66  
    {
 67  0
     cnt ++;
 68  0
     buf.append ("\n");
 69  0
     buf.append ("*error*" + cnt + ":" + msg);
 70  
    }
 71  
 
 72  0
    throw new IllegalArgumentException (buf.toString ());
 73  
   }
 74  0
  }
 75  
 
 76  
  public static void main (String[] args)
 77  
  {
 78  0
   ServiceContractModel model = getModel ();
 79  0
   validate (model);
 80  
 //   List<String> servicesToProcess = new ArrayList ();
 81  
 //   servicesToProcess.add ("atp");
 82  
 //   servicesToProcess.add ("lu");
 83  
 //   servicesToProcess.add ("lo");
 84  
 //   servicesToProcess.add ("organization");
 85  
 //   servicesToProcess.add ("proposal");
 86  
 ////   servicesToProcess.add ("comment");
 87  
 //   servicesToProcess.add ("dictionary");
 88  
 //   servicesToProcess.add ("document");
 89  
 //   servicesToProcess.add ("enumerable");
 90  
 //   servicesToProcess.add ("search");
 91  
 //   ServicesFilter filter = new ServicesFilterByKeys (servicesToProcess);
 92  0
   String targetDir = "target/gen-src";
 93  
 //  targetDir = "src/main/java";
 94  0
   PureJavaInfcWriter instance =
 95  
                  new PureJavaInfcWriter (model,
 96  
                                      targetDir,
 97  
                                      PureJavaInfcWriter.DEFAULT_ROOT_PACKAGE,
 98  
                                      null);
 99  0
   instance.write ();
 100  
 
 101  0
  }
 102  
 }