@Test public void getInstanceRoot_butChannelIsTypeBased() { final ChannelSchema channelSchema = new ChannelSchema( 0, ValueUtil.randomString(), null, ChannelSchema.FilterType.NONE, null, false, true, Collections.emptyList() ); createConnector( new SystemSchema( 1, ValueUtil.randomString(), new ChannelSchema[]{ channelSchema }, new EntitySchema[ 0 ] ) ); final ChannelAddress address1 = new ChannelAddress( 1, 0, 44 ); final Subscription subscription1 = Subscription.create( null, address1, null, true ); final IllegalStateException exception = expectThrows( IllegalStateException.class, () -> safeAction( subscription1::getInstanceRoot ) ); assertEquals( exception.getMessage(), "Replicant-0029: Subscription.getInstanceRoot() invoked on subscription for channel 1.0.44 but channel is not instance based." ); }
@Nonnull static Subscription create( @Nullable final ReplicantContext context, @Nonnull final ChannelAddress address, @Nullable final Object filter, final boolean explicitSubscription ) { return new Arez_Subscription( context, address, filter, explicitSubscription ); }
Subscription extends ReplicantService implements Comparable<Subscription> { @Nonnull static Subscription create( @Nullable final ReplicantContext context, @Nonnull final ChannelAddress address, @Nullable final Object filter, final boolean explicitSubscription ) { return new Arez_Subscription( context, address, filter, explicitSubscription ); } }
Subscription extends ReplicantService implements Comparable<Subscription> { @Nonnull static Subscription create( @Nullable final ReplicantContext context, @Nonnull final ChannelAddress address, @Nullable final Object filter, final boolean explicitSubscription ) { return new Arez_Subscription( context, address, filter, explicitSubscription ); } Subscription( @Nullable final ReplicantContext context, @Nonnull final ChannelAddress address ); }
Subscription extends ReplicantService implements Comparable<Subscription> { @Nonnull static Subscription create( @Nullable final ReplicantContext context, @Nonnull final ChannelAddress address, @Nullable final Object filter, final boolean explicitSubscription ) { return new Arez_Subscription( context, address, filter, explicitSubscription ); } Subscription( @Nullable final ReplicantContext context, @Nonnull final ChannelAddress address ); @Nonnull ChannelAddress getAddress(); @Observable( initializer = Feature.ENABLE ) @Nullable abstract Object getFilter(); @Observable( initializer = Feature.ENABLE ) abstract boolean isExplicitSubscription(); abstract void setExplicitSubscription( boolean explicitSubscription ); @Nonnull Collection<Class<?>> findAllEntityTypes(); @Nonnull List<Entity> findAllEntitiesByType( @Nonnull final Class<?> type ); @Nullable Entity findEntityByTypeAndId( @Nonnull final Class<?> type, final int id ); @Nonnull Object getInstanceRoot(); @Nonnull ChannelSchema getChannelSchema(); @Override int compareTo( @Nonnull final Subscription o ); }
Subscription extends ReplicantService implements Comparable<Subscription> { @Nonnull static Subscription create( @Nullable final ReplicantContext context, @Nonnull final ChannelAddress address, @Nullable final Object filter, final boolean explicitSubscription ) { return new Arez_Subscription( context, address, filter, explicitSubscription ); } Subscription( @Nullable final ReplicantContext context, @Nonnull final ChannelAddress address ); @Nonnull ChannelAddress getAddress(); @Observable( initializer = Feature.ENABLE ) @Nullable abstract Object getFilter(); @Observable( initializer = Feature.ENABLE ) abstract boolean isExplicitSubscription(); abstract void setExplicitSubscription( boolean explicitSubscription ); @Nonnull Collection<Class<?>> findAllEntityTypes(); @Nonnull List<Entity> findAllEntitiesByType( @Nonnull final Class<?> type ); @Nullable Entity findEntityByTypeAndId( @Nonnull final Class<?> type, final int id ); @Nonnull Object getInstanceRoot(); @Nonnull ChannelSchema getChannelSchema(); @Override int compareTo( @Nonnull final Subscription o );  }