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.assertNotNull;
37 import static org.junit.Assert.assertTrue;
39 @RunWith(SpringJUnit4ClassRunner.class)
40 @ContextConfiguration("classpath:application-context-test.xml")
41 public class AdditionalInformationOperationTest extends ModelTestBase {
43 private static String USER_ID = "muUserId";
44 private static String CATEGORY_NAME = "category/mycategory";
46 @javax.annotation.Resource(name = "titan-generic-dao")
47 private TitanGenericDao titanDao;
49 @javax.annotation.Resource(name = "additional-information-operation")
50 private IAdditionalInformationOperation additionalInformationOperation;
53 public void createUserAndCategory() {
54 deleteAndCreateCategory(CATEGORY_NAME);
55 deleteAndCreateUser(USER_ID, "first_" + USER_ID, "last_" + USER_ID);
60 public static void setupBeforeClass() {
67 public void testDummy() {
69 assertNotNull(additionalInformationOperation);
73 private UserData deleteAndCreateUser(String userId, String firstName, String lastName) {
74 UserData userData = new UserData();
75 userData.setUserId(userId);
76 userData.setFirstName(firstName);
77 userData.setLastName(lastName);
79 titanDao.deleteNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.User), userId, UserData.class);
80 titanDao.createNode(userData, UserData.class);
86 private void deleteAndCreateCategory(String category) {
87 String[] names = category.split("/");
88 OperationTestsUtil.deleteAndCreateResourceCategory(names[0], names[1], titanDao);