/***************************************************************************
 * Copyright 2015 Kieker Project (http://kieker-monitoring.net)
 *
 * 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 kieker.monitoring.writer.influxdb;

import org.junit.Test;

import kieker.common.configuration.Configuration;
import kieker.common.record.controlflow.OperationExecutionRecord;

/**
 * @author tp
 *
 * @since 1.13
 */
public class InfluxDBWriterFailingTest {

	public InfluxDBWriterFailingTest() {
		super();
	}

	/**
	 * Test method for {@link kieker.monitoring.writer.influxdb.InfluxDBWriter#connectToInfluxDB()}.
	 */
	@Test(expected = RuntimeException.class)
	public void testConnectToInfluxDB() {
		final Configuration configuration = new Configuration();
		configuration.setProperty(InfluxDBWriter.CONFIG_PROPERTY_DB_URL, "http://localhost");
		configuration.setProperty(InfluxDBWriter.CONFIG_PROPERTY_DB_PORT, "80");
		configuration.setProperty(InfluxDBWriter.CONFIG_PROPERTY_DB_USERNAME, "root");
		configuration.setProperty(InfluxDBWriter.CONFIG_PROPERTY_DB_PASSWORD, "root");
		configuration.setProperty(InfluxDBWriter.CONFIG_PROPERTY_DB_NAME, "kieker");
		final InfluxDBWriter influxDBWriter = new InfluxDBWriter(configuration);
		influxDBWriter.connectToInfluxDB();
	}

	/**
	 * Test method for {@link kieker.monitoring.writer.influxdb.InfluxDBWriter#writeMonitoringRecord(kieker.common.record.IMonitoringRecord)}.
	 */
	@Test(expected = RuntimeException.class)
	public void testWriteMonitoringRecord() {
		final Configuration configuration = new Configuration();
		configuration.setProperty(InfluxDBWriter.CONFIG_PROPERTY_DB_URL, "http://localhost");
		configuration.setProperty(InfluxDBWriter.CONFIG_PROPERTY_DB_PORT, "80");
		configuration.setProperty(InfluxDBWriter.CONFIG_PROPERTY_DB_USERNAME, "root");
		configuration.setProperty(InfluxDBWriter.CONFIG_PROPERTY_DB_PASSWORD, "root");
		configuration.setProperty(InfluxDBWriter.CONFIG_PROPERTY_DB_NAME, "kieker");
		final InfluxDBWriter influxDBWriter = new InfluxDBWriter(configuration);
		final OperationExecutionRecord operationExecutionRecord = new OperationExecutionRecord("signature", "sessionId", 1, 1, 2, "hostname", 1, 1);
		influxDBWriter.writeMonitoringRecord(operationExecutionRecord);
	}

}

Add test for InfluxDB failing
Add test for InfluxDB failing
