Package org.springmodules.lucene.index.factory

Examples of org.springmodules.lucene.index.factory.MockIndexFactory


  public void testInterceptorWriterSuccess() throws Exception {
    System.out.println("1");
    try {
      ApplicationContext context = new ClassPathXmlApplicationContext(getConfigLocation());
      IndexDao test = (IndexDao)context.getBean(BEAN_ID);
      MockIndexFactory mockIndexFactory = (MockIndexFactory)context.getBean(INDEX_FACTORY_ID);

      test.myMethod1();

      assertEquals(mockIndexFactory.getCallNumberWriter(), 1);
      assertEquals(mockIndexFactory.getCallNumberReader(), 0);
    } catch(Exception ex) {
      ex.printStackTrace();
    }
  }
View Full Code Here


  }

  public void testInterceptorWriterError() throws Exception {
    ApplicationContext context = new ClassPathXmlApplicationContext(getConfigLocation());
    IndexDao test = (IndexDao)context.getBean(BEAN_ID);
    MockIndexFactory mockIndexFactory = (MockIndexFactory)context.getBean(INDEX_FACTORY_ID);

    try {
      test.myMethod2();
      fail();
    } catch(LuceneIndexingException ex) { }

    assertEquals(mockIndexFactory.getCallNumberWriter(), 1);
    assertEquals(mockIndexFactory.getCallNumberReader(), 0);
  }
View Full Code Here

  }

  public void testInterceptorReaderSuccess() throws Exception {
    ApplicationContext context = new ClassPathXmlApplicationContext(getConfigLocation());
    IndexDao test = (IndexDao)context.getBean(BEAN_ID);
    MockIndexFactory mockIndexFactory = (MockIndexFactory)context.getBean(INDEX_FACTORY_ID);

    test.myMethod3();

    assertEquals(mockIndexFactory.getCallNumberWriter(), 0);
    assertEquals(mockIndexFactory.getCallNumberReader(), 1);
  }
View Full Code Here

  }

  public void testInterceptorReaderError() throws Exception {
    ApplicationContext context = new ClassPathXmlApplicationContext(getConfigLocation());
    IndexDao test = (IndexDao)context.getBean(BEAN_ID);
    MockIndexFactory mockIndexFactory = (MockIndexFactory)context.getBean(INDEX_FACTORY_ID);

    try {
      test.myMethod4();
      fail();
    } catch(LuceneIndexingException ex) { }

    assertEquals(mockIndexFactory.getCallNumberWriter(), 0);
    assertEquals(mockIndexFactory.getCallNumberReader(), 1);
  }
View Full Code Here

TOP

Related Classes of org.springmodules.lucene.index.factory.MockIndexFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.