Tabnine Logo
JobListenerFactoryBean
Code IndexAdd Tabnine to your IDE (free)

How to use
JobListenerFactoryBean
in
org.springframework.batch.core.listener

Best Java code snippets using org.springframework.batch.core.listener.JobListenerFactoryBean (Showing top 20 results out of 315)

origin: spring-projects/spring-batch

/**
 * Convenience method to wrap any object and expose the appropriate
 * {@link JobExecutionListener} interfaces.
 *
 * @param delegate a delegate object
 * @return a JobListener instance constructed from the delegate
 */
public static JobExecutionListener getListener(Object delegate) {
  JobListenerFactoryBean factory = new JobListenerFactoryBean();
  factory.setDelegate(delegate);
  return (JobExecutionListener) factory.getObject();
}
origin: spring-projects/spring-batch

@Test
public void testEqualityOfProxies() throws Exception {
  JobListenerWithInterface delegate = new JobListenerWithInterface();
  Object listener1 = JobListenerFactoryBean.getListener(delegate);
  Object listener2 = JobListenerFactoryBean.getListener(delegate);
  assertEquals(listener1, listener2);
}
origin: spring-projects/spring-batch

@Test
public void testAnnotationsIsListener() throws Exception {
  assertTrue(JobListenerFactoryBean.isListener(new Object() {
    @BeforeJob
    public void foo(JobExecution execution) {
    }
  }));
}
origin: spring-projects/spring-batch

@Test(expected = IllegalArgumentException.class)
public void testWrongSignatureAnnotation() {
  AbstractTestComponent delegate = new AbstractTestComponent() {
    @AfterJob
    public void aMethod(Integer item) {
      executed = true;
    }
  };
  factoryBean.setDelegate(delegate);
  factoryBean.getObject();
}
origin: spring-projects/spring-batch

@Test(expected = IllegalArgumentException.class)
public void testWrongSignatureNamedMethod() {
  AbstractTestComponent delegate = new AbstractTestComponent() {
    @SuppressWarnings("unused")
    public void aMethod(Integer item) {
      executed = true;
    }
  };
  factoryBean.setDelegate(delegate);
  Map<String, String> metaDataMap = new HashMap<>();
  metaDataMap.put(AFTER_JOB.getPropertyName(), "aMethod");
  factoryBean.setMetaDataMap(metaDataMap);
  factoryBean.getObject();
}
origin: spring-projects/spring-batch

@Before
public void setUp() {
  factoryBean = new JobListenerFactoryBean();
}
origin: spring-projects/spring-batch

@Test
public void testVanillaInterfaceWithProxy() throws Exception {
  JobListenerWithInterface delegate = new JobListenerWithInterface();
  ProxyFactory factory = new ProxyFactory(delegate);
  factoryBean.setDelegate(factory.getProxy());
  Object listener = factoryBean.getObject();
  assertTrue(listener instanceof JobExecutionListener);
}
origin: spring-projects/spring-batch

@Test
public void testEmptySignatureNamedMethod() {
  AbstractTestComponent delegate = new AbstractTestComponent() {
    @SuppressWarnings("unused")
    public void aMethod() {
      executed = true;
    }
  };
  factoryBean.setDelegate(delegate);
  Map<String, String> metaDataMap = new HashMap<>();
  metaDataMap.put(AFTER_JOB.getPropertyName(), "aMethod");
  factoryBean.setMetaDataMap(metaDataMap);
  JobExecutionListener listener = (JobExecutionListener) factoryBean.getObject();
  listener.afterJob(new JobExecution(1L));
  assertTrue(delegate.isExecuted());
}
origin: apache/servicemix-bundles

/**
 * Convenience method to wrap any object and expose the appropriate
 * {@link JobExecutionListener} interfaces.
 *
 * @param delegate a delegate object
 * @return a JobListener instance constructed from the delegate
 */
public static JobExecutionListener getListener(Object delegate) {
  JobListenerFactoryBean factory = new JobListenerFactoryBean();
  factory.setDelegate(delegate);
  return (JobExecutionListener) factory.getObject();
}
origin: spring-projects/spring-batch

@Test
public void testEmptySignatureAnnotation() {
  AbstractTestComponent delegate = new AbstractTestComponent() {
    @AfterJob
    public void aMethod() {
      executed = true;
    }
  };
  factoryBean.setDelegate(delegate);
  JobExecutionListener listener = (JobExecutionListener) factoryBean.getObject();
  listener.afterJob(new JobExecution(1L));
  assertTrue(delegate.isExecuted());
}
origin: spring-projects/spring-batch

@Test
public void testRightSignatureNamedMethod() {
  AbstractTestComponent delegate = new AbstractTestComponent() {
    @SuppressWarnings("unused")
    public void aMethod(JobExecution jobExecution) {
      executed = true;
      assertEquals(new Long(25), jobExecution.getId());
    }
  };
  factoryBean.setDelegate(delegate);
  Map<String, String> metaDataMap = new HashMap<>();
  metaDataMap.put(AFTER_JOB.getPropertyName(), "aMethod");
  factoryBean.setMetaDataMap(metaDataMap);
  JobExecutionListener listener = (JobExecutionListener) factoryBean.getObject();
  listener.afterJob(new JobExecution(25L));
  assertTrue(delegate.isExecuted());
}
origin: spring-projects/spring-batch

