blob: 64d1d7fad375132efaa561c67d38e0223140616c [file] [log] [blame]
/**
******************************************************************************
* Copyright © 2018 PTA GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*
******************************************************************************
*/
package org.eclipse.openk.mics.home.controller;
import org.eclipse.openk.mics.home.common.HttpStatusException;
import org.eclipse.openk.mics.home.communication.RestServiceWrapper;
import org.easymock.EasyMock;
import org.junit.Test;
import org.powermock.reflect.Whitebox;
import static org.easymock.EasyMock.anyString;
import static org.junit.Assert.assertEquals;
public class CentralProxyTest {
@Test
public void testAll() throws HttpStatusException {
RestServiceWrapper rsw = EasyMock.createMock(RestServiceWrapper.class);
EasyMock.expect(rsw.performGetRequest(anyString())).andReturn("fine").anyTimes();
EasyMock.replay(rsw);
EasyMock.verify(rsw);
CentralProxy cp = new CentralProxy("TEST_URL");
Whitebox.setInternalState(cp, "restServiceWrapper", rsw);
assertEquals( "fine", cp.getHealthState("/abs",
"https", "123.456.789.0", "4711"));
assertEquals( "fine", cp.getServerDistribution("klausDasCluster"));
}
}