StatefulService implements Service { public void log(Level level, String fmt, Object... args) { doLogging(level, () -> String.format(fmt, args)); } StatefulService(Class<? extends ServiceDocument> stateType); @Override OperationProcessingChain getOperationProcessingChain(); @Override Service.ProcessingStage getProcessingStage(); @Override void handleCreate(Operation post); @Override void handleStart(Operation post); @Override void authorizeRequest(Operation op); @Override boolean queueRequest(Operation op); @Override void handleRequest(Operation request); @Override void handleRequest(Operation request, OperationProcessingStage opProcessingStage); @RouteDocumentation(supportLevel = SupportLevel.NOT_SUPPORTED) void handlePost(Operation post); @RouteDocumentation(description = "Delete this service instance") void handleDelete(Operation delete); @Override void handleStop(Operation delete); @RouteDocumentation(supportLevel = SupportLevel.NOT_SUPPORTED) void handlePatch(Operation patch); void handleOptions(Operation options); @RouteDocumentation(description = "Replace current state with the body of the request") void handlePut(Operation put); @RouteDocumentation(description = "Read the service document") void handleGet(Operation get); @Override Operation dequeueRequest(); @Override void setStat(String name, double newValue); @Override void setStat(ServiceStat s, double newValue); @Override void adjustStat(ServiceStat s, double delta); @Override void adjustStat(String name, double delta); @Override ServiceStat getStat(String name); @Override String getSelfLink(); @Override URI getUri(); @Override ServiceHost getHost(); @Override boolean hasOption(Service.ServiceOption cap); @Override void toggleOption(ServiceOption option, boolean enable); @Override void setSelfLink(String path); @Override void setHost(ServiceHost serviceHost); @Override void setOperationProcessingChain(OperationProcessingChain opProcessingChain); @Override void setProcessingStage(ProcessingStage stage); @Override Service getUtilityService(String uriPath); @Override void sendRequest(Operation op); ServiceDocumentDescription getStateDescription(); @Override ServiceDocument getDocumentTemplate(); void logSevere(Throwable e); void logSevere(String fmt, Object... args); void logSevere(Supplier<String> messageSupplier); void logInfo(String fmt, Object... args); void logInfo(Supplier<String> messageSupplier); void logFine(String fmt, Object... args); void logFine(Supplier<String> messageSupplier); void logWarning(String fmt, Object... args); void logWarning(Supplier<String> messageSupplier); void log(Level level, String fmt, Object... args); void log(Level level, Supplier<String> messageSupplier); @Override void handleMaintenance(Operation post); void handlePeriodicMaintenance(Operation post); void handleNodeGroupMaintenance(Operation post); @Override ServiceDocument setInitialState(Object state, Long version); @Override String getPeerNodeSelectorPath(); @Override void setPeerNodeSelectorPath(String link); @Override String getDocumentIndexPath(); @Override void setDocumentIndexPath(String link); @Override EnumSet<ServiceOption> getOptions(); @Override void setState(Operation op, ServiceDocument newState); @SuppressWarnings("unchecked") @Override T getState(Operation op); void setAvailable(boolean isAvailable); boolean isAvailable(); @Override void setMaintenanceIntervalMicros(long micros); @Override void setCacheClearDelayMicros(long micros); @Override long getMaintenanceIntervalMicros(); @Override long getCacheClearDelayMicros(); @Override Class<? extends ServiceDocument> getStateType(); @Override void handleConfigurationRequest(Operation request); @Override final void setAuthorizationContext(Operation op, AuthorizationContext ctx); final Signer getTokenSigner(); @Override final AuthorizationContext getSystemAuthorizationContext(); final AuthorizationContext getAuthorizationContextForSubject(String subject);  }
@Test public void throughputInMemoryStrictUpdateCheckingServiceRemotePut() throws Throwable { int serviceCount = 4; int updateCount = 20; List<Service> services = this.host.doThroughputServiceStart( serviceCount, MinimalTestService.class, this.host.buildMinimalTestState(), EnumSet.of(Service.ServiceOption.STRICT_UPDATE_CHECKING), null); List<Service> durableServices = this.host.doThroughputServiceStart( serviceCount, MinimalTestService.class, this.host.buildMinimalTestState(), EnumSet.of(ServiceOption.STRICT_UPDATE_CHECKING, ServiceOption.PERSISTENCE), null); this.host.log("starting remote test"); for (int i = 0; i < 3; i++) { this.host.doPutPerService(updateCount, EnumSet.of(TestProperty.FORCE_REMOTE), services); this.host.doPutPerService(updateCount, EnumSet.of(TestProperty.FORCE_REMOTE), durableServices); } this.host.log("starting expected failure test"); this.host.toggleNegativeTestMode(true); int count = 2; this.host.doPutPerService(count, EnumSet.of(TestProperty.FORCE_REMOTE, TestProperty.FORCE_FAILURE), services); this.host.doPutPerService(count, EnumSet.of(TestProperty.FORCE_REMOTE, TestProperty.FORCE_FAILURE), durableServices); this.host.toggleNegativeTestMode(false); }