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

How to use
JdbcMerchantRepository
in
savings.repository.impl

Best Java code snippets using savings.repository.impl.JdbcMerchantRepository (Showing top 20 results out of 315)

origin: warszawajug/spring-labs

@PostConstruct
void populateCache() {
  LOG.info("Populating merchants cache...");
  String sql =
      "select * " +
      "from MERCHANT";
  try (Connection connection = dataSource.getConnection();
     PreparedStatement statement = connection.prepareStatement(sql)) {
    try (ResultSet resultSet = statement.executeQuery()) {
      if (resultSet.next()) {
        Merchant merchant = readMerchantFrom(resultSet);
        cache.put(merchant.getNumber(), merchant);
      }
    }
  } catch (SQLException e) {
    throw new RuntimeException("Error in findByNumber!", e);
  }
}
origin: warszawajug/spring-labs

@Before
public void setUp() throws Exception {
  // simulate Spring bean initialization lifecycle
  // create the bean first
  repository = new JdbcMerchantRepository();
  // deliver its dependencies
  repository.setDataSource(createDataSource());
  // FIXME 1: initialize the bean
  repository.populateCache();
}
origin: warszawajug/spring-labs

@After
public void tearDown() {
  // simulate Spring bean destruction lifecycle
  // FIXME 2: destroy the bean
  repository.clearCache();
}
origin: warszawajug/spring-labs

@Before
public void setUp() throws Exception {
  repository = new JdbcMerchantRepository(new JdbcTemplate(createDataSource()));
  repository.populateCache();
}
origin: warszawajug/spring-labs

@Before
public void setUp() throws Exception {
  // simulate Spring bean initialization lifecycle
  // create the bean first
  repository = new JdbcMerchantRepository();
  // deliver its dependencies
  repository.setDataSource(createDataSource());
  // FIXME 1: initialize the bean
}
origin: warszawajug/spring-labs

@Test
public void shouldThrowWhenMerchantNotFound() {
  catchException(repository, EmptyResultDataAccessException.class).findByNumber("111111111");
  assertThat(caughtException()).isNotNull();
}
origin: warszawajug/spring-labs

@Test
public void shouldThrowWhenMerchantNotFound() {
  catchException(repository, EmptyResultDataAccessException.class).findByNumber("111111111");
  assertThat(caughtException()).isNotNull();
}
origin: warszawajug/spring-labs

@Before
public void setUp() throws Exception {
  repository = new JdbcMerchantRepository(new JdbcTemplate(createDataSource()));
  repository.populateCache();
}
origin: warszawajug/spring-labs

@Before
public void setUp() throws Exception {
  repository = new JdbcMerchantRepository();
  repository.setDataSource(createDataSource());
  repository.populateCache();
}
origin: warszawajug/spring-labs

@Test
public void shouldThrowWhenMerchantNotFound() {
  catchException(repository, EmptyResultDataAccessException.class).findByNumber("111111111");
  assertThat(caughtException()).isNotNull();
}
origin: warszawajug/spring-labs

void populateCache() {
  LOG.info("Populating merchants cache...");
  String sql =
      "select * " +
      "from MERCHANT";
  try (Connection connection = dataSource.getConnection();
     PreparedStatement statement = connection.prepareStatement(sql)) {
    try (ResultSet resultSet = statement.executeQuery()) {
      if (resultSet.next()) {
        Merchant merchant = readMerchantFrom(resultSet);
        cache.put(merchant.getNumber(), merchant);
      }
    }
  } catch (SQLException e) {
    throw new RuntimeException("Error in findByNumber!", e);
  }
}
origin: warszawajug/spring-labs

@After
public void tearDown() {
  repository.clearCache();
}
origin: warszawajug/spring-labs

@Before
public void setUp() throws Exception {
  repository = new JdbcMerchantRepository();
  repository.setDataSource(createDataSource());
  repository.populateCache();
}
origin: warszawajug/spring-labs

@Test
public void shouldThrowWhenMerchantNotFound() {
  catchException(repository, EmptyResultDataAccessException.class).findByNumber("111111111");
  assertThat(caughtException()).isNotNull();
}
origin: warszawajug/spring-labs

@PostConstruct
void populateCache() {
  LOG.info("Populating merchants cache...");
  String sql =
      "select * " +
      "from MERCHANT";
  try (Connection connection = dataSource.getConnection();
     PreparedStatement statement = connection.prepareStatement(sql)) {
    try (ResultSet resultSet = statement.executeQuery()) {
      if (resultSet.next()) {
        Merchant merchant = readMerchantFrom(resultSet);
        cache.put(merchant.getNumber(), merchant);
      }
    }
  } catch (SQLException e) {
    throw new RuntimeException("Error in findByNumber!", e);
  }
}
origin: warszawajug/spring-labs

@After
public void tearDown() {
  repository.clearCache();
}
origin: warszawajug/spring-labs

@Test
public void shouldThrowWhenMerchantNotFound() {
  catchException(repository, EmptyResultDataAccessException.class).findByNumber("111111111");
  assertThat(caughtException()).isNotNull();
}
origin: warszawajug/spring-labs

@PostConstruct
void populateCache() {
  LOG.info("Populating merchants cache...");
  String sql =
      "select * " +
      "from MERCHANT";
  try (Connection connection = dataSource.getConnection();
     PreparedStatement statement = connection.prepareStatement(sql)) {
    try (ResultSet resultSet = statement.executeQuery()) {
      if (resultSet.next()) {
        Merchant merchant = readMerchantFrom(resultSet);
        cache.put(merchant.getNumber(), merchant);
      }
    }
  } catch (SQLException e) {
    throw new RuntimeException("Error in findByNumber!", e);
  }
}
origin: warszawajug/spring-labs

@After
public void tearDown() {
  repository.clearCache();
}
origin: warszawajug/spring-labs

@Test
public void shouldThrowWhenMerchantNotFound() {
  catchException(repository, EmptyResultDataAccessException.class).findByNumber("111111111");
  assertThat(caughtException()).isNotNull();
}
savings.repository.implJdbcMerchantRepository

Most used methods

  • readMerchantFrom
  • <init>
  • findByNumber
  • clearCache
  • populateCache
  • setDataSource

Popular in Java

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • onRequestPermissionsResult (Fragment)
  • addToBackStack (FragmentTransaction)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • CodeWhisperer alternatives
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