<repo_name>zeroichi/sdc<file_sep>/catalog-be/src/main/resources/scripts/sdcBePy/common/sdcBeProxy.py
import json
from io import BytesIO

import pycurl

from sdcBePy.common.helpers import check_arguments_not_none


def get_url(ip, port, protocol):
    return "%s://%s:%s" % (protocol, ip, port)


class SdcBeProxy:

    BODY_SEPARATOR = "\r\n\r\n"
    CHARTSET = 'UTF-8'

    def __init__(self, be_ip, be_port, header, scheme, user_id="jh0003",
                 debug=False, connector=None):
        if not check_arguments_not_none(be_ip, be_port, scheme, user_id):
            raise AttributeError("The be_host, be_port, scheme or admin_user are missing")
        url = get_url(be_ip, be_port, scheme)
        self.con = connector if connector \
            else CurlConnector(url, user_id, header, scheme=scheme, debug=debug)

    def check_backend(self):
        return self.con.get('/sdc2/rest/v1/user/jh0003')

    def check_user(self, user_name):
          return self.con.get("/sdc2/rest/v1/user" + user_name)

    def create_user(self, first_name, last_name, user_id, email, role):

        return self.con.post('/sdc2/rest/v1/user', json.dumps({
            'firstName': first_name,
            'lastName': last_name,
            'userId': user_id,
            'email': email,
            'role': role
        }))

    def check_consumer(self, consumer_name):
        return self.con.get("/sdc2/rest/v1/consumers" + consumer_name)

    def create_consumer(self, consumer_name, slat, password):
        return self.con.post("/sdc2/rest/v1/consumers", json.dumps({
            'consumerName': consumer_name,
            'consumerSalt': slat,
            'consumerPassword': <PASSWORD>
        }))

    def get_normatives(self):
        return self.con.get("/sdc2/rest/v1/screen", with_buffer=True)

    def post_file(self, path, multi_part_form_data):
        return self.con.post_file(path, multi_part_form_data)

    def get_response_from_buffer(self):
        value = self.con.buffer.getvalue()
        self.con.buffer.truncate(0)
        self.con.buffer.seek(0)

        response = value.decode(self.CHARTSET).split(self.BODY_SEPARATOR)
        return response[1] if len(response) == 2 else response[0]


class CurlConnector:
    CONTENT_TYPE_HEADER = "Content-Type: application/json"
    ACCEPT_HEADER = "Accept: application/json; charset=UTF-8"

    def __init__(self, url, user_id_header, header, buffer=None, scheme="http", debug=False):
        self.c = pycurl.Curl()
        self.c.setopt(pycurl.HEADER, True)

        self.user_header = "USER_ID: " + user_id_header

        if not debug:
            # disable printing not necessary logs in the terminal
            self.c.setopt(pycurl.WRITEFUNCTION, lambda x: None)
        else:
            self.c.setopt(pycurl.VERBOSE, 1)

        if not buffer:
            self.buffer = BytesIO()

        if header is None:
            self.basicauth_header = ""
        else:
            self.basicauth_header = "Authorization: Basic " + header

        self.url = url
        self._check_schema(scheme)

    def get(self, path, buffer=None, with_buffer=False):
        try:
            self.c.setopt(pycurl.URL, self.url + path)
            self.c.setopt(pycurl.HTTPHEADER, [self.user_header,
                                              CurlConnector.CONTENT_TYPE_HEADER,
                                              CurlConnector.ACCEPT_HEADER,
                                              self.basicauth_header])


            if with_buffer:
                write = self.buffer.write if not buffer else buffer.write
                self.c.setopt(pycurl.WRITEFUNCTION, write)

            self.c.perform()
            return self.c.getinfo(pycurl.RESPONSE_CODE)
        except pycurl.error:
            return 111

    def post(self, path, data):
        try:
            self.c.setopt(pycurl.URL, self.url + path)
            self.c.setopt(pycurl.POST, 1)

            self.c.setopt(pycurl.HTTPHEADER, [self.user_header,
                                           CurlConnector.CONTENT_TYPE_HEADER,
                                           CurlConnector.ACCEPT_HEADER,
                                           self.basicauth_header])

            self.c.setopt(pycurl.POSTFIELDS, data)

            self.c.perform()
            self.c.setopt(pycurl.POST, 0)

            return self.c.getinfo(pycurl.RESPONSE_CODE)
        except pycurl.error:
            return 111

    def post_file(self, path, post_body, buffer=None):
        try:
            self.c.setopt(pycurl.URL, self.url + path)
            self.c.setopt(pycurl.POST, 1)
            self.c.setopt(pycurl.HTTPHEADER, [self.user_header,
                                           self.basicauth_header])


            self.c.setopt(pycurl.HTTPPOST, post_body)

            write = self.buffer.write if not buffer else buffer.write
            self.c.setopt(pycurl.WRITEFUNCTION, write)

            self.c.perform()
            self.c.setopt(pycurl.POST, 0)

            return self.c.getinfo(pycurl.RESPONSE_CODE)
        except pycurl.error:
            return 111

    def _check_schema(self, scheme):
        if scheme == 'https':
            self.c.setopt(pycurl.SSL_VERIFYPEER, 0)
            self.c.setopt(pycurl.SSL_VERIFYHOST, 0)

    def __del__(self):
        self.c.close()
