2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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=========================================================
21 package org.openecomp.sdc.be.model.operations.impl;
23 import org.junit.Before;
24 import org.junit.BeforeClass;
25 import org.junit.Test;
26 import org.junit.runner.RunWith;
27 import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
28 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
29 import org.openecomp.sdc.be.model.ModelTestBase;
30 import org.openecomp.sdc.be.model.operations.api.IAdditionalInformationOperation;
31 import org.openecomp.sdc.be.model.operations.impl.util.OperationTestsUtil;
32 import org.openecomp.sdc.be.resources.data.UserData;
33 import org.springframework.test.context.ContextConfiguration;
34 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
36 import static org.junit.Assert.assertTrue;
38 @RunWith(SpringJUnit4ClassRunner.class)
39 @ContextConfiguration("classpath:application-context-test.xml")
40 public class AdditionalInformationOperationTest extends ModelTestBase {
42 private static String USER_ID = "muUserId";
43 private static String CATEGORY_NAME = "category/mycategory";
45 @javax.annotation.Resource(name = "titan-generic-dao")
46 private TitanGenericDao titanDao;
48 @javax.annotation.Resource(name = "additional-information-operation")
49 private IAdditionalInformationOperation additionalInformationOperation;
52 public void createUserAndCategory() {
53 deleteAndCreateCategory(CATEGORY_NAME);
54 deleteAndCreateUser(USER_ID, "first_" + USER_ID, "last_" + USER_ID);
59 public static void setupBeforeClass() {
66 public void testDummy() {
68 assertTrue(additionalInformationOperation != null);
72 private UserData deleteAndCreateUser(String userId, String firstName, String lastName) {
73 UserData userData = new UserData();
74 userData.setUserId(userId);
75 userData.setFirstName(firstName);
76 userData.setLastName(lastName);
78 titanDao.deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), userId, UserData.class);
79 titanDao.createNode(userData, UserData.class);
85 private void deleteAndCreateCategory(String category) {
86 String[] names = category.split("/");
87 OperationTestsUtil.deleteAndCreateResourceCategory(names[0], names[1], titanDao);