// Path: src/main/java/org/jboss/elasticsearch/river/jira/IJiraRiverMgm.java
// public interface IJiraRiverMgm {
// 
// 	/**
// 	 * Stop jira river, but leave instance existing in {@link #riverInstances} so it can be found over management REST
// 	 * calls and/or reconfigured and started later again. Note that standard ES river {@link #close()} method
// 	 * implementation removes river instance from {@link #riverInstances}.
// 	 * 
// 	 * @param permanent set to true if info about river stopped can be persisted
// 	 */
// 	public abstract void stop(boolean permanent);
// 
// 	/**
// 	 * Restart jira river. Configuration of river is updated.
// 	 */
// 	public abstract void restart();
// 
// 	/**
// 	 * Force full index update for some project(s) in this jira river. Used for REST management operations handling.
// 	 * 
// 	 * @param jiraProjectKey optional key of project to reindex, if null or empty then all projects are forced to full
// 	 *          reindex
// 	 * @return CSV list of projects forced to reindex. <code>null</code> if project passed over
// 	 *         <code>jiraProjectKey</code> parameter was not found in this indexer
// 	 * @throws Exception
// 	 */
// 	public abstract String forceFullReindex(String jiraProjectKey) throws Exception;
// 
// 	/**
// 	 * Force incremental index update for some project(s) in this jira river. Used for REST management operations
// 	 * handling.
// 	 * 
// 	 * @param jiraProjectKey optional key of project to reindex, if null or empty then all projects are forced to reindex
// 	 * @return CSV list of projects forced to reindex. <code>null</code> if project passed over
// 	 *         <code>jiraProjectKey</code> parameter was not found in this indexer
// 	 * @throws Exception
// 	 */
// 	public abstract String forceIncrementalReindex(String jiraProjectKey) throws Exception;
// 
// 	/**
// 	 * Get info about current operation of this river. Used for REST management operations handling.
// 	 * 
// 	 * @return String with JSON formatted info.
// 	 * @throws Exception
// 	 */
// 	public abstract String getRiverOperationInfo(DiscoveryNode esNode, Date currentDate) throws Exception;
// 
// 	/**
// 	 * Get name of river.
// 	 * 
// 	 * @return name of jira river
// 	 */
// 	public abstract RiverName riverName();
// 
// }


import junit.framework.Assert;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.ClusterService;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.DummyTransportAddress;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.Transport;
import org.elasticsearch.transport.TransportService;
import org.jboss.elasticsearch.river.jira.IJiraRiverMgm;
import org.junit.Test;
import org.mockito.Mockito;
		{
			Mockito.when(river.forceIncrementalReindex("AAA")).thenReturn("AAA");
			IncrementalUpdateRequest req = new IncrementalUpdateRequest("myriver", "AAA");
			NodeIncrementalUpdateResponse resp = tested.performOperationOnJiraRiver(river, req, dn);
			Assert.assertNotNull(resp);
			Assert.assertTrue(resp.isRiverFound());
			Assert.assertEquals(dn, resp.getNode());
			Assert.assertEquals(true, resp.projectFound);
			Assert.assertEquals("AAA", resp.reindexedProjectNames);
			Mockito.verify(river).forceIncrementalReindex("AAA");
			Mockito.verifyNoMoreInteractions(river);
		}

		// case - project not found
		Mockito.reset(river);
		{
			Mockito.when(river.forceIncrementalReindex("AAA")).thenReturn(null);
			IncrementalUpdateRequest req = new IncrementalUpdateRequest("myriver", "AAA");
			NodeIncrementalUpdateResponse resp = tested.performOperationOnJiraRiver(river, req, dn);
			Assert.assertNotNull(resp);
			Assert.assertTrue(resp.isRiverFound());
			Assert.assertEquals(dn, resp.getNode());
			Assert.assertEquals(false, resp.projectFound);
			Assert.assertEquals(null, resp.reindexedProjectNames);
			Mockito.verify(river).forceIncrementalReindex("AAA");
			Mockito.verifyNoMoreInteractions(river);
		}

	}