<file_sep>/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicHealthTest.java
/*-
 * ============LICENSE_START=======================================================
 * SDC
 * ================================================================================
 * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.openecomp.sdc.be.components.health;

import mockit.Deencapsulation;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.portalsdk.core.onboarding.exception.CipherUtilException;
import org.openecomp.sdc.be.catalog.impl.DmaapProducerHealth;
import org.openecomp.sdc.be.components.BeConfDependentTest;
import org.openecomp.sdc.be.components.distribution.engine.DistributionEngineClusterHealth;
import org.openecomp.sdc.be.components.distribution.engine.DmaapHealth;
import org.openecomp.sdc.be.switchover.detector.SwitchoverDetector;
import org.openecomp.sdc.common.api.HealthCheckInfo;
import org.openecomp.sdc.common.http.client.api.HttpExecuteException;
import org.springframework.test.util.ReflectionTestUtils;

import java.util.LinkedList;
import java.util.List;

import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import static org.openecomp.sdc.common.api.Constants.HC_COMPONENT_ON_BOARDING;

@RunWith(MockitoJUnitRunner.class)
public class HealthCheckBusinessLogicHealthTest extends BeConfDependentTest {
	private DmaapProducerHealth dmaapProducerHealth = mock(DmaapProducerHealth.class);
	private HealthCheckInfo dmaapProducerHealthCheckInfo = mock(HealthCheckInfo.class);

	private SwitchoverDetector switchoverDetector;

	private HealthCheckBusinessLogic createTestSubject() {

		HealthCheckBusinessLogic healthCheckBusinessLogic = new HealthCheckBusinessLogic();
		DmaapHealth dmaapHealth = new DmaapHealth();
		ReflectionTestUtils.setField(healthCheckBusinessLogic, "dmaapHealth", dmaapHealth);
		PortalHealthCheckBuilder portalHealthCheckBuilder = new PortalHealthCheckBuilder();
		ReflectionTestUtils.setField(healthCheckBusinessLogic, "portalHealthCheck", portalHealthCheckBuilder);
		DistributionEngineClusterHealth distributionEngineClusterHealth = new DistributionEngineClusterHealth();
		ReflectionTestUtils.setField(healthCheckBusinessLogic, "distributionEngineClusterHealth",
				distributionEngineClusterHealth);
		SwitchoverDetector switchoverDetector = new SwitchoverDetector();
		ReflectionTestUtils.setField(healthCheckBusinessLogic, "switchoverDetector", switchoverDetector);
		List<HealthCheckInfo> prevBeHealthCheckInfos = new LinkedList<>();
		ReflectionTestUtils.setField(healthCheckBusinessLogic, "prevBeHealthCheckInfos", prevBeHealthCheckInfos);
		ReflectionTestUtils.setField(healthCheckBusinessLogic, "dmaapProducerHealth", dmaapProducerHealth);
		return healthCheckBusinessLogic;
	}



	@Before
	public void beforeTest() {
		when(dmaapProducerHealth.getHealthCheckInfo())
				.thenReturn(dmaapProducerHealthCheckInfo);
	}

	@Test
	public void testInit() throws Exception {
		HealthCheckBusinessLogic testSubject = createTestSubject();
		testSubject.init();
	}

	@Test
	public void testIsDistributionEngineUp() throws Exception {
		HealthCheckBusinessLogic testSubject;
		// default test
		testSubject = createTestSubject();
		testSubject.isDistributionEngineUp();
	}

	@Test
	public void testGetBeHealthCheckInfosStatus() throws Exception {
		HealthCheckBusinessLogic testSubject;

		// default test
		testSubject = createTestSubject();
		testSubject.getBeHealthCheckInfosStatus();
	}

	@Test
	public void testGetBeHealthCheckInfos() throws Exception {
		HealthCheckBusinessLogic testSubject;

		// default test
		testSubject = createTestSubject();
		Deencapsulation.invoke(testSubject, "getBeHealthCheckInfos");
	}

	@Test
	public void testGetDmaapHealthCheck() throws Exception {
		HealthCheckBusinessLogic testSubject;
		List<HealthCheckInfo> healthCheckInfos = new LinkedList<>();

		// default test
		testSubject = createTestSubject();
		Deencapsulation.invoke(testSubject, "getDmaapHealthCheck");
	}

	@Test
	public void testGetJanusGraphHealthCheck() throws Exception {
		HealthCheckBusinessLogic testSubject;
		List<HealthCheckInfo> healthCheckInfos = new LinkedList<>();

		// default test
		testSubject = createTestSubject();
//		testSubject.getJanusGraphHealthCheck(healthCheckInfos);
		healthCheckInfos.add(testSubject.getJanusGraphHealthCheck());
	}

	@Test
	public void testGetCassandraHealthCheck() throws Exception {
		HealthCheckBusinessLogic testSubject;

		// default test
		testSubject = createTestSubject();
		Deencapsulation.invoke(testSubject, "getCassandraHealthCheck");
	}

	@Test
	public void testGetDistributionEngineCheck() throws Exception {
//		HealthCheckBusinessLogic testSubject;
		DistributionEngineClusterHealth testSubject = new DistributionEngineClusterHealth();

		// default test
		Deencapsulation.invoke(testSubject, "getHealthCheckInfo");
	}

	@Test
	public void testGetAmdocsHealthCheck() throws Exception {
		HealthCheckBusinessLogic testSubject;
		List<HealthCheckInfo> healthCheckInfos = new LinkedList<>();

		// default test
		testSubject = createTestSubject();
		String url = testSubject.buildOnBoardingHealthCheckUrl();
		Deencapsulation.invoke(testSubject, "getHostedComponentsBeHealthCheck", HC_COMPONENT_ON_BOARDING, url);
	}

	@Test
	public void testGetPortalHealthCheckSuccess() throws Exception {
		PortalHealthCheckBuilder testSubject = spy(PortalHealthCheckBuilder.class);
		String healthCheckURL = testSubject.buildPortalHealthCheckUrl();
		int timeout = 3000;
		doReturn(200).when(testSubject).getStatusCode(eq(healthCheckURL), eq(timeout));
		testSubject.init();
		testSubject.runTask();
		HealthCheckInfo hci = testSubject.getHealthCheckInfo();
		Assert.assertEquals("PORTAL", hci.getHealthCheckComponent());
		Assert.assertEquals(HealthCheckInfo.HealthCheckStatus.UP, hci.getHealthCheckStatus());
		Assert.assertEquals("OK", hci.getDescription());
	}

	@Test
	public void testGetPortalHealthCheckFailureMissingConfig() throws Exception{
		PortalHealthCheckBuilder testSubject = new PortalHealthCheckBuilder();
		testSubject.init(null);
		HealthCheckInfo hci = testSubject.getHealthCheckInfo();
		Assert.assertEquals("PORTAL", hci.getHealthCheckComponent());
		Assert.assertEquals(HealthCheckInfo.HealthCheckStatus.DOWN, hci.getHealthCheckStatus());
		Assert.assertEquals("PORTAL health check configuration is missing", hci.getDescription());
	}


	@Test
	public void testGetPortalHealthCheckFailureErrorResponse() throws HttpExecuteException, CipherUtilException {
		PortalHealthCheckBuilder testSubject = spy(PortalHealthCheckBuilder.class);
		String healthCheckURL = testSubject.buildPortalHealthCheckUrl();
		int timeout = 3000;
//		when(testSubject.getStatusCode(healthCheckURL,timeout)).thenReturn(404);
		doReturn(404).when(testSubject).getStatusCode(eq(healthCheckURL), eq(timeout));
		testSubject.init(testSubject.getConfiguration());
		testSubject.runTask();
		HealthCheckInfo hci = testSubject.getHealthCheckInfo();
		Assert.assertEquals("PORTAL", hci.getHealthCheckComponent());
		Assert.assertEquals(HealthCheckInfo.HealthCheckStatus.DOWN, hci.getHealthCheckStatus());
		Assert.assertEquals("PORTAL responded with 404 status code", hci.getDescription());
	}

	@Test
	public void testGetPortalHealthCheckFailureNoResponse() throws HttpExecuteException, CipherUtilException {
		PortalHealthCheckBuilder testSubject = spy(PortalHealthCheckBuilder.class);
		String healthCheckURL = testSubject.buildPortalHealthCheckUrl();
		int timeout = 3000;
//		when(testSubject.getStatusCode(healthCheckURL, timeout)).thenThrow(HttpExecuteException.class);
		doThrow(HttpExecuteException.class).when(testSubject).getStatusCode(eq(healthCheckURL), eq(timeout));
		testSubject.init(testSubject.getConfiguration());
		testSubject.runTask();
		HealthCheckInfo hci = testSubject.getHealthCheckInfo();
		Assert.assertEquals("PORTAL", hci.getHealthCheckComponent());
		Assert.assertEquals(HealthCheckInfo.HealthCheckStatus.DOWN, hci.getHealthCheckStatus());
		Assert.assertEquals("PORTAL is not available", hci.getDescription());
	}

	@Test
	public void testGetHostedComponentsBeHealthCheck() throws Exception {
		HealthCheckBusinessLogic testSubject;
		String componentName = "mock";
		String healthCheckUrl = "mock";
		// test 1
		testSubject = createTestSubject();
		Deencapsulation.invoke(testSubject, "getHostedComponentsBeHealthCheck", componentName, healthCheckUrl);

		// test 2
		testSubject = createTestSubject();
		healthCheckUrl = "";
		Deencapsulation.invoke(testSubject, "getHostedComponentsBeHealthCheck", componentName, healthCheckUrl);
	}

	@Test
	public void testDestroy() throws Exception {
		HealthCheckBusinessLogic testSubject;

		// default test
		testSubject = createTestSubject();
		Deencapsulation.invoke(testSubject, "destroy");
	}

	@Test
	public void testLogAlarm() throws Exception {
		HealthCheckBusinessLogic testSubject;
		String componentChangedMsg = "mock";

		// default test
		testSubject = createTestSubject();
		Deencapsulation.invoke(testSubject, "logAlarm", componentChangedMsg);
	}

	@Test
	public void testGetSiteMode() throws Exception {
		HealthCheckBusinessLogic testSubject;

		// default test
		testSubject = createTestSubject();
		testSubject.getSiteMode();
	}

	@Test
	public void testAnyStatusChanged() throws Exception {
		HealthCheckBusinessLogic testSubject;
		List<HealthCheckInfo> beHealthCheckInfos = null;
		List<HealthCheckInfo> prevBeHealthCheckInfos = null;
		boolean result;

		// test 1
		testSubject = createTestSubject();
		beHealthCheckInfos = null;
		prevBeHealthCheckInfos = null;
		result = testSubject.anyStatusChanged(beHealthCheckInfos, prevBeHealthCheckInfos);
		Assert.assertEquals(false, result);

		// test 2
		testSubject = createTestSubject();
		prevBeHealthCheckInfos = null;
		beHealthCheckInfos = null;
		result = testSubject.anyStatusChanged(beHealthCheckInfos, prevBeHealthCheckInfos);
		Assert.assertEquals(false, result);

		// test 3
		testSubject = createTestSubject();
		beHealthCheckInfos = null;
		prevBeHealthCheckInfos = null;
		result = testSubject.anyStatusChanged(beHealthCheckInfos, prevBeHealthCheckInfos);
		Assert.assertEquals(false, result);

		// test 4
		testSubject = createTestSubject();
		prevBeHealthCheckInfos = null;
		beHealthCheckInfos = null;
		result = testSubject.anyStatusChanged(beHealthCheckInfos, prevBeHealthCheckInfos);
		Assert.assertEquals(false, result);
	}

	@Test
	public void testBuildOnBoardingHealthCheckUrl() throws Exception {
		HealthCheckBusinessLogic testSubject;

		// default test
		testSubject = createTestSubject();
		Deencapsulation.invoke(testSubject, "buildOnBoardingHealthCheckUrl");
	}

}
<file_sep>/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java
/*
 * ============LICENSE_START=======================================================
 *  Copyright (C) 2021 Nordix Foundation
 *  ================================================================================
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *  SPDX-License-Identifier: Apache-2.0
 *  ============LICENSE_END=========================================================
 */
