2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6 * ===========================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END====================================================
22 package org.onap.aaf.misc.rosetta.env;
24 import static org.junit.Assert.assertTrue;
25 import static org.mockito.MockitoAnnotations.initMocks;
27 import java.applet.Applet;
28 import java.util.Properties;
30 import javax.xml.namespace.QName;
31 import javax.xml.validation.Schema;
33 import org.junit.Before;
34 import org.junit.Test;
35 import org.mockito.Mock;
36 import org.mockito.Mockito;
37 import org.onap.aaf.misc.env.APIException;
38 import org.onap.aaf.misc.env.Env;
39 import org.onap.aaf.misc.env.jaxb.JAXBmar;
40 import org.onap.aaf.misc.rosetta.Saved;
42 public class JU_RosettaEnv {
50 public void testNewDataFactoryClass() {
51 RosettaEnv rosettaObj = new RosettaEnv();
53 Object retVal = rosettaObj.newDataFactory(Api.class);
54 assertTrue(retVal instanceof RosettaDF);
55 } catch (APIException e) {
56 // TODO Auto-generated catch block
62 public void testNewDataFactorySchema() {
63 RosettaEnv rosettaObj = new RosettaEnv(Mockito.mock(Applet.class),"test");
65 Object retVal = rosettaObj.newDataFactory(Mockito.mock(Schema.class),Api.class);
66 assertTrue(retVal instanceof RosettaDF);
67 } catch (APIException e) {
68 // TODO Auto-generated catch block
74 public void testNewDataFactoryQname() {
75 RosettaEnv rosettaObj = new RosettaEnv(new String[] {"test"});
76 rosettaObj = new RosettaEnv(Mockito.mock(Properties.class));
78 Object retVal = rosettaObj.newDataFactory(Mockito.mock(QName.class),Api.class);
79 assertTrue(retVal instanceof RosettaDF);
80 } catch (APIException e) {
81 // TODO Auto-generated catch block
87 public void testNewDataFactoryQnameSchema() {
88 RosettaEnv rosettaObj = new RosettaEnv("test", new String[] {"test"});
89 rosettaObj = new RosettaEnv("test", Mockito.mock(Properties.class));
91 Object retVal = rosettaObj.newDataFactory(Mockito.mock(Schema.class),Mockito.mock(QName.class),Api.class);
92 assertTrue(retVal instanceof RosettaDF);
93 } catch (APIException e) {
94 // TODO Auto-generated catch block