// Path: src/main/java/org/jboss/elasticsearch/river/jira/IJiraRiverMgm.java
// public interface IJiraRiverMgm {
// 
// 	/**
// 	 * Stop jira river, but leave instance existing in {@link #riverInstances} so it can be found over management REST
// 	 * calls and/or reconfigured and started later again. Note that standard ES river {@link #close()} method
// 	 * implementation removes river instance from {@link #riverInstances}.
// 	 * 
// 	 * @param permanent set to true if info about river stopped can be persisted
// 	 */
// 	public abstract void stop(boolean permanent);
// 
// 	/**
// 	 * Restart jira river. Configuration of river is updated.
// 	 */
// 	public abstract void restart();
// 
// 	/**
// 	 * Force full index update for some project(s) in this jira river. Used for REST management operations handling.
// 	 * 
// 	 * @param jiraProjectKey optional key of project to reindex, if null or empty then all projects are forced to full
// 	 *          reindex
// 	 * @return CSV list of projects forced to reindex. <code>null</code> if project passed over
// 	 *         <code>jiraProjectKey</code> parameter was not found in this indexer
// 	 * @throws Exception
// 	 */
// 	public abstract String forceFullReindex(String jiraProjectKey) throws Exception;
// 
// 	/**
// 	 * Force incremental index update for some project(s) in this jira river. Used for REST management operations
// 	 * handling.
// 	 * 
// 	 * @param jiraProjectKey optional key of project to reindex, if null or empty then all projects are forced to reindex
// 	 * @return CSV list of projects forced to reindex. <code>null</code> if project passed over
// 	 *         <code>jiraProjectKey</code> parameter was not found in this indexer
// 	 * @throws Exception
// 	 */
// 	public abstract String forceIncrementalReindex(String jiraProjectKey) throws Exception;
// 
// 	/**
// 	 * Get info about current operation of this river. Used for REST management operations handling.
// 	 * 
// 	 * @return String with JSON formatted info.
// 	 * @throws Exception
// 	 */
// 	public abstract String getRiverOperationInfo(DiscoveryNode esNode, Date currentDate) throws Exception;
// 
// 	/**
// 	 * Get name of river.
// 	 * 
// 	 * @return name of jira river
// 	 */
// 	public abstract RiverName riverName();
// 
// }


// Path: src/test/java/org/jboss/elasticsearch/river/jira/mgm/incrementalupdate/TransportIncrementalUpdateActionTest.java
import junit.framework.Assert;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.ClusterService;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.DummyTransportAddress;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.Transport;
import org.elasticsearch.transport.TransportService;
import org.jboss.elasticsearch.river.jira.IJiraRiverMgm;
import org.junit.Test;
import org.mockito.Mockito;

		{
			Mockito.when(river.forceIncrementalReindex("AAA")).thenReturn("AAA");
			IncrementalUpdateRequest req = new IncrementalUpdateRequest("myriver", "AAA");
			NodeIncrementalUpdateResponse resp = tested.performOperationOnJiraRiver(river, req, dn);
			Assert.assertNotNull(resp);
			Assert.assertTrue(resp.isRiverFound());
			Assert.assertEquals(dn, resp.getNode());
			Assert.assertEquals(true, resp.projectFound);
			Assert.assertEquals("AAA", resp.reindexedProjectNames);
			Mockito.verify(river).forceIncrementalReindex("AAA");
			Mockito.verifyNoMoreInteractions(river);
		}

		// case - project not found
		Mockito.reset(river);
		{
			Mockito.when(river.forceIncrementalReindex("AAA")).thenReturn(null);
			IncrementalUpdateRequest req = new IncrementalUpdateRequest("myriver", "AAA");
			NodeIncrementalUpdateResponse resp = tested.performOperationOnJiraRiver(river, req, dn);
			Assert.assertNotNull(resp);
			Assert.assertTrue(resp.isRiverFound());
			Assert.assertEquals(dn, resp.getNode());
			Assert.assertEquals(false, resp.projectFound);
			Assert.assertEquals(null, resp.reindexedProjectNames);
			Mockito.verify(river).forceIncrementalReindex("AAA");
			Mockito.verifyNoMoreInteractions(river);
		}

	}

	private static DiscoveryNode dn = new DiscoveryNode("aa", DummyTransportAddress.INSTANCE, Version.CURRENT);