package org.openecomp.sdc.be.servlets;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.validation.ConstraintViolationException;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jetty.http.HttpStatus;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
import org.openecomp.sdc.be.components.impl.ModelBusinessLogic;
import org.openecomp.sdc.be.components.impl.ResourceImportManager;
import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.config.SpringConfig;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.exception.BusinessException;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.impl.ServletUtils;
import org.openecomp.sdc.be.impl.WebAppContextWrapper;
import org.openecomp.sdc.be.model.Model;
import org.openecomp.sdc.be.ui.model.ModelCreateRequest;
import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.web.context.WebApplicationContext;

@TestInstance(Lifecycle.PER_CLASS)
class ModelServletTest extends JerseyTest {

    private static final String USER_ID = "cs0008";

    @Mock
    private HttpServletRequest request;
    @Mock
    private HttpSession session;
    @Mock
    private ServletContext servletContext;
    @Mock
    private WebAppContextWrapper webAppContextWrapper;
    @Mock
    private WebApplicationContext webApplicationContext;
    @Mock
    private UserBusinessLogic userBusinessLogic;
    @Mock
    private ComponentInstanceBusinessLogic componentInstanceBusinessLogic;
    @Mock
    private ComponentsUtils componentsUtils;
    @Mock
    private ServletUtils servletUtils;
    @Mock
    private ResourceImportManager resourceImportManager;
    @Mock
    private ModelBusinessLogic modelBusinessLogic;
    @InjectMocks
    private ModelServlet modelServlet;
    @Mock
    private ResponseFormat responseFormat;
    @Mock
    private UserValidations userValidations;

    private Model model;
    private Response response;
    private ModelCreateRequest modelCreateRequest;

    @BeforeAll
    public void initClass() {
        MockitoAnnotations.openMocks(this);
        when(request.getSession()).thenReturn(session);
        when(session.getServletContext()).thenReturn(servletContext);
        when(servletContext.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR))
            .thenReturn(webAppContextWrapper);
        when(webAppContextWrapper.getWebAppContext(servletContext)).thenReturn(webApplicationContext);
        when(webApplicationContext.getBean(ModelBusinessLogic.class)).thenReturn(modelBusinessLogic);
        when(request.getHeader(Constants.USER_ID_HEADER)).thenReturn(USER_ID);
        when(webApplicationContext.getBean(ServletUtils.class)).thenReturn(servletUtils);
        when(servletUtils.getComponentsUtils()).thenReturn(componentsUtils);
        final String appConfigDir = "src/test/resources/config/catalog-be";
        final ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
        final ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
        final org.openecomp.sdc.be.config.Configuration configuration = new org.openecomp.sdc.be.config.Configuration();
        configuration.setJanusGraphInMemoryGraph(true);
        configurationManager.setConfiguration(configuration);
        ExternalConfiguration.setAppName("catalog-be");
    }

    @BeforeEach
    void resetMock() throws Exception {
        super.setUp();
        initTestData();
    }

    @AfterEach
    void after() throws Exception {
        super.tearDown();
    }

    private void initTestData() {
        final String modelName = "MY-INTEGRATION-TEST-MODEL";
        model = new Model(modelName);
        modelCreateRequest = new ModelCreateRequest();
        modelCreateRequest.setName(modelName);
    }

    @Override
    protected ResourceConfig configure() {
        forceSet(TestProperties.CONTAINER_PORT, "0");
        final ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
        return new ResourceConfig(ModelServlet.class)
            .register(new AbstractBinder() {
                @Override
                protected void configure() {
                    bind(request).to(HttpServletRequest.class);
                    bind(userBusinessLogic).to(UserBusinessLogic.class);
                    bind(componentInstanceBusinessLogic).to(ComponentInstanceBusinessLogic.class);
                    bind(componentsUtils).to(ComponentsUtils.class);
                    bind(servletUtils).to(ServletUtils.class);
                    bind(resourceImportManager).to(ResourceImportManager.class);
                    bind(modelBusinessLogic).to(ModelBusinessLogic.class);
                }
            })
            .property("contextConfig", context);
    }

    @Test
    void createModelSuccessTest() {
        when(responseFormat.getStatus()).thenReturn(HttpStatus.OK_200);
        when(componentsUtils.getResponseFormat(ActionStatus.CREATED)).thenReturn(responseFormat);
        when(modelBusinessLogic.createModel(any(Model.class))).thenReturn(model);
        response = modelServlet.createModel(modelCreateRequest, USER_ID);
        assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200);
    }

    @Test
    void createModelFailTest() {
        when(responseFormat.getStatus()).thenReturn(HttpStatus.INTERNAL_SERVER_ERROR_500);
        when(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)).thenReturn(responseFormat);
        when(modelBusinessLogic.createModel(any(Model.class))).thenReturn(model);
        response = modelServlet.createModel(modelCreateRequest, USER_ID);
        assertThat(response.getStatus()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR_500);
    }

    @Test
    void createModelFailWithModelNameEmptyTest() {
        when(responseFormat.getStatus()).thenReturn(HttpStatus.INTERNAL_SERVER_ERROR_500);
        when(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)).thenReturn(responseFormat);
        modelCreateRequest.setName(StringUtils.EMPTY);
        final Exception exception = assertThrows(ConstraintViolationException.class, () -> modelServlet.createModel(modelCreateRequest, USER_ID));
        assertThat(exception.getMessage()).isEqualTo("Model name cannot be empty");
    }

    @Test
    void createModelFailWithModelNameNullTest() {
        when(responseFormat.getStatus()).thenReturn(HttpStatus.INTERNAL_SERVER_ERROR_500);
        when(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)).thenReturn(responseFormat);
        modelCreateRequest.setName(null);
        final Exception exception = assertThrows(ConstraintViolationException.class, () -> modelServlet.createModel(modelCreateRequest, USER_ID));
        assertThat(exception.getMessage()).isEqualTo("Model name cannot be null");
    }

    @Test
    void createModelThrowsBusinessExceptionTest() {
        when(modelBusinessLogic.createModel(model)).thenThrow(new BusinessException() {});
        assertThrows(BusinessException.class, () -> modelServlet.createModel(modelCreateRequest, USER_ID));
    }

}<file_sep>/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java
/*
 * ============LICENSE_START=======================================================
 *  Copyright (C) 2021 Nordix Foundation
 *  ================================================================================
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *  SPDX-License-Identifier: Apache-2.0
 *  ============LICENSE_END=========================================================
 */
package org.openecomp.sdc.be.model.operations.impl;

