target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void invariantObserversLinked() { final Observer observer1 = Arez.context().observer( new CountAndObserveProcedure() ); final Observer observer2 = Arez.context().observer( new CountAndObserveProcedure() ); final Observer observer3 = Arez.context().observer( new CountAndObserveProcedure() ); setupReadWriteT... | void invariantObserversLinked() { if ( Arez.shouldCheckInvariants() ) { getObservers().forEach( observer -> invariant( () -> observer.getDependencies().contains( this ), () -> "Arez-0077: ObservableValue named '" + getName() + "' has observer " + "named '" + observer.getName() + "' which does not contain " + "Observabl... | ObservableValue extends Node { void invariantObserversLinked() { if ( Arez.shouldCheckInvariants() ) { getObservers().forEach( observer -> invariant( () -> observer.getDependencies().contains( this ), () -> "Arez-0077: ObservableValue named '" + getName() + "' has observer " + "named '" + observer.getName() + "' which ... | ObservableValue extends Node { void invariantObserversLinked() { if ( Arez.shouldCheckInvariants() ) { getObservers().forEach( observer -> invariant( () -> observer.getDependencies().contains( this ), () -> "Arez-0077: ObservableValue named '" + getName() + "' has observer " + "named '" + observer.getName() + "' which ... | ObservableValue extends Node { void invariantObserversLinked() { if ( Arez.shouldCheckInvariants() ) { getObservers().forEach( observer -> invariant( () -> observer.getDependencies().contains( this ), () -> "Arez-0077: ObservableValue named '" + getName() + "' has observer " + "named '" + observer.getName() + "' which ... | ObservableValue extends Node { void invariantObserversLinked() { if ( Arez.shouldCheckInvariants() ) { getObservers().forEach( observer -> invariant( () -> observer.getDependencies().contains( this ), () -> "Arez-0077: ObservableValue named '" + getName() + "' has observer " + "named '" + observer.getName() + "' which ... |
@Test public void queueForDeactivation() { final ArezContext context = Arez.context(); setupReadOnlyTransaction( context ); final ComputableValue<String> computableValue = context.computable( () -> "" ); final Observer observer = computableValue.getObserver(); final ObservableValue<?> observableValue = computableValue.... | void queueForDeactivation() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0071: Attempt to invoke queueForDeactivation on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( this::canDeactivateNow, () -> "Arez-0072: Att... | ObservableValue extends Node { void queueForDeactivation() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0071: Attempt to invoke queueForDeactivation on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( this::canDeact... | ObservableValue extends Node { void queueForDeactivation() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0071: Attempt to invoke queueForDeactivation on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( this::canDeact... | ObservableValue extends Node { void queueForDeactivation() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0071: Attempt to invoke queueForDeactivation on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( this::canDeact... | ObservableValue extends Node { void queueForDeactivation() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0071: Attempt to invoke queueForDeactivation on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( this::canDeact... |
@Test public void queueForDeactivation_observableIsNotAbleToBeDeactivated() { final ArezContext context = Arez.context(); setupReadOnlyTransaction( context ); final ObservableValue<?> observableValue = context.observable(); assertFalse( observableValue.isPendingDeactivation() ); assertInvariantFailure( observableValue:... | boolean isPendingDeactivation() { return _pendingDeactivation; } | ObservableValue extends Node { boolean isPendingDeactivation() { return _pendingDeactivation; } } | ObservableValue extends Node { boolean isPendingDeactivation() { return _pendingDeactivation; } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer observer,
... | ObservableValue extends Node { boolean isPendingDeactivation() { return _pendingDeactivation; } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer observer,
... | ObservableValue extends Node { boolean isPendingDeactivation() { return _pendingDeactivation; } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer observer,
... |
@Test public void resetPendingDeactivation() { final ArezContext context = Arez.context(); setupReadOnlyTransaction( context ); final ComputableValue<String> computableValue = context.computable( () -> "" ); final Observer observer = computableValue.getObserver(); final ObservableValue<?> observableValue = computableVa... | void resetPendingDeactivation() { _pendingDeactivation = false; } | ObservableValue extends Node { void resetPendingDeactivation() { _pendingDeactivation = false; } } | ObservableValue extends Node { void resetPendingDeactivation() { _pendingDeactivation = false; } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer observer,
... | ObservableValue extends Node { void resetPendingDeactivation() { _pendingDeactivation = false; } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer observer,
... | ObservableValue extends Node { void resetPendingDeactivation() { _pendingDeactivation = false; } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer observer,
... |
@Test public void safeGetString_generatesError() { final String text = ArezUtil.safeGetString( () -> { throw new RuntimeException( "X" ); } ); assertTrue( text.startsWith( "Exception generated whilst attempting to get supplied message.\n" + "java.lang.RuntimeException: X\n" ) ); } | @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String safeGetString( @Nonnull final Supplier<String> message ) { try { return message.get(); } catch ( final Throwable t ) { return "Exception generated whilst attempting to get supplied message.\n" + throwableToString( t ); } } | ArezUtil { @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String safeGetString( @Nonnull final Supplier<String> message ) { try { return message.get(); } catch ( final Throwable t ) { return "Exception generated whilst attempting to get supplied message.\n" + throwableToString( t ); } } } | ArezUtil { @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String safeGetString( @Nonnull final Supplier<String> message ) { try { return message.get(); } catch ( final Throwable t ) { return "Exception generated whilst attempting to get supplied message.\n" + throwableToString( t ); } } private ArezUtil()... | ArezUtil { @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String safeGetString( @Nonnull final Supplier<String> message ) { try { return message.get(); } catch ( final Throwable t ) { return "Exception generated whilst attempting to get supplied message.\n" + throwableToString( t ); } } private ArezUtil()... | ArezUtil { @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String safeGetString( @Nonnull final Supplier<String> message ) { try { return message.get(); } catch ( final Throwable t ) { return "Exception generated whilst attempting to get supplied message.\n" + throwableToString( t ); } } private ArezUtil()... |
@Test public void canDeactivate() { final ArezContext context = Arez.context(); final Observer randomObserver = context.observer( new CountAndObserveProcedure() ); setCurrentTransaction( randomObserver ); final ComputableValue<String> computableValue = context.computable( () -> "" ); final Observer observer = computabl... | boolean canDeactivate() { return isComputableValue() && !getObserver().isKeepAlive(); } | ObservableValue extends Node { boolean canDeactivate() { return isComputableValue() && !getObserver().isKeepAlive(); } } | ObservableValue extends Node { boolean canDeactivate() { return isComputableValue() && !getObserver().isKeepAlive(); } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer... | ObservableValue extends Node { boolean canDeactivate() { return isComputableValue() && !getObserver().isKeepAlive(); } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer... | ObservableValue extends Node { boolean canDeactivate() { return isComputableValue() && !getObserver().isKeepAlive(); } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer... |
@Test public void deactivate() { final ArezContext context = Arez.context(); setupReadOnlyTransaction( context ); final ComputableValue<String> computableValue = context.computable( () -> "" ); final Observer observer = computableValue.getObserver(); observer.setState( Observer.Flags.STATE_UP_TO_DATE ); final Observabl... | void deactivate() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0060: Attempt to invoke deactivate on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( this::canDeactivate, () -> "Arez-0061: Invoked deactivate on Obse... | ObservableValue extends Node { void deactivate() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0060: Attempt to invoke deactivate on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( this::canDeactivate, () -> "Arez-0... | ObservableValue extends Node { void deactivate() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0060: Attempt to invoke deactivate on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( this::canDeactivate, () -> "Arez-0... | ObservableValue extends Node { void deactivate() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0060: Attempt to invoke deactivate on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( this::canDeactivate, () -> "Arez-0... | ObservableValue extends Node { void deactivate() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0060: Attempt to invoke deactivate on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( this::canDeactivate, () -> "Arez-0... |
@Test public void activate() { final ArezContext context = Arez.context(); setupReadOnlyTransaction( context ); final ComputableValue<String> computableValue = context.computable( () -> "" ); final Observer observer = computableValue.getObserver(); observer.setState( Observer.Flags.STATE_INACTIVE ); final ObservableVal... | void activate() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0062: Attempt to invoke activate on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( () -> null != _observer, () -> "Arez-0063: Invoked activate on Observ... | ObservableValue extends Node { void activate() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0062: Attempt to invoke activate on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( () -> null != _observer, () -> "Arez-0... | ObservableValue extends Node { void activate() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0062: Attempt to invoke activate on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( () -> null != _observer, () -> "Arez-0... | ObservableValue extends Node { void activate() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0062: Attempt to invoke activate on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( () -> null != _observer, () -> "Arez-0... | ObservableValue extends Node { void activate() { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getContext().isTransactionActive(), () -> "Arez-0062: Attempt to invoke activate on ObservableValue named '" + getName() + "' when there is no active transaction." ); invariant( () -> null != _observer, () -> "Arez-0... |
@Test public void reportObserved() { final ArezContext context = Arez.context(); setupReadOnlyTransaction( context ); final ObservableValue<?> observableValue = context.observable(); assertNotEquals( observableValue.getLastTrackerTransactionId(), context.getTransaction().getId() ); assertEquals( context.getTransaction(... | public void reportObserved() { getContext().getTransaction().observe( this ); } | ObservableValue extends Node { public void reportObserved() { getContext().getTransaction().observe( this ); } } | ObservableValue extends Node { public void reportObserved() { getContext().getTransaction().observe( this ); } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer observe... | ObservableValue extends Node { public void reportObserved() { getContext().getTransaction().observe( this ); } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer observe... | ObservableValue extends Node { public void reportObserved() { getContext().getTransaction().observe( this ); } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer observe... |
@Test public void reportObservedIfTrackingTransactionActive() { final ArezContext context = Arez.context(); final ObservableValue<?> observableValue = context.observable(); observableValue.reportObservedIfTrackingTransactionActive(); context.safeAction( observableValue::reportObservedIfTrackingTransactionActive, Action... | public void reportObservedIfTrackingTransactionActive() { if ( getContext().isTrackingTransactionActive() ) { reportObserved(); } } | ObservableValue extends Node { public void reportObservedIfTrackingTransactionActive() { if ( getContext().isTrackingTransactionActive() ) { reportObserved(); } } } | ObservableValue extends Node { public void reportObservedIfTrackingTransactionActive() { if ( getContext().isTrackingTransactionActive() ) { reportObserved(); } } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,... | ObservableValue extends Node { public void reportObservedIfTrackingTransactionActive() { if ( getContext().isTrackingTransactionActive() ) { reportObserved(); } } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,... | ObservableValue extends Node { public void reportObservedIfTrackingTransactionActive() { if ( getContext().isTrackingTransactionActive() ) { reportObserved(); } } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,... |
@Test public void preReportChanged() { final ArezContext context = Arez.context(); final Observer observer = newReadWriteObserver( context ); setCurrentTransaction( observer ); final ObservableValue<?> observableValue = context.observable(); observableValue.preReportChanged(); } | @OmitSymbol( unless = "arez.check_invariants" ) public void preReportChanged() { if ( Arez.shouldCheckInvariants() ) { getContext().getTransaction().preReportChanged( this ); } } | ObservableValue extends Node { @OmitSymbol( unless = "arez.check_invariants" ) public void preReportChanged() { if ( Arez.shouldCheckInvariants() ) { getContext().getTransaction().preReportChanged( this ); } } } | ObservableValue extends Node { @OmitSymbol( unless = "arez.check_invariants" ) public void preReportChanged() { if ( Arez.shouldCheckInvariants() ) { getContext().getTransaction().preReportChanged( this ); } } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
... | ObservableValue extends Node { @OmitSymbol( unless = "arez.check_invariants" ) public void preReportChanged() { if ( Arez.shouldCheckInvariants() ) { getContext().getTransaction().preReportChanged( this ); } } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
... | ObservableValue extends Node { @OmitSymbol( unless = "arez.check_invariants" ) public void preReportChanged() { if ( Arez.shouldCheckInvariants() ) { getContext().getTransaction().preReportChanged( this ); } } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
... |
@Test public void preReportChanged_onDisposedObservable() { final ArezContext context = Arez.context(); setCurrentTransaction( newReadWriteObserver( context ) ); final ObservableValue<?> observableValue = context.observable(); observableValue.setWorkState( ObservableValue.DISPOSED ); assertInvariantFailure( observableV... | void setWorkState( final int workState ) { _workState = workState; } | ObservableValue extends Node { void setWorkState( final int workState ) { _workState = workState; } } | ObservableValue extends Node { void setWorkState( final int workState ) { _workState = workState; } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer observer,
... | ObservableValue extends Node { void setWorkState( final int workState ) { _workState = workState; } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer observer,
... | ObservableValue extends Node { void setWorkState( final int workState ) { _workState = workState; } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Observer observer,
... |
@Test public void reportChanged() { final ArezContext context = Arez.context(); final Observer observer = newReadWriteObserver( context ); setCurrentTransaction( observer ); observer.setState( Observer.Flags.STATE_UP_TO_DATE ); final ObservableValue<?> observableValue = context.observable(); observableValue.setLeastSta... | public void reportChanged() { if ( willPropagateSpyEvents() ) { reportSpyEvent( new ObservableValueChangeEvent( asInfo(), getObservableValue() ) ); } getContext().getTransaction().reportChanged( this ); } | ObservableValue extends Node { public void reportChanged() { if ( willPropagateSpyEvents() ) { reportSpyEvent( new ObservableValueChangeEvent( asInfo(), getObservableValue() ) ); } getContext().getTransaction().reportChanged( this ); } } | ObservableValue extends Node { public void reportChanged() { if ( willPropagateSpyEvents() ) { reportSpyEvent( new ObservableValueChangeEvent( asInfo(), getObservableValue() ) ); } getContext().getTransaction().reportChanged( this ); } ObservableValue( @Nullable final ArezContext context,
@Nullable f... | ObservableValue extends Node { public void reportChanged() { if ( willPropagateSpyEvents() ) { reportSpyEvent( new ObservableValueChangeEvent( asInfo(), getObservableValue() ) ); } getContext().getTransaction().reportChanged( this ); } ObservableValue( @Nullable final ArezContext context,
@Nullable f... | ObservableValue extends Node { public void reportChanged() { if ( willPropagateSpyEvents() ) { reportSpyEvent( new ObservableValueChangeEvent( asInfo(), getObservableValue() ) ); } getContext().getTransaction().reportChanged( this ); } ObservableValue( @Nullable final ArezContext context,
@Nullable f... |
@Test public void reportPossiblyChanged() { final ArezContext context = Arez.context(); final Observer observer = newReadWriteObserver( context ); setCurrentTransaction( observer ); observer.setState( Observer.Flags.STATE_UP_TO_DATE ); final ComputableValue<String> computableValue = context.computable( () -> "" ); fina... | void reportPossiblyChanged() { getContext().getTransaction().reportPossiblyChanged( this ); } | ObservableValue extends Node { void reportPossiblyChanged() { getContext().getTransaction().reportPossiblyChanged( this ); } } | ObservableValue extends Node { void reportPossiblyChanged() { getContext().getTransaction().reportPossiblyChanged( this ); } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Ob... | ObservableValue extends Node { void reportPossiblyChanged() { getContext().getTransaction().reportPossiblyChanged( this ); } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Ob... | ObservableValue extends Node { void reportPossiblyChanged() { getContext().getTransaction().reportPossiblyChanged( this ); } ObservableValue( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable final Ob... |
@Test public void reportChangeConfirmed() { final ArezContext context = Arez.context(); final Observer observer = newReadWriteObserver( context ); setCurrentTransaction( observer ); observer.setState( Observer.Flags.STATE_POSSIBLY_STALE ); final ComputableValue<String> computableValue = context.computable( () -> "" ); ... | void reportChangeConfirmed() { if ( willPropagateSpyEvents() ) { reportSpyEvent( new ObservableValueChangeEvent( asInfo(), getObservableValue() ) ); } getContext().getTransaction().reportChangeConfirmed( this ); } | ObservableValue extends Node { void reportChangeConfirmed() { if ( willPropagateSpyEvents() ) { reportSpyEvent( new ObservableValueChangeEvent( asInfo(), getObservableValue() ) ); } getContext().getTransaction().reportChangeConfirmed( this ); } } | ObservableValue extends Node { void reportChangeConfirmed() { if ( willPropagateSpyEvents() ) { reportSpyEvent( new ObservableValueChangeEvent( asInfo(), getObservableValue() ) ); } getContext().getTransaction().reportChangeConfirmed( this ); } ObservableValue( @Nullable final ArezContext context,
@N... | ObservableValue extends Node { void reportChangeConfirmed() { if ( willPropagateSpyEvents() ) { reportSpyEvent( new ObservableValueChangeEvent( asInfo(), getObservableValue() ) ); } getContext().getTransaction().reportChangeConfirmed( this ); } ObservableValue( @Nullable final ArezContext context,
@N... | ObservableValue extends Node { void reportChangeConfirmed() { if ( willPropagateSpyEvents() ) { reportSpyEvent( new ObservableValueChangeEvent( asInfo(), getObservableValue() ) ); } getContext().getTransaction().reportChangeConfirmed( this ); } ObservableValue( @Nullable final ArezContext context,
@N... |
@Test public void throwableToString() { final String text = ArezUtil.throwableToString( new RuntimeException( "X" ) ); assertTrue( text.startsWith( "java.lang.RuntimeException: X\n" ) ); } | @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String throwableToString( @Nonnull final Throwable throwable ) { final StringBuilder sb = new StringBuilder(); Throwable t = throwable; while ( null != t ) { addCausedByPrefix( sb ); sb.append( t.toString() ); for ( final StackTraceElement element : t.getStack... | ArezUtil { @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String throwableToString( @Nonnull final Throwable throwable ) { final StringBuilder sb = new StringBuilder(); Throwable t = throwable; while ( null != t ) { addCausedByPrefix( sb ); sb.append( t.toString() ); for ( final StackTraceElement element :... | ArezUtil { @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String throwableToString( @Nonnull final Throwable throwable ) { final StringBuilder sb = new StringBuilder(); Throwable t = throwable; while ( null != t ) { addCausedByPrefix( sb ); sb.append( t.toString() ); for ( final StackTraceElement element :... | ArezUtil { @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String throwableToString( @Nonnull final Throwable throwable ) { final StringBuilder sb = new StringBuilder(); Throwable t = throwable; while ( null != t ) { addCausedByPrefix( sb ); sb.append( t.toString() ); for ( final StackTraceElement element :... | ArezUtil { @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String throwableToString( @Nonnull final Throwable throwable ) { final StringBuilder sb = new StringBuilder(); Throwable t = throwable; while ( null != t ) { addCausedByPrefix( sb ); sb.append( t.toString() ); for ( final StackTraceElement element :... |
@Test public void asInfo() { final ObservableValue<String> observableValue = Arez.context().observable(); final ObservableValueInfo info = observableValue.asInfo(); assertEquals( info.getName(), observableValue.getName() ); } | @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ObservableValueInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0196: ObservableValue.asInfo() invoked but Arez.areSpiesEnabled() returned false." ); } if ( Arez.areSpiesEnab... | ObservableValue extends Node { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ObservableValueInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0196: ObservableValue.asInfo() invoked but Arez.areSpiesEnabled() returned fals... | ObservableValue extends Node { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ObservableValueInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0196: ObservableValue.asInfo() invoked but Arez.areSpiesEnabled() returned fals... | ObservableValue extends Node { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ObservableValueInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0196: ObservableValue.asInfo() invoked but Arez.areSpiesEnabled() returned fals... | ObservableValue extends Node { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ObservableValueInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0196: ObservableValue.asInfo() invoked but Arez.areSpiesEnabled() returned fals... |
@Test public void basicOperationIntegerId() { final Integer id = ValueUtil.randomInt(); final Component component = new Component( Arez.context(), ValueUtil.randomString(), id, ValueUtil.randomString(), null, null ); assertEquals( component.getId(), id ); } | @Nonnull public Object getId() { return _id; } | Component implements Disposable { @Nonnull public Object getId() { return _id; } } | Component implements Disposable { @Nonnull public Object getId() { return _id; } Component( @Nullable final ArezContext context,
@Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@... | Component implements Disposable { @Nonnull public Object getId() { return _id; } Component( @Nullable final ArezContext context,
@Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@... | Component implements Disposable { @Nonnull public Object getId() { return _id; } Component( @Nullable final ArezContext context,
@Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@... |
@Test public void complete() { final ArezContext context = Arez.context(); final String name = ValueUtil.randomString(); final Component component = context.component( ValueUtil.randomString(), ValueUtil.randomString(), name ); final ObservableValue<?> observableValue1 = context.observable(); final ComputableValue<?> c... | public void complete() { if ( !_complete ) { _complete = true; if ( Arez.areSpiesEnabled() && getContext().getSpy().willPropagateSpyEvents() ) { final ComponentInfo component = getContext().getSpy().asComponentInfo( this ); getContext().getSpy().reportSpyEvent( new ComponentCreateCompleteEvent( component ) ); } } } | Component implements Disposable { public void complete() { if ( !_complete ) { _complete = true; if ( Arez.areSpiesEnabled() && getContext().getSpy().willPropagateSpyEvents() ) { final ComponentInfo component = getContext().getSpy().asComponentInfo( this ); getContext().getSpy().reportSpyEvent( new ComponentCreateCompl... | Component implements Disposable { public void complete() { if ( !_complete ) { _complete = true; if ( Arez.areSpiesEnabled() && getContext().getSpy().willPropagateSpyEvents() ) { final ComponentInfo component = getContext().getSpy().asComponentInfo( this ); getContext().getSpy().reportSpyEvent( new ComponentCreateCompl... | Component implements Disposable { public void complete() { if ( !_complete ) { _complete = true; if ( Arez.areSpiesEnabled() && getContext().getSpy().willPropagateSpyEvents() ) { final ComponentInfo component = getContext().getSpy().asComponentInfo( this ); getContext().getSpy().reportSpyEvent( new ComponentCreateCompl... | Component implements Disposable { public void complete() { if ( !_complete ) { _complete = true; if ( Arez.areSpiesEnabled() && getContext().getSpy().willPropagateSpyEvents() ) { final ComponentInfo component = getContext().getSpy().asComponentInfo( this ); getContext().getSpy().reportSpyEvent( new ComponentCreateCompl... |
@Test public void dispose() { final ArezContext context = Arez.context(); final String name = ValueUtil.randomString(); final Component component = context.component( ValueUtil.randomString(), ValueUtil.randomString(), name ); final ObservableValue<?> observableValue1 = context.observable( component, ValueUtil.randomSt... | @Override public void dispose() { if ( !_disposed ) { _disposed = true; if ( Arez.areSpiesEnabled() && getContext().getSpy().willPropagateSpyEvents() ) { final ComponentInfo info = getContext().getSpy().asComponentInfo( this ); getContext().getSpy().reportSpyEvent( new ComponentDisposeStartEvent( info ) ); } getContext... | Component implements Disposable { @Override public void dispose() { if ( !_disposed ) { _disposed = true; if ( Arez.areSpiesEnabled() && getContext().getSpy().willPropagateSpyEvents() ) { final ComponentInfo info = getContext().getSpy().asComponentInfo( this ); getContext().getSpy().reportSpyEvent( new ComponentDispose... | Component implements Disposable { @Override public void dispose() { if ( !_disposed ) { _disposed = true; if ( Arez.areSpiesEnabled() && getContext().getSpy().willPropagateSpyEvents() ) { final ComponentInfo info = getContext().getSpy().asComponentInfo( this ); getContext().getSpy().reportSpyEvent( new ComponentDispose... | Component implements Disposable { @Override public void dispose() { if ( !_disposed ) { _disposed = true; if ( Arez.areSpiesEnabled() && getContext().getSpy().willPropagateSpyEvents() ) { final ComponentInfo info = getContext().getSpy().asComponentInfo( this ); getContext().getSpy().reportSpyEvent( new ComponentDispose... | Component implements Disposable { @Override public void dispose() { if ( !_disposed ) { _disposed = true; if ( Arez.areSpiesEnabled() && getContext().getSpy().willPropagateSpyEvents() ) { final ComponentInfo info = getContext().getSpy().asComponentInfo( this ); getContext().getSpy().reportSpyEvent( new ComponentDispose... |
@Test public void asInfo() { final ArezContext context = Arez.context(); final Component component = context.component( ValueUtil.randomString(), ValueUtil.randomString(), ValueUtil.randomString() ); final ComponentInfo info = component.asInfo(); assertEquals( info.getId(), component.getId() ); assertEquals( info.getNa... | @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ComponentInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0194: Component.asInfo() invoked but Arez.areSpiesEnabled() returned false." ); } if ( Arez.areSpiesEnabled() && nul... | Component implements Disposable { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ComponentInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0194: Component.asInfo() invoked but Arez.areSpiesEnabled() returned false." ); } ... | Component implements Disposable { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ComponentInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0194: Component.asInfo() invoked but Arez.areSpiesEnabled() returned false." ); } ... | Component implements Disposable { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ComponentInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0194: Component.asInfo() invoked but Arez.areSpiesEnabled() returned false." ); } ... | Component implements Disposable { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ComponentInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0194: Component.asInfo() invoked but Arez.areSpiesEnabled() returned false." ); } ... |
@Test public void asInfo_spyDisabled() { ArezTestUtil.disableSpies(); final ArezContext context = Arez.context(); final Component component = context.component( ValueUtil.randomString(), ValueUtil.randomString(), ValueUtil.randomString() ); assertInvariantFailure( component::asInfo, "Arez-0194: Component.asInfo() invok... | Component( @Nullable final ArezContext context, @Nonnull final String type, @Nonnull final Object id, @Nullable final String name, @Nullable final SafeProcedure preDispose, @Nullable final SafeProcedure postDispose ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> Arez.areNamesEnabled() || null == name, ... | Component implements Disposable { Component( @Nullable final ArezContext context, @Nonnull final String type, @Nonnull final Object id, @Nullable final String name, @Nullable final SafeProcedure preDispose, @Nullable final SafeProcedure postDispose ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> Arez.a... | Component implements Disposable { Component( @Nullable final ArezContext context, @Nonnull final String type, @Nonnull final Object id, @Nullable final String name, @Nullable final SafeProcedure preDispose, @Nullable final SafeProcedure postDispose ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> Arez.a... | Component implements Disposable { Component( @Nullable final ArezContext context, @Nonnull final String type, @Nonnull final Object id, @Nullable final String name, @Nullable final SafeProcedure preDispose, @Nullable final SafeProcedure postDispose ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> Arez.a... | Component implements Disposable { Component( @Nullable final ArezContext context, @Nonnull final String type, @Nonnull final Object id, @Nullable final String name, @Nullable final SafeProcedure preDispose, @Nullable final SafeProcedure postDispose ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> Arez.a... |
@Test public void invariantDependenciesBackLink() { final Observer observer = Arez.context().observer( new CountAndObserveProcedure() ); setCurrentTransaction( observer ); final ObservableValue<?> observableValue = Arez.context().observable(); observer.getDependencies().add( observableValue ); assertInvariantFailure( (... | void invariantDependenciesBackLink( @Nonnull final String context ) { if ( Arez.shouldCheckInvariants() ) { getDependencies().forEach( observable -> invariant( () -> observable.getObservers().contains( this ), () -> "Arez-0090: " + context + ": Observer named '" + getName() + "' has ObservableValue dependency named '" ... | Observer extends Node { void invariantDependenciesBackLink( @Nonnull final String context ) { if ( Arez.shouldCheckInvariants() ) { getDependencies().forEach( observable -> invariant( () -> observable.getObservers().contains( this ), () -> "Arez-0090: " + context + ": Observer named '" + getName() + "' has ObservableVa... | Observer extends Node { void invariantDependenciesBackLink( @Nonnull final String context ) { if ( Arez.shouldCheckInvariants() ) { getDependencies().forEach( observable -> invariant( () -> observable.getObservers().contains( this ), () -> "Arez-0090: " + context + ": Observer named '" + getName() + "' has ObservableVa... | Observer extends Node { void invariantDependenciesBackLink( @Nonnull final String context ) { if ( Arez.shouldCheckInvariants() ) { getDependencies().forEach( observable -> invariant( () -> observable.getObservers().contains( this ), () -> "Arez-0090: " + context + ": Observer named '" + getName() + "' has ObservableVa... | Observer extends Node { void invariantDependenciesBackLink( @Nonnull final String context ) { if ( Arez.shouldCheckInvariants() ) { getDependencies().forEach( observable -> invariant( () -> observable.getObservers().contains( this ), () -> "Arez-0090: " + context + ": Observer named '" + getName() + "' has ObservableVa... |
@Test public void invariantDependenciesNotDisposed() { final Observer observer = Arez.context().observer( new CountAndObserveProcedure() ); setCurrentTransaction( observer ); final ObservableValue<?> observableValue = Arez.context().observable(); observer.getDependencies().add( observableValue ); observableValue.addObs... | void invariantDependenciesNotDisposed() { if ( Arez.shouldCheckInvariants() ) { getDependencies().forEach( observable -> invariant( observable::isNotDisposed, () -> "Arez-0091: Observer named '" + getName() + "' has " + "ObservableValue dependency named '" + observable.getName() + "' which is disposed." ) ); invariantC... | Observer extends Node { void invariantDependenciesNotDisposed() { if ( Arez.shouldCheckInvariants() ) { getDependencies().forEach( observable -> invariant( observable::isNotDisposed, () -> "Arez-0091: Observer named '" + getName() + "' has " + "ObservableValue dependency named '" + observable.getName() + "' which is di... | Observer extends Node { void invariantDependenciesNotDisposed() { if ( Arez.shouldCheckInvariants() ) { getDependencies().forEach( observable -> invariant( observable::isNotDisposed, () -> "Arez-0091: Observer named '" + getName() + "' has " + "ObservableValue dependency named '" + observable.getName() + "' which is di... | Observer extends Node { void invariantDependenciesNotDisposed() { if ( Arez.shouldCheckInvariants() ) { getDependencies().forEach( observable -> invariant( observable::isNotDisposed, () -> "Arez-0091: Observer named '" + getName() + "' has " + "ObservableValue dependency named '" + observable.getName() + "' which is di... | Observer extends Node { void invariantDependenciesNotDisposed() { if ( Arez.shouldCheckInvariants() ) { getDependencies().forEach( observable -> invariant( observable::isNotDisposed, () -> "Arez-0091: Observer named '" + getName() + "' has " + "ObservableValue dependency named '" + observable.getName() + "' which is di... |
@Test public void invariantDependenciesUnique() { final ArezContext context = Arez.context(); final ObservableValue<Object> observable = context.observable(); final Observer observer = context.observer( observable::reportObserved ); observer.invariantDependenciesUnique( "TEST1" ); observer.getDependencies().add( observ... | void invariantDependenciesUnique( @Nonnull final String context ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getDependencies().size() == new HashSet<>( getDependencies() ).size(), () -> "Arez-0089: " + context + ": The set of dependencies in observer named '" + getName() + "' is not unique. Current list: ... | Observer extends Node { void invariantDependenciesUnique( @Nonnull final String context ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getDependencies().size() == new HashSet<>( getDependencies() ).size(), () -> "Arez-0089: " + context + ": The set of dependencies in observer named '" + getName() + "' is no... | Observer extends Node { void invariantDependenciesUnique( @Nonnull final String context ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getDependencies().size() == new HashSet<>( getDependencies() ).size(), () -> "Arez-0089: " + context + ": The set of dependencies in observer named '" + getName() + "' is no... | Observer extends Node { void invariantDependenciesUnique( @Nonnull final String context ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getDependencies().size() == new HashSet<>( getDependencies() ).size(), () -> "Arez-0089: " + context + ": The set of dependencies in observer named '" + getName() + "' is no... | Observer extends Node { void invariantDependenciesUnique( @Nonnull final String context ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getDependencies().size() == new HashSet<>( getDependencies() ).size(), () -> "Arez-0089: " + context + ": The set of dependencies in observer named '" + getName() + "' is no... |
@Test public void invariantState() { final ArezContext context = Arez.context(); final ObservableValue<Object> observable = context.observable(); final Observer observer = context.observer( new CountingProcedure(), Observer.Flags.RUN_LATER ); observer.invariantState(); observer.getDependencies().add( observable ); asse... | void invariantState() { if ( Arez.shouldCheckInvariants() ) { if ( isInactive() && !isDisposing() ) { invariant( () -> getDependencies().isEmpty(), () -> "Arez-0092: Observer named '" + getName() + "' is inactive but still has dependencies: " + getDependencies().stream().map( Node::getName ).collect( Collectors.toList(... | Observer extends Node { void invariantState() { if ( Arez.shouldCheckInvariants() ) { if ( isInactive() && !isDisposing() ) { invariant( () -> getDependencies().isEmpty(), () -> "Arez-0092: Observer named '" + getName() + "' is inactive but still has dependencies: " + getDependencies().stream().map( Node::getName ).col... | Observer extends Node { void invariantState() { if ( Arez.shouldCheckInvariants() ) { if ( isInactive() && !isDisposing() ) { invariant( () -> getDependencies().isEmpty(), () -> "Arez-0092: Observer named '" + getName() + "' is inactive but still has dependencies: " + getDependencies().stream().map( Node::getName ).col... | Observer extends Node { void invariantState() { if ( Arez.shouldCheckInvariants() ) { if ( isInactive() && !isDisposing() ) { invariant( () -> getDependencies().isEmpty(), () -> "Arez-0092: Observer named '" + getName() + "' is inactive but still has dependencies: " + getDependencies().stream().map( Node::getName ).col... | Observer extends Node { void invariantState() { if ( Arez.shouldCheckInvariants() ) { if ( isInactive() && !isDisposing() ) { invariant( () -> getDependencies().isEmpty(), () -> "Arez-0092: Observer named '" + getName() + "' is inactive but still has dependencies: " + getDependencies().stream().map( Node::getName ).col... |
@Test public void throwableToString_with_NestedThrowable() { final RuntimeException exception = new RuntimeException( "X", new IOException( "Y" ) ); final String text = ArezUtil.throwableToString( exception ); assertTrue( text.startsWith( "java.lang.RuntimeException: X\n" ) ); assertTrue( text.contains( "\nCaused by: j... | @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String throwableToString( @Nonnull final Throwable throwable ) { final StringBuilder sb = new StringBuilder(); Throwable t = throwable; while ( null != t ) { addCausedByPrefix( sb ); sb.append( t.toString() ); for ( final StackTraceElement element : t.getStack... | ArezUtil { @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String throwableToString( @Nonnull final Throwable throwable ) { final StringBuilder sb = new StringBuilder(); Throwable t = throwable; while ( null != t ) { addCausedByPrefix( sb ); sb.append( t.toString() ); for ( final StackTraceElement element :... | ArezUtil { @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String throwableToString( @Nonnull final Throwable throwable ) { final StringBuilder sb = new StringBuilder(); Throwable t = throwable; while ( null != t ) { addCausedByPrefix( sb ); sb.append( t.toString() ); for ( final StackTraceElement element :... | ArezUtil { @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String throwableToString( @Nonnull final Throwable throwable ) { final StringBuilder sb = new StringBuilder(); Throwable t = throwable; while ( null != t ) { addCausedByPrefix( sb ); sb.append( t.toString() ); for ( final StackTraceElement element :... | ArezUtil { @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String throwableToString( @Nonnull final Throwable throwable ) { final StringBuilder sb = new StringBuilder(); Throwable t = throwable; while ( null != t ) { addCausedByPrefix( sb ); sb.append( t.toString() ); for ( final StackTraceElement element :... |
@Test public void replaceDependencies() { final ArezContext context = Arez.context(); final ObservableValue<Object> observable = context.observable(); final Observer observer = context.observer( new CountingProcedure(), Observer.Flags.AREZ_OR_NO_DEPENDENCIES ); final List<ObservableValue<?>> originalDependencies = obse... | void replaceDependencies( @Nonnull final List<ObservableValue<?>> dependencies ) { if ( Arez.shouldCheckInvariants() ) { invariantDependenciesUnique( "Pre replaceDependencies" ); } _dependencies = Objects.requireNonNull( dependencies ); if ( Arez.shouldCheckInvariants() ) { invariantDependenciesUnique( "Post replaceDep... | Observer extends Node { void replaceDependencies( @Nonnull final List<ObservableValue<?>> dependencies ) { if ( Arez.shouldCheckInvariants() ) { invariantDependenciesUnique( "Pre replaceDependencies" ); } _dependencies = Objects.requireNonNull( dependencies ); if ( Arez.shouldCheckInvariants() ) { invariantDependencies... | Observer extends Node { void replaceDependencies( @Nonnull final List<ObservableValue<?>> dependencies ) { if ( Arez.shouldCheckInvariants() ) { invariantDependenciesUnique( "Pre replaceDependencies" ); } _dependencies = Objects.requireNonNull( dependencies ); if ( Arez.shouldCheckInvariants() ) { invariantDependencies... | Observer extends Node { void replaceDependencies( @Nonnull final List<ObservableValue<?>> dependencies ) { if ( Arez.shouldCheckInvariants() ) { invariantDependenciesUnique( "Pre replaceDependencies" ); } _dependencies = Objects.requireNonNull( dependencies ); if ( Arez.shouldCheckInvariants() ) { invariantDependencies... | Observer extends Node { void replaceDependencies( @Nonnull final List<ObservableValue<?>> dependencies ) { if ( Arez.shouldCheckInvariants() ) { invariantDependenciesUnique( "Pre replaceDependencies" ); } _dependencies = Objects.requireNonNull( dependencies ); if ( Arez.shouldCheckInvariants() ) { invariantDependencies... |
@Test public void clearDependencies() { final ArezContext context = Arez.context(); final ObservableValue<?> observableValue1 = context.observable(); final ObservableValue<?> observableValue2 = context.observable(); final Observer observer = context.observer( () -> { observableValue1.reportObserved(); observableValue2.... | void clearDependencies() { getDependencies().forEach( dependency -> { dependency.removeObserver( this ); if ( !dependency.hasObservers() ) { dependency.setLeastStaleObserverState( Flags.STATE_UP_TO_DATE ); } } ); getDependencies().clear(); } | Observer extends Node { void clearDependencies() { getDependencies().forEach( dependency -> { dependency.removeObserver( this ); if ( !dependency.hasObservers() ) { dependency.setLeastStaleObserverState( Flags.STATE_UP_TO_DATE ); } } ); getDependencies().clear(); } } | Observer extends Node { void clearDependencies() { getDependencies().forEach( dependency -> { dependency.removeObserver( this ); if ( !dependency.hasObservers() ) { dependency.setLeastStaleObserverState( Flags.STATE_UP_TO_DATE ); } } ); getDependencies().clear(); } Observer( @Nonnull final ComputableValue<?> computable... | Observer extends Node { void clearDependencies() { getDependencies().forEach( dependency -> { dependency.removeObserver( this ); if ( !dependency.hasObservers() ) { dependency.setLeastStaleObserverState( Flags.STATE_UP_TO_DATE ); } } ); getDependencies().clear(); } Observer( @Nonnull final ComputableValue<?> computable... | Observer extends Node { void clearDependencies() { getDependencies().forEach( dependency -> { dependency.removeObserver( this ); if ( !dependency.hasObservers() ) { dependency.setLeastStaleObserverState( Flags.STATE_UP_TO_DATE ); } } ); getDependencies().clear(); } Observer( @Nonnull final ComputableValue<?> computable... |
@Test public void setState() { final Observer observer = Arez.context().observer( new CountAndObserveProcedure() ); setupReadWriteTransaction(); observer.setState( Observer.Flags.STATE_INACTIVE ); assertEquals( observer.getState(), Observer.Flags.STATE_INACTIVE ); assertFalse( observer.getTask().isQueued() ); observer.... | void setState( final int state ) { setState( state, true ); } | Observer extends Node { void setState( final int state ) { setState( state, true ); } } | Observer extends Node { void setState( final int state ) { setState( state, true ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nu... | Observer extends Node { void setState( final int state ) { setState( state, true ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nu... | Observer extends Node { void setState( final int state ) { setState( state, true ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nu... |
@Test public void scheduleReaction() { final Observer observer = Arez.context().observer( new CountAndObserveProcedure() ); setupReadWriteTransaction(); observer.setState( Observer.Flags.STATE_UP_TO_DATE ); assertFalse( observer.getTask().isQueued() ); observer.scheduleReaction(); final ArezContext context = Arez.conte... | void scheduleReaction() { if ( isNotDisposed() ) { if ( Arez.shouldCheckInvariants() ) { invariant( this::isActive, () -> "Arez-0088: Observer named '" + getName() + "' is not active but an attempt has been made " + "to schedule observer." ); } if ( !getTask().isQueued() ) { getContext().scheduleReaction( this ); } } } | Observer extends Node { void scheduleReaction() { if ( isNotDisposed() ) { if ( Arez.shouldCheckInvariants() ) { invariant( this::isActive, () -> "Arez-0088: Observer named '" + getName() + "' is not active but an attempt has been made " + "to schedule observer." ); } if ( !getTask().isQueued() ) { getContext().schedul... | Observer extends Node { void scheduleReaction() { if ( isNotDisposed() ) { if ( Arez.shouldCheckInvariants() ) { invariant( this::isActive, () -> "Arez-0088: Observer named '" + getName() + "' is not active but an attempt has been made " + "to schedule observer." ); } if ( !getTask().isQueued() ) { getContext().schedul... | Observer extends Node { void scheduleReaction() { if ( isNotDisposed() ) { if ( Arez.shouldCheckInvariants() ) { invariant( this::isActive, () -> "Arez-0088: Observer named '" + getName() + "' is not active but an attempt has been made " + "to schedule observer." ); } if ( !getTask().isQueued() ) { getContext().schedul... | Observer extends Node { void scheduleReaction() { if ( isNotDisposed() ) { if ( Arez.shouldCheckInvariants() ) { invariant( this::isActive, () -> "Arez-0088: Observer named '" + getName() + "' is not active but an attempt has been made " + "to schedule observer." ); } if ( !getTask().isQueued() ) { getContext().schedul... |
@Test public void dispose() { final Observer observer = Arez.context().observer( new CountAndObserveProcedure() ); setCurrentTransaction( observer ); observer.setState( Observer.Flags.STATE_UP_TO_DATE ); Transaction.setTransaction( null ); assertEquals( observer.getState(), Observer.Flags.STATE_UP_TO_DATE ); assertTrue... | @Override public void dispose() { if ( isNotDisposedOrDisposing() ) { getContext().safeAction( Arez.areNamesEnabled() ? getName() + ".dispose" : null, this::performDispose, ActionFlags.NO_VERIFY_ACTION_REQUIRED ); if ( !isComputableValue() ) { if ( willPropagateSpyEvents() ) { reportSpyEvent( new ObserverDisposeEvent( ... | Observer extends Node { @Override public void dispose() { if ( isNotDisposedOrDisposing() ) { getContext().safeAction( Arez.areNamesEnabled() ? getName() + ".dispose" : null, this::performDispose, ActionFlags.NO_VERIFY_ACTION_REQUIRED ); if ( !isComputableValue() ) { if ( willPropagateSpyEvents() ) { reportSpyEvent( ne... | Observer extends Node { @Override public void dispose() { if ( isNotDisposedOrDisposing() ) { getContext().safeAction( Arez.areNamesEnabled() ? getName() + ".dispose" : null, this::performDispose, ActionFlags.NO_VERIFY_ACTION_REQUIRED ); if ( !isComputableValue() ) { if ( willPropagateSpyEvents() ) { reportSpyEvent( ne... | Observer extends Node { @Override public void dispose() { if ( isNotDisposedOrDisposing() ) { getContext().safeAction( Arez.areNamesEnabled() ? getName() + ".dispose" : null, this::performDispose, ActionFlags.NO_VERIFY_ACTION_REQUIRED ); if ( !isComputableValue() ) { if ( willPropagateSpyEvents() ) { reportSpyEvent( ne... | Observer extends Node { @Override public void dispose() { if ( isNotDisposedOrDisposing() ) { getContext().safeAction( Arez.areNamesEnabled() ? getName() + ".dispose" : null, this::performDispose, ActionFlags.NO_VERIFY_ACTION_REQUIRED ); if ( !isComputableValue() ) { if ( willPropagateSpyEvents() ) { reportSpyEvent( ne... |
@Test public void markDependenciesLeastStaleObserverAsUpToDate() { final Observer observer = Arez.context().observer( new CountAndObserveProcedure() ); final ObservableValue<?> observableValue1 = Arez.context().observable(); final ObservableValue<?> observableValue2 = Arez.context().observable(); final ObservableValue<... | void markDependenciesLeastStaleObserverAsUpToDate() { for ( final ObservableValue<?> dependency : getDependencies() ) { dependency.setLeastStaleObserverState( Flags.STATE_UP_TO_DATE ); } } | Observer extends Node { void markDependenciesLeastStaleObserverAsUpToDate() { for ( final ObservableValue<?> dependency : getDependencies() ) { dependency.setLeastStaleObserverState( Flags.STATE_UP_TO_DATE ); } } } | Observer extends Node { void markDependenciesLeastStaleObserverAsUpToDate() { for ( final ObservableValue<?> dependency : getDependencies() ) { dependency.setLeastStaleObserverState( Flags.STATE_UP_TO_DATE ); } } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final... | Observer extends Node { void markDependenciesLeastStaleObserverAsUpToDate() { for ( final ObservableValue<?> dependency : getDependencies() ) { dependency.setLeastStaleObserverState( Flags.STATE_UP_TO_DATE ); } } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final... | Observer extends Node { void markDependenciesLeastStaleObserverAsUpToDate() { for ( final ObservableValue<?> dependency : getDependencies() ) { dependency.setLeastStaleObserverState( Flags.STATE_UP_TO_DATE ); } } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final... |
@Test public void invokeReaction() { ignoreObserverErrors(); final ArezContext context = Arez.context(); final AtomicInteger errorCount = new AtomicInteger(); context.addObserverErrorHandler( ( observer, error, throwable ) -> errorCount.incrementAndGet() ); final CountAndObserveProcedure observed = new CountAndObserveP... | void invokeReaction() { if ( isNotDisposed() ) { final long start; if ( willPropagateSpyEvents() ) { start = System.currentTimeMillis(); if ( isComputableValue() ) { reportSpyEvent( new ComputeStartEvent( getComputableValue().asInfo() ) ); } else { reportSpyEvent( new ObserveStartEvent( asInfo() ) ); } } else { start =... | Observer extends Node { void invokeReaction() { if ( isNotDisposed() ) { final long start; if ( willPropagateSpyEvents() ) { start = System.currentTimeMillis(); if ( isComputableValue() ) { reportSpyEvent( new ComputeStartEvent( getComputableValue().asInfo() ) ); } else { reportSpyEvent( new ObserveStartEvent( asInfo()... | Observer extends Node { void invokeReaction() { if ( isNotDisposed() ) { final long start; if ( willPropagateSpyEvents() ) { start = System.currentTimeMillis(); if ( isComputableValue() ) { reportSpyEvent( new ComputeStartEvent( getComputableValue().asInfo() ) ); } else { reportSpyEvent( new ObserveStartEvent( asInfo()... | Observer extends Node { void invokeReaction() { if ( isNotDisposed() ) { final long start; if ( willPropagateSpyEvents() ) { start = System.currentTimeMillis(); if ( isComputableValue() ) { reportSpyEvent( new ComputeStartEvent( getComputableValue().asInfo() ) ); } else { reportSpyEvent( new ObserveStartEvent( asInfo()... | Observer extends Node { void invokeReaction() { if ( isNotDisposed() ) { final long start; if ( willPropagateSpyEvents() ) { start = System.currentTimeMillis(); if ( isComputableValue() ) { reportSpyEvent( new ComputeStartEvent( getComputableValue().asInfo() ) ); } else { reportSpyEvent( new ObserveStartEvent( asInfo()... |
@Test public void invokeReaction_reactionGeneratesError() { ignoreObserverErrors(); final AtomicInteger errorCount = new AtomicInteger(); final RuntimeException exception = new RuntimeException( "X" ); final ArezContext context = Arez.context(); context.addObserverErrorHandler( ( observer, error, throwable ) -> { error... | Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ) { this( Arez.areZonesEnabled() ? computableValue.getContext() : null, null, Arez.areNamesEnabled() ? computableValue.getName() : null, computableValue, computableValue::compute, null, flags | ( Flags.KEEPALIVE == Flags.getScheduleType( flags... | Observer extends Node { Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ) { this( Arez.areZonesEnabled() ? computableValue.getContext() : null, null, Arez.areNamesEnabled() ? computableValue.getName() : null, computableValue, computableValue::compute, null, flags | ( Flags.KEEPALIVE == Flag... | Observer extends Node { Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ) { this( Arez.areZonesEnabled() ? computableValue.getContext() : null, null, Arez.areNamesEnabled() ? computableValue.getName() : null, computableValue, computableValue::compute, null, flags | ( Flags.KEEPALIVE == Flag... | Observer extends Node { Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ) { this( Arez.areZonesEnabled() ? computableValue.getContext() : null, null, Arez.areNamesEnabled() ? computableValue.getName() : null, computableValue, computableValue::compute, null, flags | ( Flags.KEEPALIVE == Flag... | Observer extends Node { Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ) { this( Arez.areZonesEnabled() ? computableValue.getContext() : null, null, Arez.areNamesEnabled() ? computableValue.getName() : null, computableValue, computableValue::compute, null, flags | ( Flags.KEEPALIVE == Flag... |
@Test public void asInfo() { final Observer observer = Arez.context().tracker( ValueUtil::randomString ); final ObserverInfo info = observer.asInfo(); assertEquals( info.getName(), observer.getName() ); } | @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ObserverInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0197: Observer.asInfo() invoked but Arez.areSpiesEnabled() returned false." ); } if ( Arez.areSpiesEnabled() && null ... | Observer extends Node { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ObserverInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0197: Observer.asInfo() invoked but Arez.areSpiesEnabled() returned false." ); } if ( Arez.ar... | Observer extends Node { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ObserverInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0197: Observer.asInfo() invoked but Arez.areSpiesEnabled() returned false." ); } if ( Arez.ar... | Observer extends Node { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ObserverInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0197: Observer.asInfo() invoked but Arez.areSpiesEnabled() returned false." ); } if ( Arez.ar... | Observer extends Node { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ObserverInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0197: Observer.asInfo() invoked but Arez.areSpiesEnabled() returned false." ); } if ( Arez.ar... |
@Test public void reportStale() { final ArezContext context = Arez.context(); final Observer observer = new Observer( context, null, ValueUtil.randomString(), new CountingProcedure(), new CountingProcedure(), Observer.Flags.AREZ_OR_EXTERNAL_DEPENDENCIES ); context.triggerScheduler(); assertEquals( observer.getState(), ... | public void reportStale() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::areExternalDependenciesAllowed, () -> "Arez-0199: Observer.reportStale() invoked on observer named '" + getName() + "' but the observer has not specified AREZ_OR_EXTERNAL_DEPENDENCIES flag." ); apiInvariant( () -> getContext().isTr... | Observer extends Node { public void reportStale() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::areExternalDependenciesAllowed, () -> "Arez-0199: Observer.reportStale() invoked on observer named '" + getName() + "' but the observer has not specified AREZ_OR_EXTERNAL_DEPENDENCIES flag." ); apiInvariant(... | Observer extends Node { public void reportStale() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::areExternalDependenciesAllowed, () -> "Arez-0199: Observer.reportStale() invoked on observer named '" + getName() + "' but the observer has not specified AREZ_OR_EXTERNAL_DEPENDENCIES flag." ); apiInvariant(... | Observer extends Node { public void reportStale() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::areExternalDependenciesAllowed, () -> "Arez-0199: Observer.reportStale() invoked on observer named '" + getName() + "' but the observer has not specified AREZ_OR_EXTERNAL_DEPENDENCIES flag." ); apiInvariant(... | Observer extends Node { public void reportStale() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::areExternalDependenciesAllowed, () -> "Arez-0199: Observer.reportStale() invoked on observer named '" + getName() + "' but the observer has not specified AREZ_OR_EXTERNAL_DEPENDENCIES flag." ); apiInvariant(... |
@Test public void isScheduled() { final ArezContext context = Arez.context(); final Spy spy = context.getSpy(); final Observer observer = context.observer( new CountAndObserveProcedure() ); final ObserverInfo info = spy.asObserverInfo( observer ); assertFalse( info.isScheduled() ); observer.getTask().markAsQueued(); as... | @Override public boolean isScheduled() { return _observer.getTask().isQueued(); } | ObserverInfoImpl implements ObserverInfo { @Override public boolean isScheduled() { return _observer.getTask().isQueued(); } } | ObserverInfoImpl implements ObserverInfo { @Override public boolean isScheduled() { return _observer.getTask().isQueued(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); } | ObserverInfoImpl implements ObserverInfo { @Override public boolean isScheduled() { return _observer.getTask().isQueued(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Override boolean isRunning(); @Override boolean i... | ObserverInfoImpl implements ObserverInfo { @Override public boolean isScheduled() { return _observer.getTask().isQueued(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Override boolean isRunning(); @Override boolean i... |
@Test public void schedule() { final ArezContext context = Arez.context(); final CountAndObserveProcedure observed = new CountAndObserveProcedure(); final CountingProcedure onDepsChange = new CountingProcedure(); final Observer observer = new Observer( context, null, ValueUtil.randomString(), observed, onDepsChange, Ob... | public void schedule() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::supportsManualSchedule, () -> "Arez-0202: Observer.schedule() invoked on observer named '" + getName() + "' but supportsManualSchedule() returns false." ); } if ( Arez.shouldEnforceTransactionType() && getContext().isTransactionActive... | Observer extends Node { public void schedule() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::supportsManualSchedule, () -> "Arez-0202: Observer.schedule() invoked on observer named '" + getName() + "' but supportsManualSchedule() returns false." ); } if ( Arez.shouldEnforceTransactionType() && getConte... | Observer extends Node { public void schedule() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::supportsManualSchedule, () -> "Arez-0202: Observer.schedule() invoked on observer named '" + getName() + "' but supportsManualSchedule() returns false." ); } if ( Arez.shouldEnforceTransactionType() && getConte... | Observer extends Node { public void schedule() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::supportsManualSchedule, () -> "Arez-0202: Observer.schedule() invoked on observer named '" + getName() + "' but supportsManualSchedule() returns false." ); } if ( Arez.shouldEnforceTransactionType() && getConte... | Observer extends Node { public void schedule() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::supportsManualSchedule, () -> "Arez-0202: Observer.schedule() invoked on observer named '" + getName() + "' but supportsManualSchedule() returns false." ); } if ( Arez.shouldEnforceTransactionType() && getConte... |
@Test public void Flags_isActive() { assertFalse( Observer.Flags.isActive( Observer.Flags.STATE_DISPOSED ) ); assertFalse( Observer.Flags.isActive( Observer.Flags.STATE_DISPOSING ) ); assertFalse( Observer.Flags.isActive( Observer.Flags.STATE_INACTIVE ) ); assertTrue( Observer.Flags.isActive( Observer.Flags.STATE_UP_TO... | boolean isActive() { return Flags.isActive( _flags ); } | Observer extends Node { boolean isActive() { return Flags.isActive( _flags ); } } | Observer extends Node { boolean isActive() { return Flags.isActive( _flags ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable... | Observer extends Node { boolean isActive() { return Flags.isActive( _flags ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable... | Observer extends Node { boolean isActive() { return Flags.isActive( _flags ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable... |
@Test public void Flags_getState() { assertEquals( Observer.Flags.getState( Observer.Flags.PRIORITY_NORMAL | Observer.Flags.STATE_DISPOSED ), Observer.Flags.STATE_DISPOSED ); assertEquals( Observer.Flags.getState( Observer.Flags.PRIORITY_NORMAL | Observer.Flags.STATE_DISPOSING ), Observer.Flags.STATE_DISPOSING ); asser... | int getState() { return Flags.getState( _flags ); } | Observer extends Node { int getState() { return Flags.getState( _flags ); } } | Observer extends Node { int getState() { return Flags.getState( _flags ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable fin... | Observer extends Node { int getState() { return Flags.getState( _flags ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable fin... | Observer extends Node { int getState() { return Flags.getState( _flags ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nullable fin... |
@Test public void Flags_setState() { assertEquals( Observer.Flags.setState( Observer.Flags.PRIORITY_NORMAL | Observer.Flags.READ_WRITE | Observer.Flags.STATE_UP_TO_DATE, Observer.Flags.STATE_DISPOSED ), Observer.Flags.PRIORITY_NORMAL | Observer.Flags.READ_WRITE | Observer.Flags.STATE_DISPOSED ); assertEquals( Observer.... | void setState( final int state ) { setState( state, true ); } | Observer extends Node { void setState( final int state ) { setState( state, true ); } } | Observer extends Node { void setState( final int state ) { setState( state, true ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nu... | Observer extends Node { void setState( final int state ) { setState( state, true ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nu... | Observer extends Node { void setState( final int state ) { setState( state, true ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final String name,
@Nu... |
@Test public void Flags_getLeastStaleObserverState() { assertEquals( Observer.Flags.getLeastStaleObserverState( Observer.Flags.PRIORITY_NORMAL | Observer.Flags.STATE_DISPOSED ), Observer.Flags.STATE_UP_TO_DATE ); assertEquals( Observer.Flags.getLeastStaleObserverState( Observer.Flags.PRIORITY_NORMAL | Observer.Flags.ST... | int getLeastStaleObserverState() { return Flags.getLeastStaleObserverState( _flags ); } | Observer extends Node { int getLeastStaleObserverState() { return Flags.getLeastStaleObserverState( _flags ); } } | Observer extends Node { int getLeastStaleObserverState() { return Flags.getLeastStaleObserverState( _flags ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final St... | Observer extends Node { int getLeastStaleObserverState() { return Flags.getLeastStaleObserverState( _flags ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final St... | Observer extends Node { int getLeastStaleObserverState() { return Flags.getLeastStaleObserverState( _flags ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context,
@Nullable final Component component,
@Nullable final St... |
@Test public void log() { final String message1 = ValueUtil.randomString(); final String message2 = ValueUtil.randomString(); ArezLogger.log( message1, null ); final Throwable throwable = new Throwable(); ArezLogger.log( message2, throwable ); final List<TestLogger.LogEntry> entries = getTestLogger().getEntries(); asse... | static void log( @Nonnull final String message, @Nullable final Throwable throwable ) { c_logger.log( message, throwable ); } | ArezLogger { static void log( @Nonnull final String message, @Nullable final Throwable throwable ) { c_logger.log( message, throwable ); } } | ArezLogger { static void log( @Nonnull final String message, @Nullable final Throwable throwable ) { c_logger.log( message, throwable ); } private ArezLogger(); } | ArezLogger { static void log( @Nonnull final String message, @Nullable final Throwable throwable ) { c_logger.log( message, throwable ); } private ArezLogger(); } | ArezLogger { static void log( @Nonnull final String message, @Nullable final Throwable throwable ) { c_logger.log( message, throwable ); } private ArezLogger(); } |
@Test public void toString_NamesDisabled() { ArezTestUtil.disableNames(); final NoSuchEntityException exception = new NoSuchEntityException( 23 ); assertEquals( exception.toString(), "arez.component.NoSuchEntityException" ); } | @Override public String toString() { if ( Arez.areNamesEnabled() ) { return "NoSuchEntityException[id=" + _id + ']'; } else { return super.toString(); } } | NoSuchEntityException extends NoResultException { @Override public String toString() { if ( Arez.areNamesEnabled() ) { return "NoSuchEntityException[id=" + _id + ']'; } else { return super.toString(); } } } | NoSuchEntityException extends NoResultException { @Override public String toString() { if ( Arez.areNamesEnabled() ) { return "NoSuchEntityException[id=" + _id + ']'; } else { return super.toString(); } } NoSuchEntityException( @Nonnull final Object id ); } | NoSuchEntityException extends NoResultException { @Override public String toString() { if ( Arez.areNamesEnabled() ) { return "NoSuchEntityException[id=" + _id + ']'; } else { return super.toString(); } } NoSuchEntityException( @Nonnull final Object id ); @Nonnull Object getId(); @Override String toString(); } | NoSuchEntityException extends NoResultException { @Override public String toString() { if ( Arez.areNamesEnabled() ) { return "NoSuchEntityException[id=" + _id + ']'; } else { return super.toString(); } } NoSuchEntityException( @Nonnull final Object id ); @Nonnull Object getId(); @Override String toString(); } |
@Test public void registerLookup_duplicate() { final TypeBasedLocator locator = new TypeBasedLocator(); locator.registerLookup( A.class, i -> new A() ); assertInvariantFailure( () -> locator.registerLookup( A.class, i -> new A() ), "Arez-0188: Attempting to register lookup function for type class arez.component.TypeBas... | public <T> void registerLookup( @Nonnull final Class<T> type, @Nonnull final Function<Object, T> findByIdFunction ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> !_findByIdFunctions.containsKey( type ), () -> "Arez-0188: Attempting to register lookup function for type " + type + " when a function for t... | TypeBasedLocator implements Locator { public <T> void registerLookup( @Nonnull final Class<T> type, @Nonnull final Function<Object, T> findByIdFunction ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> !_findByIdFunctions.containsKey( type ), () -> "Arez-0188: Attempting to register lookup function for t... | TypeBasedLocator implements Locator { public <T> void registerLookup( @Nonnull final Class<T> type, @Nonnull final Function<Object, T> findByIdFunction ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> !_findByIdFunctions.containsKey( type ), () -> "Arez-0188: Attempting to register lookup function for t... | TypeBasedLocator implements Locator { public <T> void registerLookup( @Nonnull final Class<T> type, @Nonnull final Function<Object, T> findByIdFunction ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> !_findByIdFunctions.containsKey( type ), () -> "Arez-0188: Attempting to register lookup function for t... | TypeBasedLocator implements Locator { public <T> void registerLookup( @Nonnull final Class<T> type, @Nonnull final Function<Object, T> findByIdFunction ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> !_findByIdFunctions.containsKey( type ), () -> "Arez-0188: Attempting to register lookup function for t... |
@Test public void wrap_when_areRepositoryResultsModifiable_isTrue() { final ArrayList<MyEntity> input = new ArrayList<>(); final MyEntity entity = new MyEntity(); input.add( entity ); final List<MyEntity> output = CollectionsUtil.wrap( input ); assertNotSame( output, input ); assertUnmodifiable( output, MyEntity::new )... | @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); @Nonnull static Collection<T> wrap( @Nonnull final Collection<T> ... | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); @Nonnull static Collection<T> wrap( @Nonnull final Collection<T> ... |
@Test public void wrap_List_when_areRepositoryResultsModifiable_isFalse() { final List<MyEntity> input = new ArrayList<>(); final MyEntity entity = new MyEntity(); input.add( entity ); ArezTestUtil.makeCollectionPropertiesModifiable(); final Collection<MyEntity> output = CollectionsUtil.wrap( input ); assertCollectionM... | @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); @Nonnull static Collection<T> wrap( @Nonnull final Collection<T> ... | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); @Nonnull static Collection<T> wrap( @Nonnull final Collection<T> ... |
@Test public void isRunning() { final ArezContext context = Arez.context(); final AtomicInteger callCount = new AtomicInteger(); final AtomicReference<ObserverInfo> ref = new AtomicReference<>(); final Observer observer = context.observer( () -> { assertTrue( ref.get().isRunning() ); callCount.incrementAndGet(); observ... | @Override public boolean isRunning() { return _spy.isTransactionActive() && null != getTrackerTransaction(); } | ObserverInfoImpl implements ObserverInfo { @Override public boolean isRunning() { return _spy.isTransactionActive() && null != getTrackerTransaction(); } } | ObserverInfoImpl implements ObserverInfo { @Override public boolean isRunning() { return _spy.isTransactionActive() && null != getTrackerTransaction(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); } | ObserverInfoImpl implements ObserverInfo { @Override public boolean isRunning() { return _spy.isTransactionActive() && null != getTrackerTransaction(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Override boolean isR... | ObserverInfoImpl implements ObserverInfo { @Override public boolean isRunning() { return _spy.isTransactionActive() && null != getTrackerTransaction(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Override boolean isR... |
@Test public void wrap_Set_when_areRepositoryResultsModifiable_isFalse() { final Set<MyEntity> input = new HashSet<>(); final MyEntity entity = new MyEntity(); input.add( entity ); ArezTestUtil.makeCollectionPropertiesModifiable(); final Collection<MyEntity> output = CollectionsUtil.wrap( input ); assertCollectionModif... | @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); @Nonnull static Collection<T> wrap( @Nonnull final Collection<T> ... | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); @Nonnull static Collection<T> wrap( @Nonnull final Collection<T> ... |
@Test public void wrap_Collection_when_areRepositoryResultsModifiable_isFalse() { final Collection<MyEntity> input = new HashSet<>(); final MyEntity entity = new MyEntity(); input.add( entity ); ArezTestUtil.makeCollectionPropertiesModifiable(); final Collection<MyEntity> output = CollectionsUtil.wrap( input ); assertC... | @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); @Nonnull static Collection<T> wrap( @Nonnull final Collection<T> ... | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); @Nonnull static Collection<T> wrap( @Nonnull final Collection<T> ... |
@Test public void wrap_Map_when_areRepositoryResultsModifiable_isFalse() { final Map<String, MyEntity> input = new HashMap<>(); final MyEntity entity = new MyEntity(); input.put( ValueUtil.randomString(), entity ); ArezTestUtil.makeCollectionPropertiesModifiable(); final Map<String, MyEntity> output = CollectionsUtil.w... | @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); } | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); @Nonnull static Collection<T> wrap( @Nonnull final Collection<T> ... | CollectionsUtil { @Nonnull public static <T> Collection<T> wrap( @Nonnull final Collection<T> collection ) { return Arez.areCollectionsPropertiesUnmodifiable() ? Collections.unmodifiableCollection( collection ) : collection; } private CollectionsUtil(); @Nonnull static Collection<T> wrap( @Nonnull final Collection<T> ... |
@Test public void asList() { final ArrayList<MyEntity> input = new ArrayList<>(); final MyEntity entity = new MyEntity(); input.add( entity ); final List<MyEntity> output = CollectionsUtil.asList( input.stream() ); assertUnmodifiable( output, MyEntity::new ); assertEquals( output.size(), 1 ); assertEquals( output.get( ... | @Nonnull public static <T> List<T> asList( @Nonnull final Stream<T> stream ) { return wrap( stream.collect( Collectors.toList() ) ); } | CollectionsUtil { @Nonnull public static <T> List<T> asList( @Nonnull final Stream<T> stream ) { return wrap( stream.collect( Collectors.toList() ) ); } } | CollectionsUtil { @Nonnull public static <T> List<T> asList( @Nonnull final Stream<T> stream ) { return wrap( stream.collect( Collectors.toList() ) ); } private CollectionsUtil(); } | CollectionsUtil { @Nonnull public static <T> List<T> asList( @Nonnull final Stream<T> stream ) { return wrap( stream.collect( Collectors.toList() ) ); } private CollectionsUtil(); @Nonnull static Collection<T> wrap( @Nonnull final Collection<T> collection ); @Nonnull static Set<T> wrap( @Nonnull final Set<T> set ); @N... | CollectionsUtil { @Nonnull public static <T> List<T> asList( @Nonnull final Stream<T> stream ) { return wrap( stream.collect( Collectors.toList() ) ); } private CollectionsUtil(); @Nonnull static Collection<T> wrap( @Nonnull final Collection<T> collection ); @Nonnull static Set<T> wrap( @Nonnull final Set<T> set ); @N... |
@Test public void disposeComputableValue_passedBadArgCounts() { final MemoizeCache<String> cache = new MemoizeCache<>( null, null, ValueUtil.randomString(), args -> args[ 0 ] + "." + args[ 1 ], 2 ); assertInvariantFailure( () -> cache.disposeComputableValue( "a" ), "Arez-0163: MemoizeCache.disposeComputableValue called... | @SuppressWarnings( "unchecked" ) void disposeComputableValue( @Nonnull final Object... args ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> args.length == _argCount, () -> "Arez-0163: MemoizeCache.disposeComputableValue called with " + args.length + " argument(s) but expected " + _argCount + " argument(s)." ... | MemoizeCache implements Disposable { @SuppressWarnings( "unchecked" ) void disposeComputableValue( @Nonnull final Object... args ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> args.length == _argCount, () -> "Arez-0163: MemoizeCache.disposeComputableValue called with " + args.length + " argument(s) but expe... | MemoizeCache implements Disposable { @SuppressWarnings( "unchecked" ) void disposeComputableValue( @Nonnull final Object... args ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> args.length == _argCount, () -> "Arez-0163: MemoizeCache.disposeComputableValue called with " + args.length + " argument(s) but expe... | MemoizeCache implements Disposable { @SuppressWarnings( "unchecked" ) void disposeComputableValue( @Nonnull final Object... args ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> args.length == _argCount, () -> "Arez-0163: MemoizeCache.disposeComputableValue called with " + args.length + " argument(s) but expe... | MemoizeCache implements Disposable { @SuppressWarnings( "unchecked" ) void disposeComputableValue( @Nonnull final Object... args ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> args.length == _argCount, () -> "Arez-0163: MemoizeCache.disposeComputableValue called with " + args.length + " argument(s) but expe... |
@Test public void disposeComputableValue_noComputableValueCachedForArgs() { final MemoizeCache<String> cache = new MemoizeCache<>( null, null, ValueUtil.randomString(), args -> args[ 0 ] + "." + args[ 1 ], 1 ); assertInvariantFailure( () -> cache.disposeComputableValue( "a" ), "Arez-0193: MemoizeCache.disposeComputable... | @SuppressWarnings( "unchecked" ) void disposeComputableValue( @Nonnull final Object... args ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> args.length == _argCount, () -> "Arez-0163: MemoizeCache.disposeComputableValue called with " + args.length + " argument(s) but expected " + _argCount + " argument(s)." ... | MemoizeCache implements Disposable { @SuppressWarnings( "unchecked" ) void disposeComputableValue( @Nonnull final Object... args ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> args.length == _argCount, () -> "Arez-0163: MemoizeCache.disposeComputableValue called with " + args.length + " argument(s) but expe... | MemoizeCache implements Disposable { @SuppressWarnings( "unchecked" ) void disposeComputableValue( @Nonnull final Object... args ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> args.length == _argCount, () -> "Arez-0163: MemoizeCache.disposeComputableValue called with " + args.length + " argument(s) but expe... | MemoizeCache implements Disposable { @SuppressWarnings( "unchecked" ) void disposeComputableValue( @Nonnull final Object... args ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> args.length == _argCount, () -> "Arez-0163: MemoizeCache.disposeComputableValue called with " + args.length + " argument(s) but expe... | MemoizeCache implements Disposable { @SuppressWarnings( "unchecked" ) void disposeComputableValue( @Nonnull final Object... args ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> args.length == _argCount, () -> "Arez-0163: MemoizeCache.disposeComputableValue called with " + args.length + " argument(s) but expe... |
@Test public void get_passedBadArgCounts() { final MemoizeCache<String> cache = new MemoizeCache<>( null, null, ValueUtil.randomString(), args -> args[ 0 ] + "." + args[ 1 ], 2 ); assertInvariantFailure( () -> cache.get( "a" ), "Arez-0162: MemoizeCache.getComputableValue called with 1 arguments but expected 2 arguments... | public T get( @Nonnull final Object... args ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::isNotDisposed, () -> "Arez-0161: MemoizeCache named '" + _name + "' had get() invoked when disposed." ); } return getComputableValue( args ).get(); } | MemoizeCache implements Disposable { public T get( @Nonnull final Object... args ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::isNotDisposed, () -> "Arez-0161: MemoizeCache named '" + _name + "' had get() invoked when disposed." ); } return getComputableValue( args ).get(); } } | MemoizeCache implements Disposable { public T get( @Nonnull final Object... args ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::isNotDisposed, () -> "Arez-0161: MemoizeCache named '" + _name + "' had get() invoked when disposed." ); } return getComputableValue( args ).get(); } MemoizeCache( @Nullable ... | MemoizeCache implements Disposable { public T get( @Nonnull final Object... args ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::isNotDisposed, () -> "Arez-0161: MemoizeCache named '" + _name + "' had get() invoked when disposed." ); } return getComputableValue( args ).get(); } MemoizeCache( @Nullable ... | MemoizeCache implements Disposable { public T get( @Nonnull final Object... args ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::isNotDisposed, () -> "Arez-0161: MemoizeCache named '" + _name + "' had get() invoked when disposed." ); } return getComputableValue( args ).get(); } MemoizeCache( @Nullable ... |
@Test public void observe() { ArezTestUtil.disableNativeComponents(); final ArezContext context = Arez.context(); final String name = ValueUtil.randomString(); final ComponentKernel kernel = new ComponentKernel( context, name, 0, null, null, null, null, false, true, false ); kernel.componentConstructed(); kernel.compon... | @Override public boolean observe() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> null != _disposeOnDeactivate || null != _componentObservable, () -> "Arez-0221: ComponentKernel.observe() invoked on component named '" + getName() + "' but observing is not enabled for component." ); } if ( null != _dispo... | ComponentKernel implements Disposable, ComponentObservable { @Override public boolean observe() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> null != _disposeOnDeactivate || null != _componentObservable, () -> "Arez-0221: ComponentKernel.observe() invoked on component named '" + getName() + "' but obse... | ComponentKernel implements Disposable, ComponentObservable { @Override public boolean observe() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> null != _disposeOnDeactivate || null != _componentObservable, () -> "Arez-0221: ComponentKernel.observe() invoked on component named '" + getName() + "' but obse... | ComponentKernel implements Disposable, ComponentObservable { @Override public boolean observe() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> null != _disposeOnDeactivate || null != _componentObservable, () -> "Arez-0221: ComponentKernel.observe() invoked on component named '" + getName() + "' but obse... | ComponentKernel implements Disposable, ComponentObservable { @Override public boolean observe() { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> null != _disposeOnDeactivate || null != _componentObservable, () -> "Arez-0221: ComponentKernel.observe() invoked on component named '" + getName() + "' but obse... |
@Test public void addOnDisposeListener() { final ArezContext context = Arez.context(); final ComponentKernel kernel = new ComponentKernel( context, "MyType", 1, context.component( "MyType", 1 ), null, null, null, true, false, false ); final String key = ValueUtil.randomString(); final AtomicInteger callCount = new Atom... | public void addOnDisposeListener( @Nonnull final Object key, @Nonnull final SafeProcedure action ) { assert null != _onDisposeListeners; if ( Arez.shouldCheckApiInvariants() ) { invariant( this::isNotDisposed, () -> "Arez-0170: Attempting to add OnDispose listener but ComponentKernel has been disposed." ); invariant( (... | ComponentKernel implements Disposable, ComponentObservable { public void addOnDisposeListener( @Nonnull final Object key, @Nonnull final SafeProcedure action ) { assert null != _onDisposeListeners; if ( Arez.shouldCheckApiInvariants() ) { invariant( this::isNotDisposed, () -> "Arez-0170: Attempting to add OnDispose lis... | ComponentKernel implements Disposable, ComponentObservable { public void addOnDisposeListener( @Nonnull final Object key, @Nonnull final SafeProcedure action ) { assert null != _onDisposeListeners; if ( Arez.shouldCheckApiInvariants() ) { invariant( this::isNotDisposed, () -> "Arez-0170: Attempting to add OnDispose lis... | ComponentKernel implements Disposable, ComponentObservable { public void addOnDisposeListener( @Nonnull final Object key, @Nonnull final SafeProcedure action ) { assert null != _onDisposeListeners; if ( Arez.shouldCheckApiInvariants() ) { invariant( this::isNotDisposed, () -> "Arez-0170: Attempting to add OnDispose lis... | ComponentKernel implements Disposable, ComponentObservable { public void addOnDisposeListener( @Nonnull final Object key, @Nonnull final SafeProcedure action ) { assert null != _onDisposeListeners; if ( Arez.shouldCheckApiInvariants() ) { invariant( this::isNotDisposed, () -> "Arez-0170: Attempting to add OnDispose lis... |
@Test public void addOnDisposeListener_duplicate() { final ArezContext context = Arez.context(); final ComponentKernel kernel = new ComponentKernel( context, "MyType", 1, context.component( "MyType", 1 ), null, null, null, true, false, false ); final String key = ValueUtil.randomString(); final AtomicInteger callCount ... | public void addOnDisposeListener( @Nonnull final Object key, @Nonnull final SafeProcedure action ) { assert null != _onDisposeListeners; if ( Arez.shouldCheckApiInvariants() ) { invariant( this::isNotDisposed, () -> "Arez-0170: Attempting to add OnDispose listener but ComponentKernel has been disposed." ); invariant( (... | ComponentKernel implements Disposable, ComponentObservable { public void addOnDisposeListener( @Nonnull final Object key, @Nonnull final SafeProcedure action ) { assert null != _onDisposeListeners; if ( Arez.shouldCheckApiInvariants() ) { invariant( this::isNotDisposed, () -> "Arez-0170: Attempting to add OnDispose lis... | ComponentKernel implements Disposable, ComponentObservable { public void addOnDisposeListener( @Nonnull final Object key, @Nonnull final SafeProcedure action ) { assert null != _onDisposeListeners; if ( Arez.shouldCheckApiInvariants() ) { invariant( this::isNotDisposed, () -> "Arez-0170: Attempting to add OnDispose lis... | ComponentKernel implements Disposable, ComponentObservable { public void addOnDisposeListener( @Nonnull final Object key, @Nonnull final SafeProcedure action ) { assert null != _onDisposeListeners; if ( Arez.shouldCheckApiInvariants() ) { invariant( this::isNotDisposed, () -> "Arez-0170: Attempting to add OnDispose lis... | ComponentKernel implements Disposable, ComponentObservable { public void addOnDisposeListener( @Nonnull final Object key, @Nonnull final SafeProcedure action ) { assert null != _onDisposeListeners; if ( Arez.shouldCheckApiInvariants() ) { invariant( this::isNotDisposed, () -> "Arez-0170: Attempting to add OnDispose lis... |
@Test public void isReadOnly_on_READ_WRITE_observer() { final ArezContext context = Arez.context(); final ObservableValue<Object> observableValue = context.observable(); final Observer observer = context.observer( observableValue::reportObserved, Observer.Flags.READ_WRITE ); assertFalse( observer.asInfo().isReadOnly() ... | @Override public boolean isReadOnly() { return Arez.shouldEnforceTransactionType() && !_observer.isMutation(); } | ObserverInfoImpl implements ObserverInfo { @Override public boolean isReadOnly() { return Arez.shouldEnforceTransactionType() && !_observer.isMutation(); } } | ObserverInfoImpl implements ObserverInfo { @Override public boolean isReadOnly() { return Arez.shouldEnforceTransactionType() && !_observer.isMutation(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); } | ObserverInfoImpl implements ObserverInfo { @Override public boolean isReadOnly() { return Arez.shouldEnforceTransactionType() && !_observer.isMutation(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Override boolean i... | ObserverInfoImpl implements ObserverInfo { @Override public boolean isReadOnly() { return Arez.shouldEnforceTransactionType() && !_observer.isMutation(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Override boolean i... |
@Test public void removeOnDisposeListener() { final ArezContext context = Arez.context(); final ComponentKernel kernel = new ComponentKernel( context, "MyType", 1, context.component( "MyType", 1 ), null, null, null, true, false, false ); final String key = ValueUtil.randomString(); final AtomicInteger callCount = new A... | public void removeOnDisposeListener( @Nonnull final Object key ) { assert null != _onDisposeListeners; final SafeProcedure removed = _onDisposeListeners.remove( key ); if ( Arez.shouldCheckApiInvariants() ) { invariant( () -> null != removed, () -> "Arez-0167: Attempting to remove OnDispose listener with key '" + key +... | ComponentKernel implements Disposable, ComponentObservable { public void removeOnDisposeListener( @Nonnull final Object key ) { assert null != _onDisposeListeners; final SafeProcedure removed = _onDisposeListeners.remove( key ); if ( Arez.shouldCheckApiInvariants() ) { invariant( () -> null != removed, () -> "Arez-0167... | ComponentKernel implements Disposable, ComponentObservable { public void removeOnDisposeListener( @Nonnull final Object key ) { assert null != _onDisposeListeners; final SafeProcedure removed = _onDisposeListeners.remove( key ); if ( Arez.shouldCheckApiInvariants() ) { invariant( () -> null != removed, () -> "Arez-0167... | ComponentKernel implements Disposable, ComponentObservable { public void removeOnDisposeListener( @Nonnull final Object key ) { assert null != _onDisposeListeners; final SafeProcedure removed = _onDisposeListeners.remove( key ); if ( Arez.shouldCheckApiInvariants() ) { invariant( () -> null != removed, () -> "Arez-0167... | ComponentKernel implements Disposable, ComponentObservable { public void removeOnDisposeListener( @Nonnull final Object key ) { assert null != _onDisposeListeners; final SafeProcedure removed = _onDisposeListeners.remove( key ); if ( Arez.shouldCheckApiInvariants() ) { invariant( () -> null != removed, () -> "Arez-0167... |
@Test public void removeOnDisposeListener_notPresent() { final ArezContext context = Arez.context(); final ComponentKernel kernel = new ComponentKernel( context, "MyType", 1, context.component( "MyType", 1 ), null, null, null, true, false, false ); final String key = ValueUtil.randomString(); assertInvariantFailure( ()... | public void removeOnDisposeListener( @Nonnull final Object key ) { assert null != _onDisposeListeners; final SafeProcedure removed = _onDisposeListeners.remove( key ); if ( Arez.shouldCheckApiInvariants() ) { invariant( () -> null != removed, () -> "Arez-0167: Attempting to remove OnDispose listener with key '" + key +... | ComponentKernel implements Disposable, ComponentObservable { public void removeOnDisposeListener( @Nonnull final Object key ) { assert null != _onDisposeListeners; final SafeProcedure removed = _onDisposeListeners.remove( key ); if ( Arez.shouldCheckApiInvariants() ) { invariant( () -> null != removed, () -> "Arez-0167... | ComponentKernel implements Disposable, ComponentObservable { public void removeOnDisposeListener( @Nonnull final Object key ) { assert null != _onDisposeListeners; final SafeProcedure removed = _onDisposeListeners.remove( key ); if ( Arez.shouldCheckApiInvariants() ) { invariant( () -> null != removed, () -> "Arez-0167... | ComponentKernel implements Disposable, ComponentObservable { public void removeOnDisposeListener( @Nonnull final Object key ) { assert null != _onDisposeListeners; final SafeProcedure removed = _onDisposeListeners.remove( key ); if ( Arez.shouldCheckApiInvariants() ) { invariant( () -> null != removed, () -> "Arez-0167... | ComponentKernel implements Disposable, ComponentObservable { public void removeOnDisposeListener( @Nonnull final Object key ) { assert null != _onDisposeListeners; final SafeProcedure removed = _onDisposeListeners.remove( key ); if ( Arez.shouldCheckApiInvariants() ) { invariant( () -> null != removed, () -> "Arez-0167... |
@Test public void dispose() { final ArezContext context = Arez.context(); final AtomicReference<ComponentKernel> ref = new AtomicReference<>(); final ComponentKernel kernel = new ComponentKernel( context, "MyType", 1, context.component( "MyType", 1, "MyType@1", () -> ref.get().notifyOnDisposeListeners() ), null, null, ... | @Override public void dispose() { if ( isNotDisposed() ) { _state = COMPONENT_DISPOSING; if ( Arez.areNativeComponentsEnabled() ) { assert null != _component; _component.dispose(); } else { getContext().safeAction( Arez.areNamesEnabled() ? getName() + ".dispose" : null, this::performDispose, ActionFlags.NO_VERIFY_ACTIO... | ComponentKernel implements Disposable, ComponentObservable { @Override public void dispose() { if ( isNotDisposed() ) { _state = COMPONENT_DISPOSING; if ( Arez.areNativeComponentsEnabled() ) { assert null != _component; _component.dispose(); } else { getContext().safeAction( Arez.areNamesEnabled() ? getName() + ".dispo... | ComponentKernel implements Disposable, ComponentObservable { @Override public void dispose() { if ( isNotDisposed() ) { _state = COMPONENT_DISPOSING; if ( Arez.areNativeComponentsEnabled() ) { assert null != _component; _component.dispose(); } else { getContext().safeAction( Arez.areNamesEnabled() ? getName() + ".dispo... | ComponentKernel implements Disposable, ComponentObservable { @Override public void dispose() { if ( isNotDisposed() ) { _state = COMPONENT_DISPOSING; if ( Arez.areNativeComponentsEnabled() ) { assert null != _component; _component.dispose(); } else { getContext().safeAction( Arez.areNamesEnabled() ? getName() + ".dispo... | ComponentKernel implements Disposable, ComponentObservable { @Override public void dispose() { if ( isNotDisposed() ) { _state = COMPONENT_DISPOSING; if ( Arez.areNativeComponentsEnabled() ) { assert null != _component; _component.dispose(); } else { getContext().safeAction( Arez.areNamesEnabled() ? getName() + ".dispo... |
@Test public void zoneEnabledConstruction() { ArezTestUtil.enableZones(); final ArezContext context = Arez.context(); final Zone defaultZone = Arez.currentZone(); assertEquals( context.getZone(), defaultZone ); final Zone zone = Arez.createZone(); zone.safeRun( () -> { assertNotEquals( Arez.context().getZone(), default... | @Nonnull Zone getZone() { assert null != _zone; return _zone; } | ArezContext { @Nonnull Zone getZone() { assert null != _zone; return _zone; } } | ArezContext { @Nonnull Zone getZone() { assert null != _zone; return _zone; } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull Zone getZone() { assert null != _zone; return _zone; } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Non... | ArezContext { @Nonnull Zone getZone() { assert null != _zone; return _zone; } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Non... |
@Test public void generateName() { final ArezContext context = Arez.context(); assertEquals( context.generateName( "ComputableValue", "MyName" ), "MyName" ); context.setNextNodeId( 1 ); assertEquals( context.generateName( "ComputableValue", null ), "ComputableValue@1" ); assertEquals( context.getNextNodeId(), 2 ); Arez... | @Nullable String generateName( @Nonnull final String prefix, @Nullable final String name ) { return Arez.areNamesEnabled() ? null != name ? name : prefix + "@" + _nextNodeId++ : null; } | ArezContext { @Nullable String generateName( @Nonnull final String prefix, @Nullable final String name ) { return Arez.areNamesEnabled() ? null != name ? name : prefix + "@" + _nextNodeId++ : null; } } | ArezContext { @Nullable String generateName( @Nonnull final String prefix, @Nullable final String name ) { return Arez.areNamesEnabled() ? null != name ? name : prefix + "@" + _nextNodeId++ : null; } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nullable String generateName( @Nonnull final String prefix, @Nullable final String name ) { return Arez.areNamesEnabled() ? null != name ? name : prefix + "@" + _nextNodeId++ : null; } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPre... | ArezContext { @Nullable String generateName( @Nonnull final String prefix, @Nullable final String name ) { return Arez.areNamesEnabled() ? null != name ? name : prefix + "@" + _nextNodeId++ : null; } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPre... |
@Test public void triggerScheduler() { final ArezContext context = Arez.context(); final AtomicInteger callCount = new AtomicInteger(); context.observer( () -> { observeADependency(); callCount.incrementAndGet(); }, Observer.Flags.RUN_LATER ); assertEquals( callCount.get(), 0 ); context.triggerScheduler(); assertEquals... | public void triggerScheduler() { if ( isSchedulerEnabled() && !isSchedulerPaused() ) { if ( !_schedulerActive ) { _schedulerActive = true; try { if ( Arez.isTaskInterceptorEnabled() && null != _taskInterceptor ) { assert null != _taskExecuteAction; do { _taskInterceptor.executeTasks( _taskExecuteAction ); } while ( _ex... | ArezContext { public void triggerScheduler() { if ( isSchedulerEnabled() && !isSchedulerPaused() ) { if ( !_schedulerActive ) { _schedulerActive = true; try { if ( Arez.isTaskInterceptorEnabled() && null != _taskInterceptor ) { assert null != _taskExecuteAction; do { _taskInterceptor.executeTasks( _taskExecuteAction );... | ArezContext { public void triggerScheduler() { if ( isSchedulerEnabled() && !isSchedulerPaused() ) { if ( !_schedulerActive ) { _schedulerActive = true; try { if ( Arez.isTaskInterceptorEnabled() && null != _taskInterceptor ) { assert null != _taskExecuteAction; do { _taskInterceptor.executeTasks( _taskExecuteAction );... | ArezContext { public void triggerScheduler() { if ( isSchedulerEnabled() && !isSchedulerPaused() ) { if ( !_schedulerActive ) { _schedulerActive = true; try { if ( Arez.isTaskInterceptorEnabled() && null != _taskInterceptor ) { assert null != _taskExecuteAction; do { _taskInterceptor.executeTasks( _taskExecuteAction );... | ArezContext { public void triggerScheduler() { if ( isSchedulerEnabled() && !isSchedulerPaused() ) { if ( !_schedulerActive ) { _schedulerActive = true; try { if ( Arez.isTaskInterceptorEnabled() && null != _taskInterceptor ) { assert null != _taskExecuteAction; do { _taskInterceptor.executeTasks( _taskExecuteAction );... |
@Test public void isReadOnlyTransactionActive() throws Throwable { final ArezContext context = Arez.context(); assertFalse( context.isTransactionActive() ); assertFalse( context.isReadOnlyTransactionActive() ); context.action( () -> { assertTrue( context.isTransactionActive() ); assertFalse( context.isReadOnlyTransacti... | public boolean isReadOnlyTransactionActive() { return Transaction.isTransactionActive( this ) && ( !Arez.shouldEnforceTransactionType() || !Transaction.current().isMutation() ); } | ArezContext { public boolean isReadOnlyTransactionActive() { return Transaction.isTransactionActive( this ) && ( !Arez.shouldEnforceTransactionType() || !Transaction.current().isMutation() ); } } | ArezContext { public boolean isReadOnlyTransactionActive() { return Transaction.isTransactionActive( this ) && ( !Arez.shouldEnforceTransactionType() || !Transaction.current().isMutation() ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public boolean isReadOnlyTransactionActive() { return Transaction.isTransactionActive( this ) && ( !Arez.shouldEnforceTransactionType() || !Transaction.current().isMutation() ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( ... | ArezContext { public boolean isReadOnlyTransactionActive() { return Transaction.isTransactionActive( this ) && ( !Arez.shouldEnforceTransactionType() || !Transaction.current().isMutation() ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( ... |
@Test public void isTrackingTransactionActive() throws Throwable { final ArezContext context = Arez.context(); assertFalse( context.isTransactionActive() ); assertFalse( context.isReadOnlyTransactionActive() ); assertFalse( context.isReadWriteTransactionActive() ); assertFalse( context.isTrackingTransactionActive() ); ... | public boolean isTrackingTransactionActive() { return Transaction.isTransactionActive( this ) && null != Transaction.current().getTracker(); } | ArezContext { public boolean isTrackingTransactionActive() { return Transaction.isTransactionActive( this ) && null != Transaction.current().getTracker(); } } | ArezContext { public boolean isTrackingTransactionActive() { return Transaction.isTransactionActive( this ) && null != Transaction.current().getTracker(); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public boolean isTrackingTransactionActive() { return Transaction.isTransactionActive( this ) && null != Transaction.current().getTracker(); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull ... | ArezContext { public boolean isTrackingTransactionActive() { return Transaction.isTransactionActive( this ) && null != Transaction.current().getTracker(); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull ... |
@SuppressWarnings( "MagicConstant" ) @Test public void verifyActionFlags() { final Procedure executable = () -> { }; assertInvariantFailure( () -> Arez.context().action( executable, Observer.Flags.DEACTIVATE_ON_UNOBSERVE ), "Arez-0212: Flags passed to action 'Action@1' include some " + "unexpected flags set: " + Observ... | private void verifyActionFlags( @Nullable final String name, @MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ) { if ( Arez.shouldCheckApiInvariants() ) { final int nonActionFlags = flags & ~ActionFlags.CONFIG_FLAGS_MASK; apiInvariant( () -> 0 == nonActionFlags, () -> "Arez-0212: Flags passed to act... | ArezContext { private void verifyActionFlags( @Nullable final String name, @MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ) { if ( Arez.shouldCheckApiInvariants() ) { final int nonActionFlags = flags & ~ActionFlags.CONFIG_FLAGS_MASK; apiInvariant( () -> 0 == nonActionFlags, () -> "Arez-0212: Flags... | ArezContext { private void verifyActionFlags( @Nullable final String name, @MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ) { if ( Arez.shouldCheckApiInvariants() ) { final int nonActionFlags = flags & ~ActionFlags.CONFIG_FLAGS_MASK; apiInvariant( () -> 0 == nonActionFlags, () -> "Arez-0212: Flags... | ArezContext { private void verifyActionFlags( @Nullable final String name, @MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ) { if ( Arez.shouldCheckApiInvariants() ) { final int nonActionFlags = flags & ~ActionFlags.CONFIG_FLAGS_MASK; apiInvariant( () -> 0 == nonActionFlags, () -> "Arez-0212: Flags... | ArezContext { private void verifyActionFlags( @Nullable final String name, @MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ) { if ( Arez.shouldCheckApiInvariants() ) { final int nonActionFlags = flags & ~ActionFlags.CONFIG_FLAGS_MASK; apiInvariant( () -> 0 == nonActionFlags, () -> "Arez-0212: Flags... |
@Test public void verifyActionFlags_badTransactionFlags() { final Procedure executable = () -> { }; assertInvariantFailure( () -> Arez.context() .action( executable, ActionFlags.READ_ONLY | ActionFlags.READ_WRITE ), "Arez-0126: Flags passed to action 'Action@1' include both READ_ONLY and READ_WRITE." ); } | public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbo... | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbo... |
@Test public void getDependencies() { final ArezContext context = Arez.context(); final Spy spy = context.getSpy(); final ObservableValue<Object> observable = context.observable(); final Observer observer = context.observer( observable::reportObserved ); final List<ObservableValueInfo> dependencies = spy.asObserverInfo... | @Nonnull @Override public List<ObservableValueInfo> getDependencies() { final Transaction transaction = _spy.isTransactionActive() ? getTrackerTransaction() : null; if ( null != transaction ) { final List<ObservableValue<?>> observableValues = transaction.getObservableValues(); if ( null == observableValues ) { return ... | ObserverInfoImpl implements ObserverInfo { @Nonnull @Override public List<ObservableValueInfo> getDependencies() { final Transaction transaction = _spy.isTransactionActive() ? getTrackerTransaction() : null; if ( null != transaction ) { final List<ObservableValue<?>> observableValues = transaction.getObservableValues()... | ObserverInfoImpl implements ObserverInfo { @Nonnull @Override public List<ObservableValueInfo> getDependencies() { final Transaction transaction = _spy.isTransactionActive() ? getTrackerTransaction() : null; if ( null != transaction ) { final List<ObservableValue<?>> observableValues = transaction.getObservableValues()... | ObserverInfoImpl implements ObserverInfo { @Nonnull @Override public List<ObservableValueInfo> getDependencies() { final Transaction transaction = _spy.isTransactionActive() ? getTrackerTransaction() : null; if ( null != transaction ) { final List<ObservableValue<?>> observableValues = transaction.getObservableValues()... | ObserverInfoImpl implements ObserverInfo { @Nonnull @Override public List<ObservableValueInfo> getDependencies() { final Transaction transaction = _spy.isTransactionActive() ? getTrackerTransaction() : null; if ( null != transaction ) { final List<ObservableValue<?>> observableValues = transaction.getObservableValues()... |
@Test public void writeToFile() throws IOException { Path fileToWrite = Files.createTempFile(null, null); fileToWrite.toFile().deleteOnExit(); RefactoringsWriters.getJMoveWriter().writeRefactoringsInTextForm(REFACTORINGS_TO_WRITE, fileToWrite); checkWrittenRefactorings(fileToWrite.toFile()); } | @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, getRefactoringsInJMoveFormat(refactorings)); } | JMoveWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, getRefactoringsInJMoveFormat(refactorings)); } } | JMoveWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, getRefactoringsInJMoveFormat(refactorings)); } } | JMoveWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, getRefactoringsInJMoveFormat(refactorings)); } @Override String getName(); @Override void write(List<... | JMoveWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, getRefactoringsInJMoveFormat(refactorings)); } @Override String getName(); @Override void write(List<... |
@Test public void testCorrect2() throws IOException { List<String> entries = loadLogs(LOGS_PATH + "correctTest2.txt"); validator.validate(entries); assertEquals(1, result.validLines().size()); assertEquals(0, result.errorLines().size()); } | public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSession.add(new EventLine(... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... |
@Test public void testCorrect3() throws IOException { List<String> entries = loadLogs(LOGS_PATH + "correctTest3.txt"); validator.validate(entries); assertEquals(1, result.validLines().size()); assertEquals(0, result.errorLines().size()); } | public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSession.add(new EventLine(... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... |
@Test public void testIncorrectTimestamp() throws IOException { List<String> entries = loadLogs(LOGS_PATH + "incorrectTest1.txt"); validator.validate(entries); assertEquals(0, result.validLines().size()); assertEquals(1, result.errorLines().size()); } | public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSession.add(new EventLine(... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... |
@Test public void testIncorrectUsedId() throws IOException { List<String> entries = loadLogs(LOGS_PATH + "incorrectTest2.txt"); validator.validate(entries); assertEquals(0, result.validLines().size()); assertEquals(1, result.errorLines().size()); } | public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSession.add(new EventLine(... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... |
@Test public void testIncorrectSessionId() throws IOException { List<String> entries = loadLogs(LOGS_PATH + "incorrectTest3.txt"); validator.validate(entries); assertEquals(0, result.validLines().size()); assertEquals(1, result.errorLines().size()); } | public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSession.add(new EventLine(... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... |
@Test public void testBothEmpty() throws IOException { List<String> entries = loadLogs(LOGS_PATH + "incorrectTest4.txt"); validator.validate(entries); assertEquals(0, result.validLines().size()); assertEquals(1, result.errorLines().size()); } | public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSession.add(new EventLine(... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... |
@Test public void testRejectedMissing() throws IOException { List<String> entries = loadLogs(LOGS_PATH + "incorrectTest5.txt"); validator.validate(entries); assertEquals(0, result.validLines().size()); assertEquals(1, result.errorLines().size()); } | public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSession.add(new EventLine(... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... |
@Test public void testIncorrectJsonInPayload() throws IOException { List<String> entries = loadLogs(LOGS_PATH + "incorrectTest6.txt"); validator.validate(entries); assertEquals(0, result.validLines().size()); assertEquals(1, result.errorLines().size()); } | public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSession.add(new EventLine(... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... |
@Test public void testEmptyPayload() throws IOException { List<String> entries = loadLogs(LOGS_PATH + "incorrectTest7.txt"); validator.validate(entries); assertEquals(0, result.validLines().size()); assertEquals(1, result.errorLines().size()); } | public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSession.add(new EventLine(... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... |
@Test public void writeToOutputStream() throws IOException { Path fileToWrite = Files.createTempFile(null, null); fileToWrite.toFile().deleteOnExit(); RefactoringsWriters.getJMoveWriter().writeRefactoringsInTextForm(REFACTORINGS_TO_WRITE, new FileOutputStream(fileToWrite.toFile())); checkWrittenRefactorings(fileToWrite... | @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, getRefactoringsInJMoveFormat(refactorings)); } | JMoveWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, getRefactoringsInJMoveFormat(refactorings)); } } | JMoveWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, getRefactoringsInJMoveFormat(refactorings)); } } | JMoveWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, getRefactoringsInJMoveFormat(refactorings)); } @Override String getName(); @Override void write(List<... | JMoveWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, getRefactoringsInJMoveFormat(refactorings)); } @Override String getName(); @Override void write(List<... |
@Test public void writeToFile() throws IOException { Path fileToWrite = Files.createTempFile(null, null); fileToWrite.toFile().deleteOnExit(); RefactoringsWriters.getJBWriter().writeRefactoringsInTextForm(REFACTORINGS_TO_WRITE, fileToWrite); checkWrittenRefactorings(fileToWrite.toFile()); } | @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, Collections.singleton(JSON_CONVERTER.toJson(refactorings))); } | JBWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, Collections.singleton(JSON_CONVERTER.toJson(refactorings))); } } | JBWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, Collections.singleton(JSON_CONVERTER.toJson(refactorings))); } } | JBWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, Collections.singleton(JSON_CONVERTER.toJson(refactorings))); } @Override void write(List<MoveMethodRefac... | JBWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, Collections.singleton(JSON_CONVERTER.toJson(refactorings))); } @Override void write(List<MoveMethodRefac... |
@Test public void writeToOutputStream() throws IOException { Path fileToWrite = Files.createTempFile(null, null); fileToWrite.toFile().deleteOnExit(); RefactoringsWriters.getJBWriter().writeRefactoringsInTextForm(REFACTORINGS_TO_WRITE, new FileOutputStream(fileToWrite.toFile())); checkWrittenRefactorings(fileToWrite.to... | @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, Collections.singleton(JSON_CONVERTER.toJson(refactorings))); } | JBWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, Collections.singleton(JSON_CONVERTER.toJson(refactorings))); } } | JBWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, Collections.singleton(JSON_CONVERTER.toJson(refactorings))); } } | JBWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, Collections.singleton(JSON_CONVERTER.toJson(refactorings))); } @Override void write(List<MoveMethodRefac... | JBWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, Collections.singleton(JSON_CONVERTER.toJson(refactorings))); } @Override void write(List<MoveMethodRefac... |
@Test public void readFromFile() throws IOException { checkReadRefactorings(RefactoringsReaders.getJBReader().read(REFACTORINGS_PATH)); } | @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { try (BufferedReader reader = Files.newBufferedReader(refactoringsPath)) { Type listType = new TypeToken<List<JBRefactoringTextRepresentation>>(){}.getType(); return JSON_CONVERTER.fromJson(reader, listType); } } | JBReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { try (BufferedReader reader = Files.newBufferedReader(refactoringsPath)) { Type listType = new TypeToken<List<JBRefactoringTextRepresentation>>(){}.getType(); return JSON_CONVERT... | JBReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { try (BufferedReader reader = Files.newBufferedReader(refactoringsPath)) { Type listType = new TypeToken<List<JBRefactoringTextRepresentation>>(){}.getType(); return JSON_CONVERT... | JBReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { try (BufferedReader reader = Files.newBufferedReader(refactoringsPath)) { Type listType = new TypeToken<List<JBRefactoringTextRepresentation>>(){}.getType(); return JSON_CONVERT... | JBReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { try (BufferedReader reader = Files.newBufferedReader(refactoringsPath)) { Type listType = new TypeToken<List<JBRefactoringTextRepresentation>>(){}.getType(); return JSON_CONVERT... |
@Test public void readFromInputStream() throws IOException { checkReadRefactorings(RefactoringsReaders.getJBReader().read(new FileInputStream(REFACTORINGS_PATH.toFile()))); } | @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { try (BufferedReader reader = Files.newBufferedReader(refactoringsPath)) { Type listType = new TypeToken<List<JBRefactoringTextRepresentation>>(){}.getType(); return JSON_CONVERTER.fromJson(reader, listType); } } | JBReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { try (BufferedReader reader = Files.newBufferedReader(refactoringsPath)) { Type listType = new TypeToken<List<JBRefactoringTextRepresentation>>(){}.getType(); return JSON_CONVERT... | JBReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { try (BufferedReader reader = Files.newBufferedReader(refactoringsPath)) { Type listType = new TypeToken<List<JBRefactoringTextRepresentation>>(){}.getType(); return JSON_CONVERT... | JBReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { try (BufferedReader reader = Files.newBufferedReader(refactoringsPath)) { Type listType = new TypeToken<List<JBRefactoringTextRepresentation>>(){}.getType(); return JSON_CONVERT... | JBReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { try (BufferedReader reader = Files.newBufferedReader(refactoringsPath)) { Type listType = new TypeToken<List<JBRefactoringTextRepresentation>>(){}.getType(); return JSON_CONVERT... |
@Test public void readFromFile() throws IOException { checkReadRefactorings(RefactoringsReaders.getJMoveReader().read(REFACTORINGS_PATH)); } | @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { return parseLines(Files.lines(refactoringsPath)); } | JMoveReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { return parseLines(Files.lines(refactoringsPath)); } } | JMoveReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { return parseLines(Files.lines(refactoringsPath)); } } | JMoveReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { return parseLines(Files.lines(refactoringsPath)); } @Override List<RefactoringTextRepresentation> read(Path refactoringsPath); @Override List<RefactoringTextRepresentation> ... | JMoveReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { return parseLines(Files.lines(refactoringsPath)); } @Override List<RefactoringTextRepresentation> read(Path refactoringsPath); @Override List<RefactoringTextRepresentation> ... |
@Test public void readFromInputStream() throws IOException { checkReadRefactorings(RefactoringsReaders.getJMoveReader().read(new FileInputStream(REFACTORINGS_PATH.toFile()))); } | @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { return parseLines(Files.lines(refactoringsPath)); } | JMoveReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { return parseLines(Files.lines(refactoringsPath)); } } | JMoveReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { return parseLines(Files.lines(refactoringsPath)); } } | JMoveReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { return parseLines(Files.lines(refactoringsPath)); } @Override List<RefactoringTextRepresentation> read(Path refactoringsPath); @Override List<RefactoringTextRepresentation> ... | JMoveReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { return parseLines(Files.lines(refactoringsPath)); } @Override List<RefactoringTextRepresentation> read(Path refactoringsPath); @Override List<RefactoringTextRepresentation> ... |
@Test public void addResult() { CombinedEvaluationResult combinedEvaluationResult = new CombinedEvaluationResult(TEST_ALGORITHM); assertEquals(0, combinedEvaluationResult.getNumberOfGood()); assertEquals(0, combinedEvaluationResult.getNumberOfFoundGood()); assertEquals(0, combinedEvaluationResult.getNumberOfBad()); ass... | void addResult(EvaluationResult evaluationResult) { if (!getAlgorithm().equals(evaluationResult.getAlgorithm())) { throw new IllegalArgumentException("Tried to add evaluation result with different algorithm"); } numberOfGood += evaluationResult.getNumberOfGood(); numberOfBad += evaluationResult.getNumberOfBad(); number... | CombinedEvaluationResult extends AbstractEvaluationResult { void addResult(EvaluationResult evaluationResult) { if (!getAlgorithm().equals(evaluationResult.getAlgorithm())) { throw new IllegalArgumentException("Tried to add evaluation result with different algorithm"); } numberOfGood += evaluationResult.getNumberOfGood... | CombinedEvaluationResult extends AbstractEvaluationResult { void addResult(EvaluationResult evaluationResult) { if (!getAlgorithm().equals(evaluationResult.getAlgorithm())) { throw new IllegalArgumentException("Tried to add evaluation result with different algorithm"); } numberOfGood += evaluationResult.getNumberOfGood... | CombinedEvaluationResult extends AbstractEvaluationResult { void addResult(EvaluationResult evaluationResult) { if (!getAlgorithm().equals(evaluationResult.getAlgorithm())) { throw new IllegalArgumentException("Tried to add evaluation result with different algorithm"); } numberOfGood += evaluationResult.getNumberOfGood... | CombinedEvaluationResult extends AbstractEvaluationResult { void addResult(EvaluationResult evaluationResult) { if (!getAlgorithm().equals(evaluationResult.getAlgorithm())) { throw new IllegalArgumentException("Tried to add evaluation result with different algorithm"); } numberOfGood += evaluationResult.getNumberOfGood... |
@Test public void testCorrect1() throws IOException { List<String> entries = loadLogs(LOGS_PATH + "correctTest1.txt"); validator.validate(entries); assertEquals(1, result.validLines().size()); assertEquals(0, result.errorLines().size()); } | public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSession.add(new EventLine(... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... | InputSessionValidator { public void validate(Iterable<String> input) { List<EventLine> errorSession = new ArrayList<>(); List<EventLine> validSession = new ArrayList<>(); for (String line : input) { if (line.trim().isEmpty()) continue; String[] fields = line.split("\t", -1); if (!isFormattedCorrectly(fields)) { errorSe... |
@Test public void testCreateManifest() throws IOException { Resource resource = new ClassPathResource("/repositories/sources/test/ticktock/ticktock-1.0.1"); PackageReader packageReader = new DefaultPackageReader(); Package pkg = packageReader.read(resource.getFile()); assertThat(pkg).isNotNull(); Date date = new Date(6... | @SuppressWarnings("unchecked") public static String createManifest(Package packageToDeploy, Map<String, ?> model) { Map<String, Object> newModel = new HashMap<>(); backslashEscapeMap((Map<String, Object>) model, newModel); String rawManifest = applyManifestTemplate(packageToDeploy, newModel); Yaml yaml = createYaml(); ... | ManifestUtils { @SuppressWarnings("unchecked") public static String createManifest(Package packageToDeploy, Map<String, ?> model) { Map<String, Object> newModel = new HashMap<>(); backslashEscapeMap((Map<String, Object>) model, newModel); String rawManifest = applyManifestTemplate(packageToDeploy, newModel); Yaml yaml ... | ManifestUtils { @SuppressWarnings("unchecked") public static String createManifest(Package packageToDeploy, Map<String, ?> model) { Map<String, Object> newModel = new HashMap<>(); backslashEscapeMap((Map<String, Object>) model, newModel); String rawManifest = applyManifestTemplate(packageToDeploy, newModel); Yaml yaml ... | ManifestUtils { @SuppressWarnings("unchecked") public static String createManifest(Package packageToDeploy, Map<String, ?> model) { Map<String, Object> newModel = new HashMap<>(); backslashEscapeMap((Map<String, Object>) model, newModel); String rawManifest = applyManifestTemplate(packageToDeploy, newModel); Yaml yaml ... | ManifestUtils { @SuppressWarnings("unchecked") public static String createManifest(Package packageToDeploy, Map<String, ?> model) { Map<String, Object> newModel = new HashMap<>(); backslashEscapeMap((Map<String, Object>) model, newModel); String rawManifest = applyManifestTemplate(packageToDeploy, newModel); Yaml yaml ... |
@Test public void initialize() throws Exception { assertThat(repositoryRepository.count()).isEqualTo(2); assertThat(repositoryRepository.findByName("test").getUrl()).isEqualTo("classpath:/repositories/binaries/test"); assertThat(packageMetadataRepository.count()).isGreaterThan(5); } | @EventListener @Transactional public void initialize(ApplicationReadyEvent event) { synchronizeRepositories(); synchronizePackageMetadata(); } | RepositoryInitializationService { @EventListener @Transactional public void initialize(ApplicationReadyEvent event) { synchronizeRepositories(); synchronizePackageMetadata(); } } | RepositoryInitializationService { @EventListener @Transactional public void initialize(ApplicationReadyEvent event) { synchronizeRepositories(); synchronizePackageMetadata(); } RepositoryInitializationService(RepositoryRepository repositoryRepository,
PackageMetadataRepository packageMetadataRepository,
PackageMe... | RepositoryInitializationService { @EventListener @Transactional public void initialize(ApplicationReadyEvent event) { synchronizeRepositories(); synchronizePackageMetadata(); } RepositoryInitializationService(RepositoryRepository repositoryRepository,
PackageMetadataRepository packageMetadataRepository,
PackageMe... | RepositoryInitializationService { @EventListener @Transactional public void initialize(ApplicationReadyEvent event) { synchronizeRepositories(); synchronizePackageMetadata(); } RepositoryInitializationService(RepositoryRepository repositoryRepository,
PackageMetadataRepository packageMetadataRepository,
PackageMe... |
@Test public void testUpdateWithNoConfigReturnsEmptyMap() { MultivaluedMap<String, String> incomingHeaders = mockIncomingHeaders(); MultivaluedMap<String, String> clientOutgoingHeaders = new MultivaluedHashMap<>(); MultivaluedMap<String, String> updatedHeaders = impl.update(incomingHeaders, clientOutgoingHeaders); asse... | @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHeaders, clientOutgoingHeaders}); } MultivaluedMap<String, String> pro... | DefaultClientHeadersFactoryImpl implements ClientHeadersFactory { @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHead... | DefaultClientHeadersFactoryImpl implements ClientHeadersFactory { @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHead... | DefaultClientHeadersFactoryImpl implements ClientHeadersFactory { @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHead... | DefaultClientHeadersFactoryImpl implements ClientHeadersFactory { @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHead... |
@Test public void testUpdateWithConfiguredPropagationHeaders() { System.setProperty(DefaultClientHeadersFactoryImpl.PROPAGATE_PROPERTY, "Authorization,Favorite-Color"); MultivaluedMap<String, String> incomingHeaders = mockIncomingHeaders(); MultivaluedMap<String, String> clientOutgoingHeaders = new MultivaluedHashMap<>... | @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHeaders, clientOutgoingHeaders}); } MultivaluedMap<String, String> pro... | DefaultClientHeadersFactoryImpl implements ClientHeadersFactory { @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHead... | DefaultClientHeadersFactoryImpl implements ClientHeadersFactory { @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHead... | DefaultClientHeadersFactoryImpl implements ClientHeadersFactory { @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHead... | DefaultClientHeadersFactoryImpl implements ClientHeadersFactory { @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHead... |
@Test public void testUpdateWithConfiguredPropagationHeadersAndExistingOutgoingHeaders() { System.setProperty(DefaultClientHeadersFactoryImpl.PROPAGATE_PROPERTY, "Authorization,Favorite-Color"); MultivaluedMap<String, String> incomingHeaders = mockIncomingHeaders(); MultivaluedMap<String, String> clientOutgoingHeaders ... | @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHeaders, clientOutgoingHeaders}); } MultivaluedMap<String, String> pro... | DefaultClientHeadersFactoryImpl implements ClientHeadersFactory { @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHead... | DefaultClientHeadersFactoryImpl implements ClientHeadersFactory { @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHead... | DefaultClientHeadersFactoryImpl implements ClientHeadersFactory { @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHead... | DefaultClientHeadersFactoryImpl implements ClientHeadersFactory { @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[]{incomingHead... |
@Test public void all_key_words_can_be_initialzed() { DocumentKeyWord[] results = DocumentKeyWords.getAll(); assertNotNull(results); } | public static DocumentKeyWord[] getAll(){ return ALL_KEYWORDS; } | DocumentKeyWords { public static DocumentKeyWord[] getAll(){ return ALL_KEYWORDS; } } | DocumentKeyWords { public static DocumentKeyWord[] getAll(){ return ALL_KEYWORDS; } } | DocumentKeyWords { public static DocumentKeyWord[] getAll(){ return ALL_KEYWORDS; } static DocumentKeyWord[] getAll(); } | DocumentKeyWords { public static DocumentKeyWord[] getAll(){ return ALL_KEYWORDS; } static DocumentKeyWord[] getAll(); } |
@Test public void function_is_functionKeyword() { assertTrue(new ParseToken("function").isFunctionKeyword()); } | public boolean isFunctionKeyword() { return "function".equals(text); } | ParseToken { public boolean isFunctionKeyword() { return "function".equals(text); } } | ParseToken { public boolean isFunctionKeyword() { return "function".equals(text); } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); } | ParseToken { public boolean isFunctionKeyword() { return "function".equals(text); } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); String getText(); int getStart(); int getEnd(); @Override String toString(); String createTypeDescription(); boolean isComment(); boolean isSingleSt... | ParseToken { public boolean isFunctionKeyword() { return "function".equals(text); } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); String getText(); int getStart(); int getEnd(); @Override String toString(); String createTypeDescription(); boolean isComment(); boolean isSingleSt... |
@Test public void functions_is_NOT_functionKeyword() { assertFalse(new ParseToken("functions").isFunctionKeyword()); } | public boolean isFunctionKeyword() { return "function".equals(text); } | ParseToken { public boolean isFunctionKeyword() { return "function".equals(text); } } | ParseToken { public boolean isFunctionKeyword() { return "function".equals(text); } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); } | ParseToken { public boolean isFunctionKeyword() { return "function".equals(text); } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); String getText(); int getStart(); int getEnd(); @Override String toString(); String createTypeDescription(); boolean isComment(); boolean isSingleSt... | ParseToken { public boolean isFunctionKeyword() { return "function".equals(text); } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); String getText(); int getStart(); int getEnd(); @Override String toString(); String createTypeDescription(); boolean isComment(); boolean isSingleSt... |
@Test public void function_is_NOT_functionName() { assertFalse(new ParseToken("function").isFunction()); } | public boolean isFunction() { boolean isFunctionName = endsWithFunctionBrackets(); isFunctionName = isFunctionName && isLegalFunctionName(); isFunctionName = isFunctionName && !isComment(); isFunctionName = isFunctionName && text.length() > 2; isFunctionName = isFunctionName && !isString(); return isFunctionName; } | ParseToken { public boolean isFunction() { boolean isFunctionName = endsWithFunctionBrackets(); isFunctionName = isFunctionName && isLegalFunctionName(); isFunctionName = isFunctionName && !isComment(); isFunctionName = isFunctionName && text.length() > 2; isFunctionName = isFunctionName && !isString(); return isFuncti... | ParseToken { public boolean isFunction() { boolean isFunctionName = endsWithFunctionBrackets(); isFunctionName = isFunctionName && isLegalFunctionName(); isFunctionName = isFunctionName && !isComment(); isFunctionName = isFunctionName && text.length() > 2; isFunctionName = isFunctionName && !isString(); return isFuncti... | ParseToken { public boolean isFunction() { boolean isFunctionName = endsWithFunctionBrackets(); isFunctionName = isFunctionName && isLegalFunctionName(); isFunctionName = isFunctionName && !isComment(); isFunctionName = isFunctionName && text.length() > 2; isFunctionName = isFunctionName && !isString(); return isFuncti... | ParseToken { public boolean isFunction() { boolean isFunctionName = endsWithFunctionBrackets(); isFunctionName = isFunctionName && isLegalFunctionName(); isFunctionName = isFunctionName && !isComment(); isFunctionName = isFunctionName && text.length() > 2; isFunctionName = isFunctionName && !isString(); return isFuncti... |
@Test public void xyz_is_NOT_functionName() { assertFalse(new ParseToken("xyz").isFunction()); } | public boolean isFunction() { boolean isFunctionName = endsWithFunctionBrackets(); isFunctionName = isFunctionName && isLegalFunctionName(); isFunctionName = isFunctionName && !isComment(); isFunctionName = isFunctionName && text.length() > 2; isFunctionName = isFunctionName && !isString(); return isFunctionName; } | ParseToken { public boolean isFunction() { boolean isFunctionName = endsWithFunctionBrackets(); isFunctionName = isFunctionName && isLegalFunctionName(); isFunctionName = isFunctionName && !isComment(); isFunctionName = isFunctionName && text.length() > 2; isFunctionName = isFunctionName && !isString(); return isFuncti... | ParseToken { public boolean isFunction() { boolean isFunctionName = endsWithFunctionBrackets(); isFunctionName = isFunctionName && isLegalFunctionName(); isFunctionName = isFunctionName && !isComment(); isFunctionName = isFunctionName && text.length() > 2; isFunctionName = isFunctionName && !isString(); return isFuncti... | ParseToken { public boolean isFunction() { boolean isFunctionName = endsWithFunctionBrackets(); isFunctionName = isFunctionName && isLegalFunctionName(); isFunctionName = isFunctionName && !isComment(); isFunctionName = isFunctionName && text.length() > 2; isFunctionName = isFunctionName && !isString(); return isFuncti... | ParseToken { public boolean isFunction() { boolean isFunctionName = endsWithFunctionBrackets(); isFunctionName = isFunctionName && isLegalFunctionName(); isFunctionName = isFunctionName && !isComment(); isFunctionName = isFunctionName && text.length() > 2; isFunctionName = isFunctionName && !isString(); return isFuncti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.