Examples of StubDataSource


Examples of com.zaxxer.hikari.mocks.StubDataSource

         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         PrintStream ps = new PrintStream(baos, true);
         TestElf.setSlf4jTargetStream(HikariConfig.class, ps);

         config.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");
         config.setDataSource(new StubDataSource());
         config.validate();
         Assert.assertTrue(new String(baos.toByteArray()).contains("both dataSource"));
      }
      catch (IllegalStateException ise) {
         Assert.assertTrue(ise.getMessage().contains("both dataSource"));
View Full Code Here

Examples of com.zaxxer.hikari.mocks.StubDataSource

      config.setConnectionTestQuery("VALUES 1");
      config.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");

      HikariDataSource ds = new HikariDataSource(config);

      StubDataSource stubDataSource = ds.unwrap(StubDataSource.class);
      stubDataSource.setThrowException(new SQLException("Connection refused"));

      long start = System.currentTimeMillis();
      try {
         Connection connection = ds.getConnection();
         connection.close();
View Full Code Here

Examples of com.zaxxer.hikari.mocks.StubDataSource

      config.setConnectionTestQuery("VALUES 1");
      config.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");

      HikariDataSource ds = new HikariDataSource(config);

      final StubDataSource stubDataSource = ds.unwrap(StubDataSource.class);
      stubDataSource.setThrowException(new SQLException("Connection refused"));

      ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
      scheduler.schedule(new Runnable() {
         public void run()
         {
            stubDataSource.setThrowException(null);
         }
      }, 300, TimeUnit.MILLISECONDS);

      long start = System.currentTimeMillis();
      try {
View Full Code Here

Examples of com.zaxxer.hikari.mocks.StubDataSource

      config.setConnectionTestQuery("VALUES 1");
      config.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");

      HikariDataSource ds = new HikariDataSource(config);

      StubDataSource stubDataSource = ds.unwrap(StubDataSource.class);
      stubDataSource.setThrowException(new SQLException("Connection refused"));

      long start = System.currentTimeMillis();
      try {
         Connection connection = ds.getConnection();
         connection.close();
View Full Code Here

Examples of com.zaxxer.hikari.mocks.StubDataSource

               e.printStackTrace(System.err);
            }
         }
      }, 250, TimeUnit.MILLISECONDS);

      StubDataSource stubDataSource = ds.unwrap(StubDataSource.class);
      stubDataSource.setThrowException(new SQLException("Connection refused"));

      try {
         Connection connection2 = ds.getConnection();
         connection2.close();
View Full Code Here

Examples of com.zaxxer.hikari.mocks.StubDataSource

       config.setConnectionTestQuery("VALUES 1");
       config.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");

       HikariDataSource ds = new HikariDataSource(config);
       try {
          StubDataSource unwrap = ds.unwrap(StubDataSource.class);
          Assert.assertNotNull(unwrap);
          Assert.assertTrue(unwrap instanceof StubDataSource);

          Assert.assertFalse(ds.isWrapperFor(getClass()));
          try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.