Package com.sequenceiq.cloudbreak.converter

Source Code of com.sequenceiq.cloudbreak.converter.MetaDataConverterTest

package com.sequenceiq.cloudbreak.converter;

import com.sequenceiq.cloudbreak.controller.json.InstanceMetaDataJson;
import com.sequenceiq.cloudbreak.domain.InstanceMetaData;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class MetaDataConverterTest {

    private MetaDataConverter underTest;

    private InstanceMetaData metaData;

    @Before
    public void setUp() {
        underTest = new MetaDataConverter();
        metaData = createMetaData();
    }

    @Test(expected = UnsupportedOperationException.class)
    public void testConvertMetaDataJsonToEntity() {
        // GIVEN
        // WHEN
        underTest.convert(new InstanceMetaDataJson());

    }

    @Test
    public void testConvertMetaDataEntityToJson() {
        // GIVEN
        // WHEN
        InstanceMetaDataJson result = underTest.convert(metaData);
        // THEN
        assertEquals(result.getAmbariServer(), metaData.getAmbariServer());
        assertEquals(result.getDockerSubnet(), metaData.getDockerSubnet());
        assertEquals(result.getInstanceId(), metaData.getInstanceId());
        assertEquals(result.getInstanceIndex(), metaData.getInstanceIndex());
        assertEquals(result.getPrivateIp(), metaData.getPrivateIp());
        assertEquals(result.getPublicIp(), metaData.getPublicIp());

    }

    private InstanceMetaData createMetaData() {
        InstanceMetaData metaData = new InstanceMetaData();
        metaData.setAmbariServer(true);
        metaData.setDockerSubnet("dummyDockerSubnet");
        metaData.setId(1L);
        metaData.setInstanceId("dummyInstanceId");
        metaData.setInstanceIndex(1);
        metaData.setPrivateIp("dummyPrivateIp");
        metaData.setPublicIp("dummyPublicIp");
        return metaData;
    }
}
TOP

Related Classes of com.sequenceiq.cloudbreak.converter.MetaDataConverterTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.