import fj.data.Either;
import java.util.Objects;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.model.Model;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.exception.OperationException;
import org.openecomp.sdc.be.resources.data.ModelData;
import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("model-operation")
public class ModelOperation extends AbstractOperation {

    private static final Logger log = Logger.getLogger(ModelOperation.class);

    private final JanusGraphGenericDao genericDao;

    @Autowired
    public ModelOperation(final JanusGraphGenericDao janusGraphGenericDao) {
        this.genericDao = janusGraphGenericDao;
    }

    public Model createModel(final Model model, final boolean inTransaction) {
        Model result = null;
        final ModelData modelData = new ModelData(model.getName(), UniqueIdBuilder.buildModelUid(model.getName()));
        try {
            final Either<ModelData, JanusGraphOperationStatus> createNode = genericDao.createNode(modelData, ModelData.class);
            if (createNode.isRight()) {
                final JanusGraphOperationStatus janusGraphOperationStatus = createNode.right().value();
                log.error(EcompLoggerErrorCode.DATA_ERROR, ModelOperation.class.getName(), "Problem while creating model, reason {}",
                    janusGraphOperationStatus);
                if (janusGraphOperationStatus == JanusGraphOperationStatus.JANUSGRAPH_SCHEMA_VIOLATION) {
                    throw new OperationException(ActionStatus.MODEL_ALREADY_EXISTS, model.getName());
                }
                throw new OperationException(ActionStatus.GENERAL_ERROR,
                    String.format("Failed to create model %s on JanusGraph with %s error", model, janusGraphOperationStatus));
            }
            result = new Model(createNode.left().value().getName());
            return result;
        } finally {
            if (!inTransaction) {
                if (Objects.nonNull(result)) {
                    genericDao.commit();
                } else {
                    genericDao.rollback();
                }
            }
        }
    }

}


<file_sep>/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/CsarSecurityValidatorTest.java
/*
 * ============LICENSE_START=======================================================
 *  Copyright (C) 2019 Nordix Foundation
 *  ================================================================================
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *  SPDX-License-Identifier: Apache-2.0
 *  ============LICENSE_END=========================================================
 */

package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;

import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding.OnboardingPackageProcessor;
import org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding.validation.CnfPackageValidator;
import org.openecomp.sdc.vendorsoftwareproduct.security.SecurityManager;
import org.openecomp.sdc.vendorsoftwareproduct.security.SecurityManagerException;
import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardPackageInfo;
import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardSignedPackage;

public class CsarSecurityValidatorTest {

    private static final String BASE_DIR = "/vspmanager.csar/";
    private CsarSecurityValidator csarSecurityValidator;
    @Mock
    SecurityManager securityManager;

    @Before
    public void setUp() {
        initMocks(this);
        csarSecurityValidator = new CsarSecurityValidator(securityManager);
    }

    @Test
    public void isSignatureValidTestCorrectStructureAndValidSignatureExists() throws SecurityManagerException {
        final byte[] packageBytes = getFileBytesOrFail("signing/signed-package.zip");
        final OnboardSignedPackage onboardSignedPackage = loadSignedPackage("signed-package.zip",
            packageBytes, null);
        when(securityManager.verifySignedData(any(), any(), any())).thenReturn(true);
        final boolean isSignatureValid = csarSecurityValidator.verifyPackageSignature(onboardSignedPackage);
        assertThat("Signature should be valid", isSignatureValid, is(true));
    }

    @Test(expected = SecurityManagerException.class)
    public void isSignatureValidTestCorrectStructureAndNotValidSignatureExists() throws SecurityManagerException {
        final byte[] packageBytes = getFileBytesOrFail("signing/signed-package-tampered-data.zip");
        final OnboardSignedPackage onboardSignedPackage = loadSignedPackage("signed-package-tampered-data.zip",
            packageBytes, null);
        //no mocked securityManager
        csarSecurityValidator = new CsarSecurityValidator();
        csarSecurityValidator.verifyPackageSignature(onboardSignedPackage);
    }

    private byte[] getFileBytesOrFail(final String path) {
        try {
            return getFileBytes(path);
        } catch (final URISyntaxException | IOException e) {
            fail("Could not load file " + path);
            return null;
        }
    }

    private byte[] getFileBytes(final String path) throws URISyntaxException, IOException {
        return Files.readAllBytes(Paths.get(
            CsarSecurityValidatorTest.class.getResource(BASE_DIR + path).toURI()));
    }

