Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-19731

Consider adding exceptions among shared packages in in-jvm dtest api

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Triage Needed
    • Normal
    • Resolution: Unresolved
    • None
    • Test/dtest/java
    • None
    • All
    • None

    Description

      This does not work

      try (Cluster ignored = build(1)
                             .withConfig(c -> c.with(Feature.NETWORK, Feature.NATIVE_PROTOCOL, Feature.GOSSIP)
                                               .set("some_property_which_throws_when_misconfigured", value))
                             .start())
      {
          fail("should throw ConfigurationException");
      }
      catch (Exception ex)
      {
          assertEquals(ConfigurationException.class, ex.getClass());
      }
      

      Because ConfigurationException is not shared so it looks like it doesn't match.

      this is workaround

              Predicate<String> EXTRA = className -> className.equals(ConfigurationException.class.getName());
              Cluster.Builder builder = build(1);
              assertThatThrownBy(() -> builder
                                       .withSharedClasses(EXTRA.or(builder.getSharedClasses()))
                                       .start())
              .isInstanceOf(ConfigurationException.class);
      

      But to have it nice and clean like this, it would require us to share all exceptions, to add them to "DEFAULT_SHARED_PACKAGES". in "org.apache.cassandra.distributed.shared.InstanceClassLoader".

              assertThatThrownBy(() -> build(1).withConfig(c -> c.set("some_property_which_throws_when_misconfigured", value)).start())
              .isInstanceOf(ConfigurationException.class);
      

      We could just put all package there.

      This would require release of in-jvm dtest api.

      Attachments

        Activity

          People

            smiklosovic Stefan Miklosovic
            smiklosovic Stefan Miklosovic
            Stefan Miklosovic
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: