Merge "Moving a recently added trim() call in SwitchHandler after Null check."
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-to-sources-plugin-it / src / test / java / org / opendaylight / controller / yang2sources / plugin / it / YangToResourcesPluginTest.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.yang2sources.plugin.it;
9
10 import org.apache.maven.it.VerificationException;
11 import org.apache.maven.it.Verifier;
12 import org.junit.Test;
13
14 public class YangToResourcesPluginTest {
15
16     @Test
17     public void testCorrect() throws VerificationException {
18         Verifier v = YangToSourcesPluginTest.setUp("Correct_resources/", false);
19         verifyCorrectLog(v);
20     }
21
22     static void verifyCorrectLog(Verifier v) throws VerificationException {
23         v.verifyErrorFreeLog();
24         v.verifyTextInLog("[INFO] yang-to-resources: Resource provider instantiated from org.opendaylight.controller.yang2sources.spi.ResourceProviderTestImpl");
25         v.verifyTextInLog("[INFO] yang-to-resources: Resource provider org.opendaylight.controller.yang2sources.spi.ResourceProviderTestImpl call successful");
26     }
27
28     @Test
29     public void testNoGenerators() throws VerificationException {
30         Verifier v = YangToSourcesPluginTest.setUp("NoGenerators_resources/",
31                 false);
32         v.verifyErrorFreeLog();
33         v.verifyTextInLog("[WARNING] yang-to-resources: No resource provider classes provided");
34     }
35
36     @Test
37     public void testUnknownGenerator() throws VerificationException {
38         Verifier v = YangToSourcesPluginTest.setUp(
39                 "UnknownGenerator_resources/", true);
40         v.verifyTextInLog("[ERROR] yang-to-resources: Unable to provide resources with unknown resource provider");
41         v.verifyTextInLog("java.lang.ClassNotFoundException: unknown");
42         v.verifyTextInLog("[INFO] yang-to-resources: Resource provider instantiated from org.opendaylight.controller.yang2sources.spi.ResourceProviderTestImpl");
43         v.verifyTextInLog("[INFO] yang-to-resources: Resource provider org.opendaylight.controller.yang2sources.spi.ResourceProviderTestImpl call successful");
44         v.verifyTextInLog("[ERROR] yang-to-resources: One or more code resource provider failed, including failed list(resourceProviderClass=exception) {unknown=java.lang.ClassNotFoundException}");
45     }
46
47 }