하둡 스프링 연동 테스트 - hadoop 2.6.x with spring 4.0

Hadoop 설치 및 설정은 아래와 같이 (osx 요세미티.) https://hadoop.apache.org/releases.html#Download ( 2.6.x 버전 ) 설치는 아래 블로그 보고 함 http://iamhereweare.blogspot.kr/2014/05/hadoop.html pom.xml 에 아래 dependency 추가. 1 2 3 4 5 <dependency> <groupid>org.springframework.data</groupId> <artifactid>spring-data-hadoop</artifactId> <version>2.1.1.RELEASE</version> </dependency> context-hadoop.xml spring 설정에 파일 추가 1 2 3 4 5 6 7 8 9 10 11 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hdp="http://www.springframework.org/schema/hadoop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/hadoop http://www.springframework.org/schema/hadoop/spring-hadoop.xsd"> <hdp:configuration id="hdConf"> fs.default.name=hdfs://localhost:9000 </hdp:configuration> </beans> 아래와 같이 test코드 작성....

April 12, 2015 · 2 min · 페이퍼

spring junit testcase 작성

pom.xml에 아래 추가. 1 2 3 4 5 6 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>4.0.5.RELEASE</version> <scope>test</scope> </dependency> test java코드 MemberServiceTest.java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration( { "classpath:servlet-context.xml", "classpath:config/context-datasource.xml" } ) public class MemberServiceTest { @Autowired MemberService memberService; @Test public void testSr2002() throws Exception { RequestData req = new RequestData(null, new DbMap()); ResponseData res = new ResponseData(new DbMap()); memberService....

March 24, 2015 · 1 min · 페이퍼

spring-rabbitmq 연동

설치는 그냥 rpm 으로 설치 1 2 3 4 5 # 서버 시작. sbin/rabbitmq-server start # 서버 중지 sbin/rabbitmqctl stop spring-rabbit 연동 pom.xml 1 2 3 4 5 <dependency> <groupid>org.springframework.amqp</groupId> <artifactid>spring-rabbit</artifactId> <version>1.4.1.RELEASE</version> </dependency> context-rabbitmq.xml 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 <!-- A reference to the org.springframework.amqp.rabbit.connection.ConnectionFactory --> <rabbit:connection-factory id="connectionFactory" host="localhost" username="worker" password="workerpassword" /> <!-- Creates a org.springframework.amqp.rabbit.core.RabbitTemplate for access to the broker --> <rabbit:template id="amqpTemplate" connection-factory="connectionFactory" /> <!...

March 10, 2015 · 1 min · 페이퍼

spring map to xml viewresolver

항상 json으로만 뱉다가 xml로 뱉어야 하는 상황이 발생해서 만든 spring view 클래스 결과가 map에 경우에만 해당됨 아래 설정하고… applicationServlet.xml 1 2 3 4 <beans:bean id="xmlView2" class="org.springframework.web.servlet.view.XmlViewResolver"> <beans:property name="order" value="1"/> <beans:property name="location" value="classpath:xml-views.xml"/> </beans:bean> xml-views.xml 내용. 1 2 3 4 5 6 7 8 9 10 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean name="xmlView" class="com.xxxxx.view.AjaxResponseXMLView"> <property name="contentType"> <value>text/xml;charset=utf-8</value> </property> </bean> </beans> AjaxResponseXMLView.java 아래 클래스를 이용함 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 public class AjaxResponseXMLView extends AbstractView { @Override protected void renderMergedOutputModel(Map map, HttpServletRequest request, HttpServletResponse response) throws Exception { String xmlHeader = "\r\n"; StringBuffer xmlSb = new StringBuffer(); xmlSb....

February 5, 2015 · 2 min · 페이퍼