/**
 * 
 */
package com.boundary.sdk.event.snmp;

import static org.junit.Assert.*;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.ProducerTemplate;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


/**
 * @author davidg
 *
 */
public class SNMPGetTest extends CamelSpringTestSupport  {

	/**
	 * @throws java.lang.Exception
	 */
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	/**
	 * @throws java.lang.Exception
	 */
	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		super.setUp();
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
		super.tearDown();
	}
	
	@Test
	public void testSnmpGet() throws InterruptedException {
		MockEndpoint endPoint = getMockEndpoint("mock:snmp-poller-out");
		endPoint.await(30,TimeUnit.SECONDS);
		endPoint.setMinimumExpectedMessageCount(1);
		
		endPoint.assertIsSatisfied();
	}
	
	
	@Override
	protected AbstractApplicationContext createApplicationContext() {
		return new ClassPathXmlApplicationContext("META-INF/spring/snmp-get-test.xml");
	}

}

@@ -1,300 +1,667 @@
 /
-**%0A * %0A */%0Apackage com.boundary.sdk.event.snmp;%0A%0Aimport static org.junit.Assert.*;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.io.InputStreamReader;%0Aimport java.util.ArrayList
+/ Copyright 2014 Boundary, Inc.%0A//%0A// Licensed under the Apache License, Version 2.0 (the %22License%22);%0A// you may not use this file except in compliance with the License.%0A// You may obtain a copy of the License at%0A//%0A//     http://www.apache.org/licenses/LICENSE-2.0%0A//%0A// Unless required by applicable law or agreed to in writing, software%0A// distributed under the License is distributed on an %22AS IS%22 BASIS,%0A// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A// See the License for the specific language governing permissions and%0A// limitations under the License.%0Apackage com.boundary.sdk.event.snmp
 ;%0A
+%0A
 import 
-java.util.HashMap;
+static org.junit.Assert.*;%0A
 %0Aimp
@@ -684,30 +684,8 @@
 st;%0A
-import java.util.Map;%0A
 impo
@@ -719,16 +719,90 @@
 eUnit;%0A%0A
+import org.apache.camel.EndpointInject;%0Aimport org.apache.camel.Exchange;%0A
 import o
@@ -910,117 +910,8 @@
 rt;%0A
-import org.apache.camel.Exchange;%0Aimport org.apache.camel.Message;%0Aimport org.apache.camel.ProducerTemplate;%0A
 impo
@@ -1297,16 +1297,86 @@
 pport  %7B
+%0A%09%0A    @EndpointInject(uri = %22mock:out%22)%0A    private MockEndpoint out;
 %0A%0A%09/**%0A%09
@@ -1841,147 +1841,156 @@
 %0A%09%0A%09
-@Test%0A%09public void testSnmpGet() throws InterruptedException %7B%0A%09%09MockEndpoint endPoint = getMockEndpoint(%22mock:snmp-poller-out%22);%0A%09%09endPoin
+//TODO: Configure Mock SSH Server for testing%0A%09@Ignore (%22Need Mock SSH Server%22)%0A%09@Test%0A%09public void testSnmpGet() throws InterruptedException %7B%0A%09%09ou
 t.aw
@@ -2017,23 +2017,18 @@
 NDS);%0A%09%09
-endPoin
+ou
 t.setMin
@@ -2065,15 +2065,10 @@
 %09%0A%09%09
-endPoin
+ou
 t.as
@@ -2090,15 +2090,170 @@
 ();%0A
+%09%09List%3CExchange%3E exchanges = out.getExchanges();%0A%09%09for (Exchange exchange : exchanges) %7B%0A%09%09%09assertNotNull(%22Body is null%22,exchange.getIn().getBody());%0A%09%09%7D%0A%09%09%0A
 %09%7D%0A%09%0A
-%09%0A
 %09@Ov
@@ -2411,11 +2411,10 @@
 l%22);%0A%09%7D%0A
-%0A
 %7D%0A

Refactor test and then Ignore since it targets a system the requires VPN