    private OnboardSignedPackage loadSignedPackage(final String packageName, final byte[] packageBytes,
        CnfPackageValidator cnfPackageValidator) {
        final OnboardingPackageProcessor onboardingPackageProcessor =
            new OnboardingPackageProcessor(packageName, packageBytes, cnfPackageValidator);
        final OnboardPackageInfo onboardPackageInfo = onboardingPackageProcessor.getOnboardPackageInfo().orElse(null);
        if (onboardPackageInfo == null) {
            fail("Unexpected error. Could not load original package");
        }

        return (OnboardSignedPackage) onboardPackageInfo.getOriginalOnboardPackage();
    }
}
<file_sep>/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspValidationPage.java
/**
 * Copyright (c) 2019 Vodafone Group
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.onap.sdc.frontend.ci.tests.pages;

import com.aventstack.extentreports.Status;
import org.apache.commons.collections.CollectionUtils;
import org.onap.sdc.frontend.ci.tests.datatypes.DataTestIdEnum;
import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest;
import org.onap.sdc.frontend.ci.tests.utilities.GeneralUIUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;

import java.io.File;
import java.util.List;

public class VspValidationPage extends GeneralPageElements {

    private VspValidationPage() {
        super();
    }

    public static void navigateToVspValidationPageUsingNavbar() throws Exception {
        clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_NAVBAR);
    }

    public static void navigateToVspValidationPageUsingBreadcrumbs() throws Exception {
        clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_BREADCRUMBS);
    }

    public static void clickOnNextButton() throws Exception {
        clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_PROCEED_TO_INPUTS_BUTTON);
    }

    public static void clickOnBackButton() throws Exception {
        clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_PROCEED_TO_SETUP_BUTTON);
    }

    public static void clickOnSubmitButton() throws Exception {
        clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_PROCEED_TO_RESULTS_BUTTON);
    }

    public static void loadVSPFile(String path, String filename) {
        List<WebElement> checkboxes =
                GeneralUIUtils.findElementsByXpath("//div[@class='validation-input-wrapper']//input");
        boolean hasValue = CollectionUtils.isNotEmpty(checkboxes);
        if (hasValue) {
            WebElement browseWebElement = checkboxes.get(0);
            browseWebElement.sendKeys(path + File.separator + filename);
            GeneralUIUtils.ultimateWait();
        } else {
            Assert.fail("Did not find File input field in the page for loading VSP test file");
        }

    }
    public static boolean checkNextButtonDisabled() throws Exception {
        return GeneralUIUtils.isElementDisabled(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_PROCEED_TO_INPUTS_BUTTON.getValue());
    }

    public static void clickCertificationQueryAll() throws Exception {
        List<WebElement> checkboxes = GeneralUIUtils.findElementsByXpath("//div[@data-test-id='vsp-validation-certifications-query-checkbox-tree']//label//span[@class='rct-checkbox']");
        if (!checkboxes.isEmpty()) {
            checkboxes.get(0).click();
        } else {
            Assert.fail("Did not find certification test checkbox in the page");
        }
    }

    public static void clickComplianceChecksAll() throws Exception {
        List<WebElement> vnfComplianceCheckboxes = GeneralUIUtils.findElementsByXpath("//div[@data-test-id='vsp-validation-compliance-checks-checkbox-tree']//span[@class='rct-text' and .//label//text()='vnf-compliance']//button");
        if (!vnfComplianceCheckboxes.isEmpty()) {
            vnfComplianceCheckboxes.get(vnfComplianceCheckboxes.size() - 1).click();
        } else {
            Assert.fail("Did not find vnf-compliance test checkbox in the page");
        }
        List<WebElement> checkboxes = GeneralUIUtils.findElementsByXpath("//div[@data-test-id='vsp-validation-compliance-checks-checkbox-tree']//label//span[@class='rct-title' and text()='csar-validate']");
        if (!checkboxes.isEmpty()) {
            checkboxes.get(checkboxes.size() - 1).click();
        } else {
            Assert.fail("Did not find csar-validate test Checkbox in the page");
        }
    }

    public static boolean checkCertificationQueryExists() throws Exception {
        WebElement parentDiv = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_CERTIFICATION_CHECKBOX_TREE.getValue());
        List<WebElement> checkboxTreeDivs = getChildElements(parentDiv);
        List<WebElement> orderedList = getChildElements(checkboxTreeDivs.get(0));
        return (!orderedList.isEmpty());
    }

    public static boolean checkComplianceCheckExists() throws Exception {
        WebElement parentDiv = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_COMPLIANCE_CHECKBOX_TREE.getValue());
        List<WebElement> checkboxTreeDivs = getChildElements(parentDiv);
        List<WebElement> orderedList = getChildElements(checkboxTreeDivs.get(0));
        return (!orderedList.isEmpty());
    }

    public static boolean checkSelectedComplianceCheckExists() throws Exception {
        WebElement selectedTests = GeneralUIUtils.findElementsByXpath("//div[contains(text(),'Selected Compliance Tests')]/..//select[@class='validation-setup-selected-tests']").get(0);
        List<WebElement> options = getChildElements(selectedTests);
        return (!options.isEmpty());
    }

    public static boolean checkSelectedCertificationQueryExists() throws Exception {
        WebElement selectedTests = GeneralUIUtils.findElementsByXpath("//div[contains(text(),'Selected Certifications Query')]/..//select[@class='validation-setup-selected-tests']").get(0);
        List<WebElement> options = getChildElements(selectedTests);
        return (!options.isEmpty());
    }

    public static void clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage elementTestId) throws Exception {
        SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", elementTestId.name()));
        GeneralUIUtils.getWebElementByTestID(elementTestId.getValue()).click();
        GeneralUIUtils.ultimateWait();
    }

    private static List<WebElement> getChildElements(WebElement webElement) throws Exception {
        return webElement.findElements(By.xpath(".//*"));
    }


}
<file_sep>/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java
/*-
 * ============LICENSE_START=======================================================
 * SDC
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.openecomp.sdc.be.model.operations.impl;

import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openecomp.sdc.be.dao.impl.HealingPipelineDao;
import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyRule;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
import org.openecomp.sdc.be.model.tosca.ToscaType;
import org.openecomp.sdc.be.model.tosca.constraints.GreaterThanConstraint;
import org.openecomp.sdc.be.model.tosca.constraints.InRangeConstraint;
import org.openecomp.sdc.be.model.tosca.constraints.LessOrEqualConstraint;
import org.openecomp.sdc.be.resources.data.DataTypeData;
import org.openecomp.sdc.be.resources.data.PropertyData;
import org.openecomp.sdc.be.resources.data.PropertyValueData;

import java.util.*;

import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;

public class PropertyOperationTest extends ModelTestBase {

    HealingJanusGraphGenericDao janusGraphGenericDao = mock(HealingJanusGraphGenericDao.class);

    PropertyOperation propertyOperation = new PropertyOperation(janusGraphGenericDao, null);

    @Before
    public void setup() {
        propertyOperation.setJanusGraphGenericDao(janusGraphGenericDao);

    }

    private PropertyDefinition buildPropertyDefinition() {
        PropertyDefinition property = new PropertyDefinition();
        property.setDefaultValue("10");
        property.setDescription("Size of the local disk, in Gigabytes (GB), available to applications running on the Compute node.");
        property.setType(ToscaType.INTEGER.name().toLowerCase());
        return property;
    }

    @Test
    public void convertConstraintsTest() {

        List<PropertyConstraint> constraints = buildConstraints();
        List<String> convertedStringConstraints = propertyOperation.convertConstraintsToString(constraints);
        assertEquals("constraints size", constraints.size(), convertedStringConstraints.size());

        List<PropertyConstraint> convertedConstraints = propertyOperation.convertConstraints(convertedStringConstraints);
        assertEquals("check size of constraints", constraints.size(), convertedConstraints.size());

        Set<String> constraintsClasses = new HashSet<>();
        for (PropertyConstraint propertyConstraint : constraints) {
            constraintsClasses.add(propertyConstraint.getClass().getName());
        }

        for (PropertyConstraint propertyConstraint : convertedConstraints) {
            assertTrue("check all classes generated", constraintsClasses.contains(propertyConstraint.getClass().getName()));
        }
    }

    @Test
    public void testIsPropertyDefaultValueValid_NoDefault() {
        PropertyDefinition property = new PropertyDefinition();
        property.setName("myProperty");
        property.setType(ToscaPropertyType.BOOLEAN.getType());
        assertTrue(propertyOperation.isPropertyDefaultValueValid(property, null));
    }

    @Test
    public void testIsPropertyDefaultValueValid_ValidDefault() {
        PropertyDefinition property = new PropertyDefinition();
        property.setName("myProperty");
        property.setType(ToscaPropertyType.INTEGER.getType());
        property.setDefaultValue("50");
        assertTrue(propertyOperation.isPropertyDefaultValueValid(property, null));
    }

    @Test
    public void testIsPropertyDefaultValueValid_InvalidDefault() {
        PropertyDefinition property = new PropertyDefinition();
        property.setName("myProperty");
        property.setType(ToscaPropertyType.BOOLEAN.getType());
        property.setDefaultValue("50");
        assertFalse(propertyOperation.isPropertyDefaultValueValid(property, null));
    }

    private List<PropertyConstraint> buildConstraints() {
        List<PropertyConstraint> constraints = new ArrayList<>();
        GreaterThanConstraint propertyConstraint1 = new GreaterThanConstraint("0");
        LessOrEqualConstraint propertyConstraint2 = new LessOrEqualConstraint("10");
        List<String> range = new ArrayList<>();
        range.add("0");
        range.add("100");
        InRangeConstraint propertyConstraint3 = new InRangeConstraint(range);
        constraints.add(propertyConstraint1);
        constraints.add(propertyConstraint2);
        constraints.add(propertyConstraint3);
        return constraints;
    }

    @Test
    public void findPropertyValueBestMatch1() {

        String propertyUniqueId = "x1";
        ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
        instanceProperty.setValue("v1");
        instanceProperty.setDefaultValue("vv1");
        List<String> path = new ArrayList<>();
        path.add("node1");
        path.add("node2");
        path.add("node3");
        instanceProperty.setPath(path);

        Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
        ComponentInstanceProperty instanceProperty1 = new ComponentInstanceProperty();
        instanceProperty1.setValue("v1node1");
        instanceIdToValue.put("node1", instanceProperty1);

        ComponentInstanceProperty instanceProperty2 = new ComponentInstanceProperty();
        instanceProperty2.setValue("v1node2");
        instanceIdToValue.put("node2", instanceProperty2);

        ComponentInstanceProperty instanceProperty3 = new ComponentInstanceProperty();
        instanceProperty3.setValue("v1node3");
        instanceIdToValue.put("node3", instanceProperty3);

        propertyOperation.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);

        assertEquals("check value", "v1node1", instanceProperty.getValue());
        assertEquals("check default value", "v1node2", instanceProperty.getDefaultValue());

    }

    @Test
    public void findPropertyValueBestMatch2() {

        String propertyUniqueId = "x1";
        ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
        instanceProperty.setValue("v1");
        instanceProperty.setDefaultValue("vv1");
        List<String> path = new ArrayList<>();
        path.add("node1");
        path.add("node2");
        path.add("node3");
        instanceProperty.setPath(path);

        Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();

        ComponentInstanceProperty instanceProperty2 = new ComponentInstanceProperty();
        instanceProperty2.setValue("v1node2");
        instanceProperty2.setValueUniqueUid("aaaa");
        instanceIdToValue.put("node2", instanceProperty2);

        propertyOperation.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);

        assertEquals("check value", "v1node2", instanceProperty.getValue());
        assertEquals("check default value", "vv1", instanceProperty.getDefaultValue());
        assertNull("check value unique id is null", instanceProperty.getValueUniqueUid());

    }

    @Test
    public void findPropertyValueBestMatch3() {

        String propertyUniqueId = "x1";
        ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
        instanceProperty.setValue("v1");
        instanceProperty.setDefaultValue("vv1");
        List<String> path = new ArrayList<>();
        path.add("node1");
        path.add("node2");
        path.add("node3");
        instanceProperty.setPath(path);

        Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
        ComponentInstanceProperty instanceProperty1 = new ComponentInstanceProperty();
        instanceProperty1.setValue("v1node1");
        instanceProperty1.setValueUniqueUid("aaaa");
        instanceIdToValue.put("node1", instanceProperty1);

        ComponentInstanceProperty instanceProperty3 = new ComponentInstanceProperty();
        instanceProperty3.setValue("v1node3");
        instanceIdToValue.put("node3", instanceProperty3);

        propertyOperation.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);

        assertEquals("check value", "v1node1", instanceProperty.getValue());
        assertEquals("check default value", "v1node3", instanceProperty.getDefaultValue());
        assertEquals("check valid unique id", instanceProperty1.getValueUniqueUid(), instanceProperty.getValueUniqueUid());

    }

    @Test
    public void findPropertyValueBestMatch1Rules() {

        String propertyUniqueId = "x1";
        ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
        instanceProperty.setValue("v1");
        instanceProperty.setDefaultValue("vv1");
        List<String> path = new ArrayList<>();
        path.add("node1");
        path.add("node2");
        path.add("node3");
        instanceProperty.setPath(path);

        Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
        ComponentInstanceProperty instanceProperty1 = new ComponentInstanceProperty();
        instanceProperty1.setValue("v1node1");

        List<PropertyRule> rules = new ArrayList<>();
        PropertyRule propertyRule = new PropertyRule();
        String[] ruleArr = { "node1", ".+", "node3" };
        List<String> rule1 = new ArrayList<>(Arrays.asList(ruleArr));
        propertyRule.setRule(rule1);
        propertyRule.setValue("88");
        rules.add(propertyRule);
        instanceProperty1.setRules(rules);

        instanceIdToValue.put("node1", instanceProperty1);

        ComponentInstanceProperty instanceProperty2 = new ComponentInstanceProperty();
        instanceProperty2.setValue("v1node2");
        instanceIdToValue.put("node2", instanceProperty2);

        ComponentInstanceProperty instanceProperty3 = new ComponentInstanceProperty();
        instanceProperty3.setValue("v1node3");
        instanceIdToValue.put("node3", instanceProperty3);

        propertyOperation.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);

        assertEquals("check value", propertyRule.getValue(), instanceProperty.getValue());
        assertEquals("check default value", "v1node2", instanceProperty.getDefaultValue());

    }

    @Test
    public void findPropertyValueBestMatch2Rules() {

        String propertyUniqueId = "x1";
        ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
        instanceProperty.setValue("v1");
        instanceProperty.setDefaultValue("vv1");
        List<String> path = new ArrayList<>();
        path.add("node1");
        path.add("node2");
        path.add("node3");
        instanceProperty.setPath(path);

        Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
        ComponentInstanceProperty instanceProperty1 = new ComponentInstanceProperty();
        instanceProperty1.setValue("v1node1");

        List<PropertyRule> rules = new ArrayList<>();
        PropertyRule propertyRule1 = new PropertyRule();
        String[] ruleArr1 = { "node1", "node2", ".+" };
        List<String> rule1 = new ArrayList<>(Arrays.asList(ruleArr1));
        propertyRule1.setRule(rule1);
        propertyRule1.setValue("88");

        PropertyRule propertyRule2 = new PropertyRule();
        String[] ruleArr2 = { "node1", "node2", "node3" };
        List<String> rule2 = new ArrayList<>(Arrays.asList(ruleArr2));
        propertyRule2.setRule(rule2);
        propertyRule2.setValue("99");

        rules.add(propertyRule2);
        rules.add(propertyRule1);

        instanceProperty1.setRules(rules);

        instanceIdToValue.put("node1", instanceProperty1);

        ComponentInstanceProperty instanceProperty2 = new ComponentInstanceProperty();
        instanceProperty2.setValue("v1node2");
        instanceIdToValue.put("node2", instanceProperty2);

        ComponentInstanceProperty instanceProperty3 = new ComponentInstanceProperty();
        instanceProperty3.setValue("v1node3");
        instanceIdToValue.put("node3", instanceProperty3);

        propertyOperation.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);

        assertEquals("check value", propertyRule2.getValue(), instanceProperty.getValue());
        assertEquals("check default value", "v1node2", instanceProperty.getDefaultValue());

    }

    @Test
    public void findPropertyValueBestMatch1RuleLowLevel() {

        String propertyUniqueId = "x1";
        ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
        instanceProperty.setValue("v1");
        instanceProperty.setDefaultValue("vv1");
        List<String> path = new ArrayList<>();
        path.add("node1");
        path.add("node2");
        path.add("node3");
        instanceProperty.setPath(path);

        Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
        ComponentInstanceProperty instanceProperty1 = new ComponentInstanceProperty();
        instanceProperty1.setValue("v1node1");

        List<PropertyRule> rules = new ArrayList<>();
        PropertyRule propertyRule1 = new PropertyRule();
        String[] ruleArr1 = { "node1", "node2", ".+" };
        List<String> rule1 = new ArrayList<>(Arrays.asList(ruleArr1));
        propertyRule1.setRule(rule1);
        propertyRule1.setValue("88");

        PropertyRule propertyRule2 = new PropertyRule();
        String[] ruleArr2 = { "node1", "node2", "node3" };
        List<String> rule2 = new ArrayList<>(Arrays.asList(ruleArr2));
        propertyRule2.setRule(rule2);
        propertyRule2.setValue("99");

        rules.add(propertyRule2);
        rules.add(propertyRule1);

        instanceProperty1.setRules(rules);

        instanceIdToValue.put("node1", instanceProperty1);

        ComponentInstanceProperty instanceProperty2 = new ComponentInstanceProperty();
        instanceProperty2.setValue("v1node2");

        List<PropertyRule> rules3 = new ArrayList<>();
        PropertyRule propertyRule3 = new PropertyRule();
        String[] ruleArr3 = { "node2", "node3" };
        List<String> rule3 = new ArrayList<>(Arrays.asList(ruleArr3));
        propertyRule3.setRule(rule3);
        propertyRule3.setValue("77");
        rules3.add(propertyRule3);

        instanceProperty2.setRules(rules3);
        instanceIdToValue.put("node2", instanceProperty2);

        ComponentInstanceProperty instanceProperty3 = new ComponentInstanceProperty();
        instanceProperty3.setValue("v1node3");
        instanceIdToValue.put("node3", instanceProperty3);

        propertyOperation.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);

        assertEquals("check value", propertyRule2.getValue(), instanceProperty.getValue());
        assertEquals("check default value", propertyRule3.getValue(), instanceProperty.getDefaultValue());

    }

    @Test
    public void findPropertyValueBestMatchDefaultValueNotChanged() {

        String propertyUniqueId = "x1";
        ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
        instanceProperty.setValue("v1");
        instanceProperty.setDefaultValue("vv1");
        List<String> path = new ArrayList<>();
        path.add("node1");
        path.add("node2");
        path.add("node3");
        instanceProperty.setPath(path);

        Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
        ComponentInstanceProperty instanceProperty1 = new ComponentInstanceProperty();
        instanceProperty1.setValue("v1node1");

        List<PropertyRule> rules = new ArrayList<>();
        PropertyRule propertyRule1 = new PropertyRule();
        String[] ruleArr1 = { "node1", "node2", ".+" };
        List<String> rule1 = new ArrayList<>(Arrays.asList(ruleArr1));
        propertyRule1.setRule(rule1);
        propertyRule1.setValue("88");

        PropertyRule propertyRule2 = new PropertyRule();
        String[] ruleArr2 = { "node1", "node2", "node3" };
        List<String> rule2 = new ArrayList<>(Arrays.asList(ruleArr2));
        propertyRule2.setRule(rule2);
        propertyRule2.setValue("99");

        rules.add(propertyRule2);
        rules.add(propertyRule1);

        instanceProperty1.setRules(rules);

        instanceIdToValue.put("node1", instanceProperty1);

        ComponentInstanceProperty instanceProperty2 = new ComponentInstanceProperty();
        instanceProperty2.setValue("v1node2");

        List<PropertyRule> rules3 = new ArrayList<>();
        PropertyRule propertyRule3 = new PropertyRule();
        String[] ruleArr3 = { "node2", "node333" };
        List<String> rule3 = new ArrayList<>(Arrays.asList(ruleArr3));
        propertyRule3.setRule(rule3);
        propertyRule3.setValue("77");
        rules3.add(propertyRule3);

        instanceProperty2.setRules(rules3);
        instanceIdToValue.put("node2", instanceProperty2);

        propertyOperation.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);

        assertEquals("check value", propertyRule2.getValue(), instanceProperty.getValue());
        assertEquals("check default value", "vv1", instanceProperty.getDefaultValue());

	}

	private PropertyOperation createTestSubject() {
		return new PropertyOperation(new HealingJanusGraphGenericDao(new JanusGraphClient()), null);
	}

	@Test
	public void testConvertPropertyDataToPropertyDefinition() throws Exception {
		PropertyOperation testSubject;
		PropertyData propertyDataResult = new PropertyData();
		String propertyName = "";
		String resourceId = "";
		PropertyDefinition result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.convertPropertyDataToPropertyDefinition(propertyDataResult, propertyName, resourceId);
	}
	
	@Test
	public void testAddProperty() throws Exception {
		PropertyOperation testSubject;
		String propertyName = "";
		PropertyDefinition propertyDefinition = new PropertyDefinition();
		String resourceId = "";
		Either<PropertyData, StorageOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.addProperty(propertyName, propertyDefinition, resourceId);
	}

	
	@Test
	public void testValidateAndUpdateProperty() throws Exception {
		PropertyOperation testSubject;
		IComplexDefaultValue propertyDefinition = new PropertyDefinition();
		Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
		dataTypes.put("", new DataTypeDefinition());
		StorageOperationStatus result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.validateAndUpdateProperty(propertyDefinition, dataTypes);
	}

	
	@Test
	public void testAddPropertyToGraph() throws Exception {
		PropertyOperation testSubject;
		String propertyName = "";
		PropertyDefinition propertyDefinition = new PropertyDefinition();
		String resourceId = "";
		Either<PropertyData, JanusGraphOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.addPropertyToGraph(propertyName, propertyDefinition, resourceId);
	}

	
	@Test
	public void testAddPropertyToGraphByVertex() throws Exception {
		PropertyOperation testSubject;
		JanusGraphVertex metadataVertex = null;
		String propertyName = "";
		PropertyDefinition propertyDefinition = new PropertyDefinition();
		String resourceId = "";
		JanusGraphOperationStatus result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.addPropertyToGraphByVertex(metadataVertex, propertyName, propertyDefinition, resourceId);
	}

	
	@Test
	public void testGetJanusGraphGenericDao() throws Exception {
		PropertyOperation testSubject;
		JanusGraphGenericDao result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.getJanusGraphGenericDao();
	}

	@Test
	public void testDeletePropertyFromGraph() throws Exception {
		PropertyOperation testSubject;
		String propertyId = "";
		Either<PropertyData, JanusGraphOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.deletePropertyFromGraph(propertyId);
	}

	
	@Test
	public void testUpdateProperty() throws Exception {
		PropertyOperation testSubject;
		String propertyId = "";
		PropertyDefinition newPropertyDefinition = new PropertyDefinition();
		Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
		Either<PropertyData, StorageOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.updateProperty(propertyId, newPropertyDefinition, dataTypes);
	}

	
	@Test
	public void testUpdatePropertyFromGraph() throws Exception {
		PropertyOperation testSubject;
		String propertyId = "";
		PropertyDefinition propertyDefinition = null;
		Either<PropertyData, JanusGraphOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.updatePropertyFromGraph(propertyId, propertyDefinition);
	}


	@Test
	public void testSetJanusGraphGenericDao()  {

		PropertyOperation testSubject;
        HealingJanusGraphGenericDao janusGraphGenericDao = null;

		// default test
		testSubject = createTestSubject();
		testSubject.setJanusGraphGenericDao(janusGraphGenericDao);
	}

	
	@Test
	public void testAddPropertyToNodeType()  {
		PropertyOperation testSubject;
		String propertyName = "";
		PropertyDefinition propertyDefinition = new PropertyDefinition();
		NodeTypeEnum nodeType = NodeTypeEnum.Attribute;
		String uniqueId = "";
		Either<PropertyData, JanusGraphOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.addPropertyToNodeType(propertyName, propertyDefinition, nodeType, uniqueId);
	}

	
	@Test
	public void testFindPropertiesOfNode() throws Exception {
		PropertyOperation testSubject;
		NodeTypeEnum nodeType = null;
		String uniqueId = "";
		Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.findPropertiesOfNode(nodeType, uniqueId);
	}

	
	@Test
	public void testDeletePropertiesAssociatedToNode() throws Exception {
		PropertyOperation testSubject;
		NodeTypeEnum nodeType = null;
		String uniqueId = "";
		Either<Map<String, PropertyDefinition>, StorageOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.deletePropertiesAssociatedToNode(nodeType, uniqueId);
	}

	
	@Test
	public void testDeleteAllPropertiesAssociatedToNode() throws Exception {
		PropertyOperation testSubject;
		NodeTypeEnum nodeType = null;
		String uniqueId = "";
		Either<Map<String, PropertyDefinition>, StorageOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.deleteAllPropertiesAssociatedToNode(nodeType, uniqueId);
	}

	
	@Test
	public void testIsPropertyExist() throws Exception {
		PropertyOperation testSubject;
		List<PropertyDefinition> properties = null;
		String resourceUid = "";
		String propertyName = "";
		String propertyType = "";
		boolean result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.isPropertyExist(properties, resourceUid, propertyName, propertyType);
	}

	
	@Test
	public void testValidateAndUpdateRules() throws Exception {
		PropertyOperation testSubject;
		String propertyType = "";
		List<PropertyRule> rules = null;
		String innerType = "";
		Map<String, DataTypeDefinition> dataTypes = null;
		boolean isValidate = false;
		ImmutablePair<String, Boolean> result;

		// test 1
		testSubject = createTestSubject();
		rules = null;
		result = testSubject.validateAndUpdateRules(propertyType, rules, innerType, dataTypes, isValidate);
	}

	
	@Test
	public void testAddRulesToNewPropertyValue() throws Exception {
		PropertyOperation testSubject;
		PropertyValueData propertyValueData = new PropertyValueData();
		ComponentInstanceProperty resourceInstanceProperty = new ComponentInstanceProperty();
		String resourceInstanceId = "";

		// default test
		testSubject = createTestSubject();
		testSubject.addRulesToNewPropertyValue(propertyValueData, resourceInstanceProperty, resourceInstanceId);
	}

	
	@Test
	public void testFindPropertyValue() throws Exception {
		PropertyOperation testSubject;
		String resourceInstanceId = "";
		String propertyId = "";
		ImmutablePair<JanusGraphOperationStatus, String> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.findPropertyValue(resourceInstanceId, propertyId);
	}

	
	@Test
	public void testUpdateRulesInPropertyValue() throws Exception {
		PropertyOperation testSubject;
		PropertyValueData propertyValueData = new PropertyValueData();
		ComponentInstanceProperty resourceInstanceProperty = new ComponentInstanceProperty();
		String resourceInstanceId = "";

		// default test
		testSubject = createTestSubject();
		testSubject.updateRulesInPropertyValue(propertyValueData, resourceInstanceProperty, resourceInstanceId);
	}

	
	@Test
	public void testGetAllPropertiesOfResourceInstanceOnlyPropertyDefId() throws Exception {
		PropertyOperation testSubject;
		String resourceInstanceUid = "";
		Either<List<ComponentInstanceProperty>, JanusGraphOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.getAllPropertiesOfResourceInstanceOnlyPropertyDefId(resourceInstanceUid);
	}

	
	@Test
	public void testRemovePropertyOfResourceInstance() throws Exception {
		PropertyOperation testSubject;
		String propertyValueUid = "";
		String resourceInstanceId = "";
		Either<PropertyValueData, JanusGraphOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.removePropertyOfResourceInstance(propertyValueUid, resourceInstanceId);
	}

	
	@Test
	public void testRemovePropertyValueFromResourceInstance() throws Exception {
		PropertyOperation testSubject;
		String propertyValueUid = "";
		String resourceInstanceId = "";
		boolean inTransaction = false;
		Either<ComponentInstanceProperty, StorageOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.removePropertyValueFromResourceInstance(propertyValueUid, resourceInstanceId,
				inTransaction);
	}

	
	@Test
	public void testBuildResourceInstanceProperty() throws Exception {
		PropertyOperation testSubject;
		PropertyValueData propertyValueData = new PropertyValueData();
		ComponentInstanceProperty resourceInstanceProperty = new ComponentInstanceProperty();
		ComponentInstanceProperty result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.buildResourceInstanceProperty(propertyValueData, resourceInstanceProperty);
	}

	
	@Test
	public void testIsPropertyDefaultValueValid() throws Exception {
		PropertyOperation testSubject;
		IComplexDefaultValue propertyDefinition = null;
		Map<String, DataTypeDefinition> dataTypes = null;
		boolean result;

		// test 1
		testSubject = createTestSubject();
		propertyDefinition = null;
		result = testSubject.isPropertyDefaultValueValid(propertyDefinition, dataTypes);
		Assert.assertEquals(false, result);
	}

	
	@Test
	public void testIsPropertyTypeValid() throws Exception {
		PropertyOperation testSubject;
		IComplexDefaultValue property = null;
		boolean result;

		// test 1
		testSubject = createTestSubject();
		property = null;
		result = testSubject.isPropertyTypeValid(property);
		Assert.assertEquals(false, result);
	}

	
	@Test
	public void testIsPropertyInnerTypeValid() throws Exception {
		PropertyOperation testSubject;
		IComplexDefaultValue property = null;
		Map<String, DataTypeDefinition> dataTypes = null;
		ImmutablePair<String, Boolean> result;

		// test 1
		testSubject = createTestSubject();
		property = null;
		result = testSubject.isPropertyInnerTypeValid(property, dataTypes);
	}

	
	@Test
	public void testGetAllPropertiesOfResourceInstanceOnlyPropertyDefId_1() throws Exception {
		PropertyOperation testSubject;
		String resourceInstanceUid = "";
		NodeTypeEnum instanceNodeType = null;
		Either<List<ComponentInstanceProperty>, JanusGraphOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.getAllPropertiesOfResourceInstanceOnlyPropertyDefId(resourceInstanceUid, instanceNodeType);
	}

	
	@Test
	public void testFindDefaultValueFromSecondPosition() throws Exception {
		PropertyOperation testSubject;
		List<String> pathOfComponentInstances = null;
		String propertyUniqueId = "";
		String defaultValue = "";
		Either<String, JanusGraphOperationStatus> result;

		// test 1
		testSubject = createTestSubject();
		pathOfComponentInstances = null;
		result = testSubject.findDefaultValueFromSecondPosition(pathOfComponentInstances, propertyUniqueId,
				defaultValue);
	}

	
	@Test
	public void testUpdatePropertyByBestMatch() throws Exception {
		PropertyOperation testSubject;
		String propertyUniqueId = "";
		ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
		List<String> path = new ArrayList<>();
		path.add("path");
		instanceProperty.setPath(path);
		Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
		instanceIdToValue.put("123", instanceProperty);

		// default test
		testSubject = createTestSubject();
		testSubject.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);
	}

	
	@Test
	public void testGetDataTypeByUid() throws Exception {
		PropertyOperation testSubject;
		String uniqueId = "";
		Either<DataTypeDefinition, JanusGraphOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.getDataTypeByUid(uniqueId);
	}

	
	@Test
	public void testAddDataType() throws Exception {
		PropertyOperation testSubject;
		DataTypeDefinition dataTypeDefinition = new DataTypeDefinition();
		Either<DataTypeDefinition, StorageOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.addDataType(dataTypeDefinition);
	}

	
	@Test
	public void testGetDataTypeByName() throws Exception {
		PropertyOperation testSubject;
		String name = "";
		boolean inTransaction = false;
		Either<DataTypeDefinition, StorageOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.getDataTypeByName(name, inTransaction);
	}

	
	@Test
	public void testGetDataTypeByName_1() throws Exception {
		PropertyOperation testSubject;
		String name = "";
		Either<DataTypeDefinition, StorageOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.getDataTypeByName(name);
	}

	
	@Test
	public void testGetDataTypeByNameWithoutDerived() throws Exception {
		PropertyOperation testSubject;
		String name = "";
		Either<DataTypeDefinition, StorageOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.getDataTypeByNameWithoutDerived(name);
	}

	
	@Test
	public void testGetDataTypeByUidWithoutDerivedDataTypes() throws Exception {
		PropertyOperation testSubject;
		String uniqueId = "";
		Either<DataTypeDefinition, JanusGraphOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.getDataTypeByUidWithoutDerivedDataTypes(uniqueId);
	}

	
	@Test
	public void testIsDefinedInDataTypes() throws Exception {
		PropertyOperation testSubject;
		String propertyType = "";
		Either<Boolean, JanusGraphOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.isDefinedInDataTypes(propertyType);
	}

	
	@Test
	public void testGetAllDataTypes() throws Exception {
		PropertyOperation testSubject;
		Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.getAllDataTypes();
	}

	
	@Test
	public void testCheckInnerType() throws Exception {
		PropertyOperation testSubject;
		PropertyDataDefinition propDataDef = new PropertyDataDefinition();
		Either<String, JanusGraphOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.checkInnerType(propDataDef);
	}

	
	@Test
	public void testGetAllDataTypeNodes() throws Exception {
		PropertyOperation testSubject;
		Either<List<DataTypeData>, JanusGraphOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.getAllDataTypeNodes();
	}

	
	@Test
	public void testValidateAndUpdatePropertyValue() throws Exception {
		PropertyOperation testSubject;
		String propertyType = "";
		String value = "";
		boolean isValidate = false;
		String innerType = "";
		Map<String, DataTypeDefinition> dataTypes = null;
		Either<Object, Boolean> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.validateAndUpdatePropertyValue(propertyType, value, isValidate, innerType, dataTypes);
	}

	
	@Test
	public void testValidateAndUpdatePropertyValue_1() throws Exception {
		PropertyOperation testSubject;
		String propertyType = "";
		String value = "";
		String innerType = "";
		Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
		dataTypes.put("", new DataTypeDefinition());
		Either<Object, Boolean> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.validateAndUpdatePropertyValue(propertyType, value, innerType, dataTypes);
	}

	


	
	@Test
	public void testAddPropertiesToElementType() throws Exception {
		PropertyOperation testSubject;
		String uniqueId = "";
		NodeTypeEnum elementType = null;
		List<PropertyDefinition> properties = null;
		Either<Map<String, PropertyData>, JanusGraphOperationStatus> result;

		// test 1
		testSubject = createTestSubject();
		properties = null;
		result = testSubject.addPropertiesToElementType(uniqueId, elementType, properties);
	}

	
	@Test
	public void testUpdateDataType() throws Exception {
		PropertyOperation testSubject;
		DataTypeDefinition newDataTypeDefinition = new DataTypeDefinition();
		DataTypeDefinition oldDataTypeDefinition = new DataTypeDefinition();
		Either<DataTypeDefinition, StorageOperationStatus> result;

		// default test
		testSubject = createTestSubject();
		result = testSubject.updateDataType(newDataTypeDefinition, oldDataTypeDefinition);
	}
}
