View Javadoc
1   /**
2    * Copyright 2014-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.common.jute.project;
17  
18  import static com.google.common.base.Stopwatch.createStarted;
19  import static com.google.inject.Guice.createInjector;
20  
21  import java.util.Date;
22  
23  import org.junit.Test;
24  import org.kuali.common.jute.base.BaseUnitTest;
25  import org.kuali.common.jute.env.EnvModule;
26  import org.kuali.common.jute.json.jackson.JacksonModule;
27  import org.kuali.common.jute.project.maven.KualiJuteModule;
28  import org.kuali.common.jute.project.maven.ProjectMetadata;
29  import org.kuali.common.jute.project.maven.annotation.KualiJuteProjectMetadata;
30  import org.kuali.common.jute.system.SystemModule;
31  
32  import com.google.common.base.Stopwatch;
33  import com.google.inject.Injector;
34  import com.google.inject.Key;
35  
36  public class KualiJuteModuleTest extends BaseUnitTest {
37  
38      @Test
39      public void test() {
40          try {
41              Stopwatch sw = createStarted();
42              Injector injector = createInjector(new SystemModule(), new EnvModule(), new JacksonModule(), new KualiJuteModule());
43              Key<ProjectMetadata> key = Key.get(ProjectMetadata.class, KualiJuteProjectMetadata.class);
44              ProjectMetadata metadata = injector.getInstance(key);
45              info("user    -> %s", metadata.getBuild().getUser());
46              info("date    -> %s", new Date(metadata.getBuild().getTimestamp()));
47              elapsed(sw);
48          } catch (Throwable e) {
49              e.printStackTrace();
50          }
51      }
52  
53  }