Stefan Miklosovic created CASSANDRA-19731:
---------------------------------------------

             Summary: Consider adding exceptions among shared packages in 
in-jvm dtest api
                 Key: CASSANDRA-19731
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-19731
             Project: Cassandra
          Issue Type: Improvement
          Components: Test/dtest/java
            Reporter: Stefan Miklosovic
            Assignee: Stefan Miklosovic


This does not work

{code}
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());
}
{code}

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

this is workaround

{code}
        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);
{code}

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".

We could just put all package there.

This would require release of in-jvm dtest api.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to