@Test
public void testUseInHashSet() throws Exception {
  JobListenerWithInterface delegate = new JobListenerWithInterface();
  Object listener = JobListenerFactoryBean.getListener(delegate);
  Object other = JobListenerFactoryBean.getListener(delegate);
  assertTrue(listener instanceof JobExecutionListener);
  Set<JobExecutionListener> listeners = new HashSet<>();
  listeners.add((JobExecutionListener) listener);
  listeners.add((JobExecutionListener) other);
  assertTrue(listeners.contains(listener));
  assertEquals(1, listeners.size());
}
origin: spring-projects/spring-batch

@Test
public void testInterfaceIsListener() throws Exception {
  assertTrue(JobListenerFactoryBean.isListener(new JobListenerWithInterface()));
}
origin: org.springframework.batch/org.springframework.batch.core

/**
 * Convenience method to wrap any object and expose the appropriate
 * {@link JobExecutionListener} interfaces.
 * 
 * @param delegate a delegate object
 * @return a JobListener instance constructed from the delegate
 */
public static JobExecutionListener getListener(Object delegate) {
  JobListenerFactoryBean factory = new JobListenerFactoryBean();
  factory.setDelegate(delegate);
  return (JobExecutionListener) factory.getObject();
}
origin: spring-projects/spring-batch

@Test
public void testRightSignatureAnnotation() {
  AbstractTestComponent delegate = new AbstractTestComponent() {
    @AfterJob
    public void aMethod(JobExecution jobExecution) {
      executed = true;
      assertEquals(new Long(25), jobExecution.getId());
    }
  };
  factoryBean.setDelegate(delegate);
  JobExecutionListener listener = (JobExecutionListener) factoryBean.getObject();
  listener.afterJob(new JobExecution(25L));
  assertTrue(delegate.isExecuted());
}
origin: spring-projects/spring-batch

@Test
public void testAnnotationsWithOrdered() throws Exception {
  Object delegate = new Ordered() {
    @BeforeJob
    public void foo(JobExecution execution) {
    }
    @Override
    public int getOrder() {
      return 3;
    }
  };
  JobExecutionListener listener = JobListenerFactoryBean.getListener(delegate);
  assertTrue("Listener is not of correct type", listener instanceof Ordered);
  assertEquals(3, ((Ordered) listener).getOrder());
}
origin: org.springframework.batch/spring-batch-core

/**
 * Convenience method to wrap any object and expose the appropriate
 * {@link JobExecutionListener} interfaces.
 *
 * @param delegate a delegate object
 * @return a JobListener instance constructed from the delegate
 */
public static JobExecutionListener getListener(Object delegate) {
  JobListenerFactoryBean factory = new JobListenerFactoryBean();
  factory.setDelegate(delegate);
  return (JobExecutionListener) factory.getObject();
}
origin: spring-projects/spring-batch

@Test
public void testWithInterface() throws Exception {
  JobListenerWithInterface delegate = new JobListenerWithInterface();
  factoryBean.setDelegate(delegate);
  JobExecutionListener listener = (JobExecutionListener) factoryBean.getObject();
  JobExecution jobExecution = new JobExecution(11L);
  listener.beforeJob(jobExecution);
  listener.afterJob(jobExecution);
  assertTrue(delegate.beforeJobCalled);
  assertTrue(delegate.afterJobCalled);
}
origin: spring-projects/spring-batch

@Test
public void testFactoryMethod() throws Exception {
  JobListenerWithInterface delegate = new JobListenerWithInterface();
  Object listener = JobListenerFactoryBean.getListener(delegate);
  assertTrue(listener instanceof JobExecutionListener);
  ((JobExecutionListener) listener).afterJob(new JobExecution(11L));
  assertTrue(delegate.afterJobCalled);
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

/**
 * Convenience method to wrap any object and expose the appropriate
 * {@link JobExecutionListener} interfaces.
 *
 * @param delegate a delegate object
 * @return a JobListener instance constructed from the delegate
 */
public static JobExecutionListener getListener(Object delegate) {
  JobListenerFactoryBean factory = new JobListenerFactoryBean();
  factory.setDelegate(delegate);
  return (JobExecutionListener) factory.getObject();
}
org.springframework.batch.core.listenerJobListenerFactoryBean

Javadoc

This AbstractListenerFactoryBean implementation is used to create a JobExecutionListener.

Most used methods

  • <init>
  • getObject
  • setDelegate
  • getListener
    Convenience method to wrap any object and expose the appropriate JobExecutionListener interfaces.
  • isListener
    Convenience method to check whether the given object is or can be made into a JobExecutionListener.
  • setMetaDataMap

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (Timer)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now