@Test public void duplicateRegister() { final ReplicantRuntime runtime1 = Replicant.context().getRuntime(); final SystemSchema schema = newSchema(); final Connector connector1 = createConnector( schema ); final IllegalStateException exception = expectThrows( IllegalStateException.class, () -> runtime1.registerConnector( connector1 ) ); assertEquals( exception.getMessage(), "Replicant-0015: Invoked registerConnector for system schema named '" + schema.getName() + "' but a Connector for specified schema exists." ); }
@Action void registerConnector( @Nonnull final Connector connector ) { if ( Replicant.shouldCheckInvariants() ) { invariant( () -> _connectors.stream() .noneMatch( e -> e.getConnector().getSchema().getId() == connector.getSchema().getId() ), () -> "Replicant-0015: Invoked registerConnector for system schema named '" + connector.getSchema().getName() + "' but a Connector for specified schema exists." ); } getConnectorsObservableValue().preReportChanged(); final ConnectorEntry entry = new ConnectorEntry( connector, true ); _connectors.add( entry ); DisposeNotifier .asDisposeNotifier( connector ) .addOnDisposeListener( this, () -> deregisterConnector( connector ) ); getConnectorsObservableValue().reportChanged(); }
ReplicantRuntime { @Action void registerConnector( @Nonnull final Connector connector ) { if ( Replicant.shouldCheckInvariants() ) { invariant( () -> _connectors.stream() .noneMatch( e -> e.getConnector().getSchema().getId() == connector.getSchema().getId() ), () -> "Replicant-0015: Invoked registerConnector for system schema named '" + connector.getSchema().getName() + "' but a Connector for specified schema exists." ); } getConnectorsObservableValue().preReportChanged(); final ConnectorEntry entry = new ConnectorEntry( connector, true ); _connectors.add( entry ); DisposeNotifier .asDisposeNotifier( connector ) .addOnDisposeListener( this, () -> deregisterConnector( connector ) ); getConnectorsObservableValue().reportChanged(); } }
ReplicantRuntime { @Action void registerConnector( @Nonnull final Connector connector ) { if ( Replicant.shouldCheckInvariants() ) { invariant( () -> _connectors.stream() .noneMatch( e -> e.getConnector().getSchema().getId() == connector.getSchema().getId() ), () -> "Replicant-0015: Invoked registerConnector for system schema named '" + connector.getSchema().getName() + "' but a Connector for specified schema exists." ); } getConnectorsObservableValue().preReportChanged(); final ConnectorEntry entry = new ConnectorEntry( connector, true ); _connectors.add( entry ); DisposeNotifier .asDisposeNotifier( connector ) .addOnDisposeListener( this, () -> deregisterConnector( connector ) ); getConnectorsObservableValue().reportChanged(); }  }
ReplicantRuntime { @Action void registerConnector( @Nonnull final Connector connector ) { if ( Replicant.shouldCheckInvariants() ) { invariant( () -> _connectors.stream() .noneMatch( e -> e.getConnector().getSchema().getId() == connector.getSchema().getId() ), () -> "Replicant-0015: Invoked registerConnector for system schema named '" + connector.getSchema().getName() + "' but a Connector for specified schema exists." ); } getConnectorsObservableValue().preReportChanged(); final ConnectorEntry entry = new ConnectorEntry( connector, true ); _connectors.add( entry ); DisposeNotifier .asDisposeNotifier( connector ) .addOnDisposeListener( this, () -> deregisterConnector( connector ) ); getConnectorsObservableValue().reportChanged(); }  @Action( verifyRequired = false, reportParameters = false ) void setAuthToken( @Nullable final String authToken ); }
ReplicantRuntime { @Action void registerConnector( @Nonnull final Connector connector ) { if ( Replicant.shouldCheckInvariants() ) { invariant( () -> _connectors.stream() .noneMatch( e -> e.getConnector().getSchema().getId() == connector.getSchema().getId() ), () -> "Replicant-0015: Invoked registerConnector for system schema named '" + connector.getSchema().getName() + "' but a Connector for specified schema exists." ); } getConnectorsObservableValue().preReportChanged(); final ConnectorEntry entry = new ConnectorEntry( connector, true ); _connectors.add( entry ); DisposeNotifier .asDisposeNotifier( connector ) .addOnDisposeListener( this, () -> deregisterConnector( connector ) ); getConnectorsObservableValue().reportChanged(); }  @Action( verifyRequired = false, reportParameters = false ) void setAuthToken( @Nullable final String authToken );  }