@Override public SELF isNotNull() { return super.isNotNull(); }
@Override public SELF isNotNull() { return super.isNotNull(); }
public LithoViewAssert containsTestKey(String testKey, OccurrenceCount count) { final Deque<TestItem> testItems = LithoViewTestHelper.findTestItems(actual, testKey); Java6Assertions.assertThat(testItems) .hasSize(count.times) .overridingErrorMessage( "Expected to find test key <%s> in LithoView <%s> %s, but %s.", testKey, actual, count, testItems.isEmpty() ? "couldn't find it" : String.format(Locale.ROOT, "saw it %d times instead", testItems.size())) .isNotNull(); return this; }
@Test public void loadFactoriesWithClassloader() throws Exception { ClassLoader custom = new URLClassLoader(new URL[]{new File("target/externals").toURI().toURL()}); // Try without the custom classloader. Collection<SomeFactory> factories = ServiceHelper.loadFactories(SomeFactory.class); assertThat(factories) .isNotNull() .hasSize(0); // Try with the custom classloader factories = ServiceHelper.loadFactories(SomeFactory.class, custom); assertThat(factories) .isNotNull() .hasSize(1); assertThat(factories.iterator().next().classloader()).isEqualTo(custom); }
@Test public void loadFactories() throws Exception { Collection<FakeFactory> factories = ServiceHelper.loadFactories(FakeFactory.class); assertThat(factories) .isNotNull() .hasSize(2); Collection<NotImplementedSPI> impl = ServiceHelper.loadFactories(NotImplementedSPI.class); assertThat(impl) .isNotNull() .hasSize(0); }
@Test public void loadFactoriesFromTCCL() throws Exception { ClassLoader custom = new URLClassLoader(new URL[]{new File("target/externals").toURI().toURL()}); // Try without the TCCL classloader. Collection<SomeFactory> factories = ServiceHelper.loadFactories(SomeFactory.class); assertThat(factories) .isNotNull() .hasSize(0); // Try with the TCCL classloader final ClassLoader originalTCCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(custom); factories = ServiceHelper.loadFactories(SomeFactory.class); assertThat(factories) .isNotNull() .hasSize(1); assertThat(factories.iterator().next().classloader()).isEqualTo(custom); } finally { Thread.currentThread().setContextClassLoader(originalTCCL); } }
@Test public void testStartingApplicationInRedeployModeWithFileConf2() throws IOException { cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf=" + new File("src/test/resources/conf.json").getAbsolutePath() }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getString("name")).isEqualTo("vertx"); }
@Test public void testStartingApplicationInRedeployModeWithFileConf() throws IOException { cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf", new File("src/test/resources/conf.json").getAbsolutePath() }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getString("name")).isEqualTo("vertx"); }
@Test public void testStartingApplicationInRedeployModeWithInlineConf2() throws IOException { int random = (int) (Math.random() * 100); cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf={\"random\":" + random + "}" }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getInteger("random")).isEqualTo(random); }
@Test public void testStartingApplicationInRedeployModeWithInlineConf() throws IOException { int random = (int) (Math.random() * 100); cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf", "{\"random\":" + random + "}" }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getInteger("random")).isEqualTo(random); }
@Test public void loadFactoriesWithClassloader() throws Exception { ClassLoader custom = new URLClassLoader(new URL[]{new File("target/externals").toURI().toURL()}); // Try without the custom classloader. Collection<SomeFactory> factories = ServiceHelper.loadFactories(SomeFactory.class); assertThat(factories) .isNotNull() .hasSize(0); // Try with the custom classloader factories = ServiceHelper.loadFactories(SomeFactory.class, custom); assertThat(factories) .isNotNull() .hasSize(1); assertThat(factories.iterator().next().classloader()).isEqualTo(custom); }
@Test public void loadFactories() throws Exception { Collection<FakeFactory> factories = ServiceHelper.loadFactories(FakeFactory.class); assertThat(factories) .isNotNull() .hasSize(2); Collection<NotImplementedSPI> impl = ServiceHelper.loadFactories(NotImplementedSPI.class); assertThat(impl) .isNotNull() .hasSize(0); }
@Test public void loadFactoriesFromTCCL() throws Exception { ClassLoader custom = new URLClassLoader(new URL[]{new File("target/externals").toURI().toURL()}); // Try without the TCCL classloader. Collection<SomeFactory> factories = ServiceHelper.loadFactories(SomeFactory.class); assertThat(factories) .isNotNull() .hasSize(0); // Try with the TCCL classloader final ClassLoader originalTCCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(custom); factories = ServiceHelper.loadFactories(SomeFactory.class); assertThat(factories) .isNotNull() .hasSize(1); assertThat(factories.iterator().next().classloader()).isEqualTo(custom); } finally { Thread.currentThread().setContextClassLoader(originalTCCL); } }
@Test public void testStartingApplicationInRedeployModeWithFileConf() throws IOException { cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf", new File("src/test/resources/conf.json").getAbsolutePath() }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getString("name")).isEqualTo("vertx"); }
@Test public void testStartingApplicationInRedeployModeWithFileConf2() throws IOException { cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf=" + new File("src/test/resources/conf.json").getAbsolutePath() }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getString("name")).isEqualTo("vertx"); }
@Test public void testStartingApplicationInRedeployModeWithInlineConf() throws IOException { int random = (int) (Math.random() * 100); cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf", "{\"random\":" + random + "}" }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getInteger("random")).isEqualTo(random); }
@Test public void testStartingApplicationInRedeployModeWithInlineConf2() throws IOException { int random = (int) (Math.random() * 100); cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf={\"random\":" + random + "}" }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getInteger("random")).isEqualTo(random); }
createType(udt).addColumn("first", DataType.text()).addColumn("last", DataType.text())); UserType userType = cluster().getMetadata().getKeyspace(keyspace).getUserType(udt); assertThat(userType).isNotNull();
assertThat(schemaDisabledCluster.getMetadata().newTokenRange(token1, token2)).isNotNull(); assertThat(schemaDisabledCluster.getMetadata().getTokenRanges()).isNotNull().isNotEmpty();
@Test public void testGetProjectsWithOtherNamespacesPresent() throws Exception { ProjectMetadata projectMetadata = new ProjectMetadata(); projectMetadata.setId( TEST_PROJECT ); projectMetadata.setNamespace( "org.apache.maven" ); repository.updateProject( TEST_REPO_ID, projectMetadata ); repository.updateNamespace( TEST_REPO_ID, "org.apache.maven.shared" ); Collection<String> projects = repository.getProjects( TEST_REPO_ID, "org.apache.maven" ); assertThat( projects ).isNotNull().isNotEmpty().hasSize( 1 ).contains( TEST_PROJECT ); }