language
stringclasses 1
value | repo
stringclasses 60
values | path
stringlengths 22
294
| class_span
dict | source
stringlengths 13
1.16M
| target
stringlengths 1
113
|
|---|---|---|---|---|---|
java
|
elastic__elasticsearch
|
server/src/main/java/org/elasticsearch/cluster/InternalClusterInfoService.java
|
{
"start": 3718,
"end": 9150
}
|
class ____ implements ClusterInfoService, ClusterStateListener {
private static final Logger logger = LogManager.getLogger(InternalClusterInfoService.class);
public static final Setting<TimeValue> INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING = Setting.timeSetting(
"cluster.info.update.interval",
TimeValue.timeValueSeconds(30),
TimeValue.timeValueSeconds(10),
Property.Dynamic,
Property.NodeScope
);
public static final Setting<TimeValue> INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING = Setting.positiveTimeSetting(
"cluster.info.update.timeout",
TimeValue.timeValueSeconds(15),
Property.Dynamic,
Property.NodeScope
);
public static final Setting<Boolean> CLUSTER_ROUTING_ALLOCATION_ESTIMATED_HEAP_THRESHOLD_DECIDER_ENABLED = Setting.boolSetting(
"cluster.routing.allocation.estimated_heap.threshold_enabled",
false,
Property.Dynamic,
Property.NodeScope
);
private volatile boolean diskThresholdEnabled;
private volatile boolean estimatedHeapThresholdEnabled;
private volatile WriteLoadDeciderStatus writeLoadConstraintEnabled;
private volatile TimeValue updateFrequency;
private volatile TimeValue fetchTimeout;
private final ThreadPool threadPool;
private final Client client;
private final Supplier<ClusterState> clusterStateSupplier;
private final List<Consumer<ClusterInfo>> listeners = new CopyOnWriteArrayList<>();
private final Object mutex = new Object();
private final List<ActionListener<ClusterInfo>> nextRefreshListeners = new ArrayList<>();
private final EstimatedHeapUsageCollector estimatedHeapUsageCollector;
private final NodeUsageStatsForThreadPoolsCollector nodeUsageStatsForThreadPoolsCollector;
private AsyncRefresh currentRefresh;
private RefreshScheduler refreshScheduler;
private volatile ClusterInfo currentClusterInfo = ClusterInfo.EMPTY;
@SuppressWarnings("this-escape")
public InternalClusterInfoService(
Settings settings,
ClusterService clusterService,
ThreadPool threadPool,
Client client,
EstimatedHeapUsageCollector estimatedHeapUsageCollector,
NodeUsageStatsForThreadPoolsCollector nodeUsageStatsForThreadPoolsCollector
) {
this.threadPool = threadPool;
this.client = client;
this.estimatedHeapUsageCollector = estimatedHeapUsageCollector;
this.nodeUsageStatsForThreadPoolsCollector = nodeUsageStatsForThreadPoolsCollector;
this.updateFrequency = INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING.get(settings);
this.fetchTimeout = INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING.get(settings);
this.diskThresholdEnabled = DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.get(settings);
this.clusterStateSupplier = clusterService::state;
ClusterSettings clusterSettings = clusterService.getClusterSettings();
clusterSettings.addSettingsUpdateConsumer(INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING, this::setFetchTimeout);
clusterSettings.addSettingsUpdateConsumer(INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING, this::setUpdateFrequency);
clusterSettings.addSettingsUpdateConsumer(
DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING,
this::setDiskThresholdEnabled
);
clusterSettings.initializeAndWatch(
CLUSTER_ROUTING_ALLOCATION_ESTIMATED_HEAP_THRESHOLD_DECIDER_ENABLED,
this::setEstimatedHeapThresholdEnabled
);
clusterSettings.initializeAndWatch(WRITE_LOAD_DECIDER_ENABLED_SETTING, this::setWriteLoadConstraintEnabled);
}
private void setDiskThresholdEnabled(boolean diskThresholdEnabled) {
this.diskThresholdEnabled = diskThresholdEnabled;
}
private void setEstimatedHeapThresholdEnabled(boolean estimatedHeapThresholdEnabled) {
this.estimatedHeapThresholdEnabled = estimatedHeapThresholdEnabled;
}
private void setWriteLoadConstraintEnabled(WriteLoadDeciderStatus writeLoadConstraintEnabled) {
this.writeLoadConstraintEnabled = writeLoadConstraintEnabled;
}
private void setFetchTimeout(TimeValue fetchTimeout) {
this.fetchTimeout = fetchTimeout;
}
void setUpdateFrequency(TimeValue updateFrequency) {
this.updateFrequency = updateFrequency;
}
@Override
public void clusterChanged(ClusterChangedEvent event) {
final Runnable newRefresh;
synchronized (mutex) {
if (event.localNodeMaster() == false) {
refreshScheduler = null;
return;
}
if (refreshScheduler == null) {
logger.trace("elected as master, scheduling cluster info update tasks");
refreshScheduler = new RefreshScheduler();
nextRefreshListeners.add(refreshScheduler.getListener());
}
newRefresh = getNewRefresh();
assert assertRefreshInvariant();
}
newRefresh.run();
// Refresh if a data node was added
for (DiscoveryNode addedNode : event.nodesDelta().addedNodes()) {
if (addedNode.canContainData()) {
refreshAsync(new PlainActionFuture<>());
break;
}
}
}
private
|
InternalClusterInfoService
|
java
|
alibaba__nacos
|
naming/src/test/java/com/alibaba/nacos/naming/controllers/v2/InstanceControllerV2Test.java
|
{
"start": 2618,
"end": 11620
}
|
class ____ extends BaseTest {
@InjectMocks
private InstanceControllerV2 instanceControllerV2;
@Mock
private InstanceOperatorClientImpl instanceServiceV2;
private MockMvc mockmvc;
private SmartSubscriber subscriber;
private volatile Class<? extends Event> eventReceivedClass;
@BeforeEach
public void before() {
super.before();
ReflectionTestUtils.setField(instanceControllerV2, "instanceServiceV2", instanceServiceV2);
mockmvc = MockMvcBuilders.standaloneSetup(instanceControllerV2).build();
subscriber = new SmartSubscriber() {
@Override
public List<Class<? extends Event>> subscribeTypes() {
List<Class<? extends Event>> result = new LinkedList<>();
result.add(UpdateInstanceTraceEvent.class);
return result;
}
@Override
public void onEvent(Event event) {
eventReceivedClass = event.getClass();
}
};
NotifyCenter.registerSubscriber(subscriber);
}
@AfterEach
void tearDown() throws Exception {
NotifyCenter.deregisterSubscriber(subscriber);
NotifyCenter.deregisterPublisher(UpdateInstanceTraceEvent.class);
eventReceivedClass = null;
}
@Test
void registerInstance() throws Exception {
InstanceForm instanceForm = new InstanceForm();
instanceForm.setNamespaceId(TEST_NAMESPACE);
instanceForm.setGroupName("DEFAULT_GROUP");
instanceForm.setServiceName("test-service");
instanceForm.setIp(TEST_IP);
instanceForm.setClusterName(TEST_CLUSTER_NAME);
instanceForm.setPort(9999);
instanceForm.setHealthy(true);
instanceForm.setWeight(1.0);
instanceForm.setEnabled(true);
instanceForm.setMetadata(TEST_METADATA);
instanceForm.setEphemeral(true);
Result<String> result = instanceControllerV2.register(instanceForm);
verify(instanceServiceV2).registerInstance(eq(TEST_NAMESPACE), eq(TEST_SERVICE_NAME), any());
assertEquals(ErrorCode.SUCCESS.getCode(), result.getCode());
assertEquals("ok", result.getData());
}
@Test
void deregisterInstance() throws Exception {
InstanceForm instanceForm = new InstanceForm();
instanceForm.setNamespaceId(TEST_NAMESPACE);
instanceForm.setGroupName("DEFAULT_GROUP");
instanceForm.setServiceName("test-service");
instanceForm.setIp(TEST_IP);
instanceForm.setClusterName(TEST_CLUSTER_NAME);
instanceForm.setPort(9999);
instanceForm.setHealthy(true);
instanceForm.setWeight(1.0);
instanceForm.setEnabled(true);
instanceForm.setMetadata(TEST_METADATA);
instanceForm.setEphemeral(true);
Result<String> result = instanceControllerV2.deregister(instanceForm);
verify(instanceServiceV2).removeInstance(eq(TEST_NAMESPACE), eq(TEST_SERVICE_NAME), any());
assertEquals(ErrorCode.SUCCESS.getCode(), result.getCode());
assertEquals("ok", result.getData());
}
@Test
void updateInstance() throws Exception {
InstanceForm instanceForm = new InstanceForm();
instanceForm.setNamespaceId(TEST_NAMESPACE);
instanceForm.setGroupName("DEFAULT_GROUP");
instanceForm.setServiceName("test-service");
instanceForm.setIp(TEST_IP);
instanceForm.setClusterName(TEST_CLUSTER_NAME);
instanceForm.setPort(9999);
instanceForm.setHealthy(true);
instanceForm.setWeight(1.0);
instanceForm.setEnabled(true);
instanceForm.setMetadata(TEST_METADATA);
instanceForm.setEphemeral(true);
Result<String> result = instanceControllerV2.update(instanceForm);
verify(instanceServiceV2).updateInstance(eq(TEST_NAMESPACE), eq(TEST_SERVICE_NAME), any());
assertEquals(ErrorCode.SUCCESS.getCode(), result.getCode());
assertEquals("ok", result.getData());
TimeUnit.SECONDS.sleep(1);
assertEquals(UpdateInstanceTraceEvent.class, eventReceivedClass);
}
@Test
void batchUpdateInstanceMetadata() throws Exception {
InstanceMetadataBatchOperationForm form = new InstanceMetadataBatchOperationForm();
form.setNamespaceId(TEST_NAMESPACE);
form.setGroupName("DEFAULT");
form.setServiceName("test-service");
form.setConsistencyType("ephemeral");
form.setInstances(TEST_INSTANCE_INFO_LIST);
form.setMetadata(TEST_METADATA);
ArrayList<String> ipList = new ArrayList<>();
ipList.add(TEST_IP);
when(instanceServiceV2.batchUpdateMetadata(eq(TEST_NAMESPACE), any(), any())).thenReturn(ipList);
InstanceMetadataBatchResult expectUpdate = new InstanceMetadataBatchResult(ipList);
Result<InstanceMetadataBatchResult> result = instanceControllerV2.batchUpdateInstanceMetadata(form);
verify(instanceServiceV2).batchUpdateMetadata(eq(TEST_NAMESPACE), any(), any());
assertEquals(ErrorCode.SUCCESS.getCode(), result.getCode());
assertEquals(expectUpdate.getUpdated().size(), result.getData().getUpdated().size());
assertEquals(expectUpdate.getUpdated().get(0), result.getData().getUpdated().get(0));
}
@Test
void patch() throws Exception {
MockHttpServletRequestBuilder builder = MockMvcRequestBuilders.patch(
UtilsAndCommons.DEFAULT_NACOS_NAMING_CONTEXT_V2 + UtilsAndCommons.NACOS_NAMING_INSTANCE_CONTEXT)
.param("namespaceId", TEST_NAMESPACE).param("serviceName", TEST_SERVICE_NAME).param("ip", TEST_IP)
.param("cluster", TEST_CLUSTER_NAME).param("port", "9999").param("healthy", "true")
.param("weight", "2.0").param("enabled", "true").param("metadata", TEST_METADATA)
.param("ephemeral", "false");
String actualValue = mockmvc.perform(builder).andReturn().getResponse().getContentAsString();
assertEquals("ok", actualValue);
}
@Test
void listInstance() throws Exception {
ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setName("serviceInfo");
when(instanceServiceV2.listInstance(eq(TEST_NAMESPACE), eq(TEST_SERVICE_NAME), any(), eq(TEST_CLUSTER_NAME),
eq(false))).thenReturn(serviceInfo);
Result<ServiceInfo> result = instanceControllerV2.list(TEST_NAMESPACE, "DEFAULT_GROUP", "test-service",
TEST_CLUSTER_NAME, TEST_IP, 9999, false, "", "", "");
verify(instanceServiceV2).listInstance(eq(TEST_NAMESPACE), eq(TEST_SERVICE_NAME), any(), eq(TEST_CLUSTER_NAME),
eq(false));
assertEquals(ErrorCode.SUCCESS.getCode(), result.getCode());
assertEquals(serviceInfo.getName(), result.getData().getName());
}
@Test
void detail() throws Exception {
Instance instance = new Instance();
instance.setInstanceId("test-id");
when(instanceServiceV2.getInstance(TEST_NAMESPACE, TEST_SERVICE_NAME, TEST_CLUSTER_NAME, TEST_IP,
9999)).thenReturn(instance);
Result<InstanceDetailInfoVo> result = instanceControllerV2.detail(TEST_NAMESPACE, "DEFAULT_GROUP",
"test-service", TEST_CLUSTER_NAME, TEST_IP, 9999);
verify(instanceServiceV2).getInstance(TEST_NAMESPACE, TEST_SERVICE_NAME, TEST_CLUSTER_NAME, TEST_IP, 9999);
assertEquals(ErrorCode.SUCCESS.getCode(), result.getCode());
assertEquals(instance.getInstanceId(), result.getData().getInstanceId());
}
@Test
void beat() throws Exception {
MockHttpServletRequestBuilder builder = MockMvcRequestBuilders.put(
UtilsAndCommons.DEFAULT_NACOS_NAMING_CONTEXT_V2 + UtilsAndCommons.NACOS_NAMING_INSTANCE_CONTEXT
+ "/beat").param("namespaceId", TEST_NAMESPACE).param("serviceName", TEST_SERVICE_NAME)
.param("ip", TEST_IP).param("clusterName", "clusterName").param("port", "0").param("beat", "");
String actualValue = mockmvc.perform(builder).andReturn().getResponse().getContentAsString();
assertNotNull(actualValue);
}
@Test
void listWithHealthStatus() throws Exception {
MockHttpServletRequestBuilder builder = MockMvcRequestBuilders.get(
UtilsAndCommons.DEFAULT_NACOS_NAMING_CONTEXT_V2 + UtilsAndCommons.NACOS_NAMING_INSTANCE_CONTEXT
+ "/statuses").param("key", "");
String actualValue = mockmvc.perform(builder).andReturn().getResponse().getContentAsString();
assertNotNull(actualValue);
}
}
|
InstanceControllerV2Test
|
java
|
spring-projects__spring-framework
|
spring-test/src/main/java/org/springframework/test/web/client/match/ContentRequestMatchers.java
|
{
"start": 15317,
"end": 15837
}
|
class ____ implements RequestMatcher {
@Override
public final void match(ClientHttpRequest request) throws IOException, AssertionError {
try {
MockClientHttpRequest mockRequest = (MockClientHttpRequest) request;
matchInternal(mockRequest);
}
catch (Exception ex) {
throw new AssertionError("Failed to parse expected or actual XML request content", ex);
}
}
protected abstract void matchInternal(MockClientHttpRequest request) throws Exception;
}
private static
|
AbstractXmlRequestMatcher
|
java
|
FasterXML__jackson-databind
|
src/main/java/tools/jackson/databind/util/RecordUtil.java
|
{
"start": 415,
"end": 496
}
|
class ____ finding so-called canonical constructor
* of Record types.
*/
public
|
for
|
java
|
elastic__elasticsearch
|
server/src/main/java/org/elasticsearch/action/get/TransportShardMultiGetFomTranslogAction.java
|
{
"start": 7173,
"end": 9492
}
|
class ____ extends ActionResponse {
private final MultiGetShardResponse multiGetShardResponse;
private final long primaryTerm;
private final long segmentGeneration;
public Response(MultiGetShardResponse response, long primaryTerm, long segmentGeneration) {
this.primaryTerm = primaryTerm;
this.segmentGeneration = segmentGeneration;
this.multiGetShardResponse = response;
}
public Response(StreamInput in) throws IOException {
segmentGeneration = in.readZLong();
multiGetShardResponse = new MultiGetShardResponse(in);
primaryTerm = in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0) ? in.readVLong() : Engine.UNKNOWN_PRIMARY_TERM;
}
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeZLong(segmentGeneration);
multiGetShardResponse.writeTo(out);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
out.writeVLong(primaryTerm);
}
}
public long segmentGeneration() {
return segmentGeneration;
}
public long primaryTerm() {
return primaryTerm;
}
public MultiGetShardResponse multiGetShardResponse() {
return multiGetShardResponse;
}
@Override
public String toString() {
return Strings.format(
"ShardMultiGetFomTranslogResponse{multiGetShardResponse=%s, primaryTerm=%d, segmentGeneration=%d}",
multiGetShardResponse,
primaryTerm,
segmentGeneration
);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o instanceof Response == false) return false;
Response response = (Response) o;
return segmentGeneration == response.segmentGeneration
&& Objects.equals(multiGetShardResponse, response.multiGetShardResponse)
&& primaryTerm == response.primaryTerm;
}
@Override
public int hashCode() {
return Objects.hash(segmentGeneration, multiGetShardResponse, primaryTerm);
}
}
}
|
Response
|
java
|
hibernate__hibernate-orm
|
hibernate-core/src/test/java/org/hibernate/orm/test/cdi/lifecycle/ExtendedBeanManagerSmokeTests.java
|
{
"start": 1093,
"end": 3038
}
|
class ____ {
@Test
public void testIntegrationSetting() {
verifyIntegrationSetting( JAKARTA_CDI_BEAN_MANAGER );
verifyIntegrationSetting( CDI_BEAN_MANAGER );
}
private static void verifyIntegrationSetting(String settingName) {
final ExtendedBeanManagerImpl ref = new ExtendedBeanManagerImpl();
assertThat( ref.lifecycleListener ).isNull();
final EntityManagerFactoryBuilder emfb = getEntityManagerFactoryBuilder(
new PersistenceUnitInfoAdapter(),
integrationSettings( settingName, ref )
);
assertApplied( ref, emfb.build() );
}
@Test
public void testUserSetting() {
verifyUserSettingWorks( JAKARTA_CDI_BEAN_MANAGER );
verifyUserSettingWorks( CDI_BEAN_MANAGER );
}
private static void verifyUserSettingWorks(String settingName) {
final ExtendedBeanManagerImpl ref = new ExtendedBeanManagerImpl();
assertThat( ref.lifecycleListener ).isNull();
final EntityManagerFactoryBuilder emfb = getEntityManagerFactoryBuilder(
new PersistenceUnitInfoAdapter(),
integrationSettings( settingName, ref )
);
assertApplied( ref, emfb.build() );
}
private static Map<String, Object> integrationSettings(String settingName, Object value) {
final Map<String, Object> settings = ServiceRegistryUtil.createBaseSettings();
settings.put( settingName, value );
return settings;
}
private static void assertApplied(ExtendedBeanManagerImpl ref, EntityManagerFactory emf) {
final SessionFactoryImplementor sfi = emf.unwrap( SessionFactoryImplementor.class );
final ManagedBeanRegistry beanRegistry = sfi.getManagedBeanRegistry();
assertThat( beanRegistry.getBeanContainer() ).isInstanceOf( CdiBeanContainerExtendedAccessImpl.class );
final CdiBeanContainerExtendedAccessImpl extensionWrapper = (CdiBeanContainerExtendedAccessImpl) beanRegistry.getBeanContainer();
assertThat( extensionWrapper.getBeanManager() ).isNull();
ref.notify( null );
}
public static
|
ExtendedBeanManagerSmokeTests
|
java
|
apache__camel
|
components/camel-http/src/test/java/org/apache/camel/component/http/HttpStreamCacheSpoolToDiskTest.java
|
{
"start": 1454,
"end": 3791
}
|
class ____ extends BaseHttpTest {
private HttpServer localServer;
@Override
public void setupResources() throws Exception {
localServer = ServerBootstrap.bootstrap()
.setCanonicalHostName("localhost").setHttpProcessor(getBasicHttpProcessor())
.setConnectionReuseStrategy(getConnectionReuseStrategy()).setResponseFactory(getHttpResponseFactory())
.setSslContext(getSSLContext())
.register("/test/", new BasicValidationHandler(GET.name(), null, null, getExpectedContent())).create();
localServer.start();
FileUtil.removeDir(new File("target/camel-cache"));
}
@Override
public void cleanupResources() throws Exception {
if (localServer != null) {
localServer.stop();
}
}
@Test
public void httpSpoolToDisk() throws Exception {
MockEndpoint result = getMockEndpoint("mock:result");
result.expectedBodiesReceived("camel rocks!");
result.expectedFileExists("target/output/rock.txt");
template.requestBody("direct:start", (String) null);
result.assertIsSatisfied();
}
@Override
protected RoutesBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
StreamCachingStrategy streamCachingStrategy = context.getStreamCachingStrategy();
streamCachingStrategy.setSpoolDirectory("target/camel-cache");
streamCachingStrategy.setSpoolThreshold(1); // spool to disk
streamCachingStrategy.setSpoolEnabled(true);
streamCachingStrategy.setBufferSize(4096);
from("direct:start").streamCache("true")
.to("http://localhost:" + localServer.getLocalPort() + "/test/?disableStreamCache=true")
.process(e -> {
// should be temp spool file
int files = new File("target/camel-cache").list().length;
assertEquals(1, files);
})
.to("file:target/output?fileName=rock.txt")
.to("mock:result");
}
};
}
}
|
HttpStreamCacheSpoolToDiskTest
|
java
|
apache__camel
|
core/camel-core/src/test/java/org/apache/camel/impl/SimpleShutdownGracefulTest.java
|
{
"start": 1099,
"end": 2143
}
|
class ____ extends ContextTestSupport {
private static String foo = "";
@Test
public void testShutdownGraceful() throws Exception {
getMockEndpoint("mock:foo").expectedMessageCount(1);
template.sendBody("seda:foo", "Hello World");
assertMockEndpointsSatisfied();
// now stop the route before its complete
foo = foo + "stop";
context.stop();
// it should wait as there was 1 inflight exchange when asked to stop
assertEquals("stopHello World", foo, "Should graceful shutdown");
}
@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
@Override
public void configure() {
from("seda:foo").to("mock:foo").delay(3000).process(new Processor() {
public void process(Exchange exchange) {
foo = foo + exchange.getIn().getBody(String.class);
}
});
}
};
}
}
|
SimpleShutdownGracefulTest
|
java
|
quarkusio__quarkus
|
independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/multipart/FormParserFactory.java
|
{
"start": 1486,
"end": 2146
}
|
interface ____<T> {
FormDataParser create(final ResteasyReactiveRequestContext exchange, Set<String> fileFormNames);
T setDefaultCharset(String charset);
}
public static Builder builder(Supplier<Executor> executorSupplier) {
return builder(true, executorSupplier);
}
public static Builder builder(boolean includeDefault, Supplier<Executor> executorSupplier) {
Builder builder = new Builder();
if (includeDefault) {
builder.addParsers(new FormEncodedDataDefinition(), new MultiPartParserDefinition(executorSupplier));
}
return builder;
}
public static
|
ParserDefinition
|
java
|
apache__hadoop
|
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmcontainer/RMContainerReservedEvent.java
|
{
"start": 1303,
"end": 2104
}
|
class ____ extends RMContainerEvent {
private final Resource reservedResource;
private final NodeId reservedNode;
private final SchedulerRequestKey reservedSchedulerKey;
public RMContainerReservedEvent(ContainerId containerId,
Resource reservedResource, NodeId reservedNode,
SchedulerRequestKey reservedSchedulerKey) {
super(containerId, RMContainerEventType.RESERVED);
this.reservedResource = reservedResource;
this.reservedNode = reservedNode;
this.reservedSchedulerKey = reservedSchedulerKey;
}
public Resource getReservedResource() {
return reservedResource;
}
public NodeId getReservedNode() {
return reservedNode;
}
public SchedulerRequestKey getReservedSchedulerKey() {
return reservedSchedulerKey;
}
}
|
RMContainerReservedEvent
|
java
|
apache__camel
|
components/camel-ai/camel-djl/src/main/java/org/apache/camel/component/djl/model/nlp/ZooFillMaskPredictor.java
|
{
"start": 1180,
"end": 1873
}
|
class ____ extends AbstractNlpZooPredictor<String[]> {
public ZooFillMaskPredictor(DJLEndpoint endpoint) throws ModelNotFoundException, MalformedModelException, IOException {
super(endpoint);
Criteria.Builder<String, String[]> builder = Criteria.builder()
.optApplication(Application.NLP.FILL_MASK)
.setTypes(String.class, String[].class)
.optArtifactId(endpoint.getArtifactId());
if (endpoint.isShowProgress()) {
builder.optProgress(new ProgressBar());
}
Criteria<String, String[]> criteria = builder.build();
this.model = ModelZoo.loadModel(criteria);
}
}
|
ZooFillMaskPredictor
|
java
|
elastic__elasticsearch
|
x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/agg/PercentilesAgg.java
|
{
"start": 615,
"end": 1255
}
|
class ____ extends DefaultAggSourceLeafAgg {
private final List<Double> percents;
private final PercentilesConfig percentilesConfig;
public PercentilesAgg(String id, AggSource source, List<Double> percents, PercentilesConfig percentilesConfig) {
super(id, source);
this.percents = percents;
this.percentilesConfig = percentilesConfig;
}
@Override
Function<String, ValuesSourceAggregationBuilder<?>> builder() {
return s -> percentiles(s).percentiles(percents.stream().mapToDouble(Double::doubleValue).toArray())
.percentilesConfig(percentilesConfig);
}
}
|
PercentilesAgg
|
java
|
processing__processing4
|
core/src/processing/opengl/PGraphicsOpenGL.java
|
{
"start": 29738,
"end": 31388
}
|
class ____ extends Disposable<PShader> {
int glProgram;
int glVertex;
int glFragment;
private PGL pgl;
final private int context;
public GLResourceShader(PShader sh) {
super(sh);
this.pgl = sh.pgl.graphics.getPrimaryPGL();
sh.glProgram = pgl.createProgram();
sh.glVertex = pgl.createShader(PGL.VERTEX_SHADER);
sh.glFragment = pgl.createShader(PGL.FRAGMENT_SHADER);
this.glProgram = sh.glProgram;
this.glVertex = sh.glVertex;
this.glFragment = sh.glFragment;
this.context = sh.context;
}
@Override
public void disposeNative() {
if (pgl != null) {
if (glFragment != 0) {
pgl.deleteShader(glFragment);
glFragment = 0;
}
if (glVertex != 0) {
pgl.deleteShader(glVertex);
glVertex = 0;
}
if (glProgram != 0) {
pgl.deleteProgram(glProgram);
glProgram = 0;
}
pgl = null;
}
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof GLResourceShader)) {
return false;
}
GLResourceShader other = (GLResourceShader)obj;
return other.glProgram == glProgram &&
other.glVertex == glVertex &&
other.glFragment == glFragment &&
other.context == context;
}
@Override
public int hashCode() {
int result = 17;
result = 31 * result + glProgram;
result = 31 * result + glVertex;
result = 31 * result + glFragment;
result = 31 * result + context;
return result;
}
}
protected static
|
GLResourceShader
|
java
|
elastic__elasticsearch
|
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/profile/ActivateProfileRequest.java
|
{
"start": 457,
"end": 684
}
|
class ____ extends GrantRequest {
public ActivateProfileRequest() {
super();
}
@Override
public ActionRequestValidationException validate() {
return super.validate();
}
}
|
ActivateProfileRequest
|
java
|
google__dagger
|
javatests/artifacts/hilt-android/simple/app/src/sharedTest/java/dagger/hilt/android/simple/ModuleTest.java
|
{
"start": 3545,
"end": 3636
}
|
class ____ {
@Binds
abstract Foo foo(FooImpl fooImpl);
}
|
AbstractModuleBindsMethod
|
java
|
apache__hadoop
|
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextUtilBase.java
|
{
"start": 1802,
"end": 3895
}
|
class ____ {
protected final FileContextTestHelper fileContextTestHelper = new FileContextTestHelper();
protected FileContext fc;
{
try {
GenericTestUtils.setLogLevel(FileSystem.LOG, Level.DEBUG);
} catch(Exception e) {
System.out.println("Cannot change log level\n"
+ StringUtils.stringifyException(e));
}
}
@BeforeEach
public void setUp() throws Exception {
fc.mkdir(fileContextTestHelper.getTestRootPath(fc), FileContext.DEFAULT_PERM, true);
}
@AfterEach
public void tearDown() throws Exception {
if (fc != null) {
fc.delete(fileContextTestHelper.getTestRootPath(fc), true);
}
}
@Test
public void testFcCopy() throws Exception{
final String ts = "some random text";
Path file1 = fileContextTestHelper.getTestRootPath(fc, "file1");
Path file2 = fileContextTestHelper.getTestRootPath(fc, "file2");
writeFile(fc, file1, ts.getBytes());
assertTrue(fc.util().exists(file1));
fc.util().copy(file1, file2);
// verify that newly copied file2 exists
assertTrue(fc.util().exists(file2), "Failed to copy file2 ");
// verify that file2 contains test string
assertTrue(Arrays.equals(ts.getBytes(),
readFile(fc, file2, ts.getBytes().length)), "Copied files does not match ");
}
@Test
public void testRecursiveFcCopy() throws Exception {
final String ts = "some random text";
Path dir1 = fileContextTestHelper.getTestRootPath(fc, "dir1");
Path dir2 = fileContextTestHelper.getTestRootPath(fc, "dir2");
Path file1 = new Path(dir1, "file1");
fc.mkdir(dir1, null, false);
writeFile(fc, file1, ts.getBytes());
assertTrue(fc.util().exists(file1));
Path file2 = new Path(dir2, "file1");
fc.util().copy(dir1, dir2);
// verify that newly copied file2 exists
assertTrue(fc.util().exists(file2), "Failed to copy file2 ");
// verify that file2 contains test string
assertTrue(Arrays.equals(ts.getBytes(),
readFile(fc, file2, ts.getBytes().length)), "Copied files does not match ");
}
}
|
FileContextUtilBase
|
java
|
apache__dubbo
|
dubbo-plugin/dubbo-rest-jaxrs/src/main/java/org/apache/dubbo/rpc/protocol/tri/rest/support/jaxrs/filter/ContainerRequestContextImpl.java
|
{
"start": 1957,
"end": 6132
}
|
class ____ implements ContainerRequestContext {
private final HttpRequest request;
private final HttpResponse response;
private Request req;
private MultivaluedMap<String, String> headers;
private UriInfo uriInfo;
private boolean aborted;
public ContainerRequestContextImpl(HttpRequest request, HttpResponse response) {
this.request = request;
this.response = response;
}
@Override
public Object getProperty(String name) {
return request.attribute(name);
}
@Override
public Collection<String> getPropertyNames() {
return request.parameterNames();
}
@Override
public void setProperty(String name, Object object) {
request.setAttribute(name, object);
}
@Override
public void removeProperty(String name) {
request.removeAttribute(name);
}
@Override
public UriInfo getUriInfo() {
UriInfo uriInfo = this.uriInfo;
if (uriInfo == null) {
uriInfo = new ResteasyUriInfo(request.rawPath(), request.query(), "/");
this.uriInfo = uriInfo;
}
return uriInfo;
}
@Override
public void setRequestUri(URI requestUri) {
String query = requestUri.getRawQuery();
request.setUri(requestUri.getRawPath() + (query == null ? "" : '?' + query));
}
@Override
public void setRequestUri(URI baseUri, URI requestUri) {
String query = requestUri.getRawQuery();
request.setUri(baseUri.getRawPath() + requestUri.getRawPath() + (query == null ? "" : '?' + query));
}
@Override
public Request getRequest() {
Request req = this.req;
if (req == null) {
req = new RequestImpl(new JaxrsHttpRequestAdapter(request), new JaxrsHttpResponseAdapter(response));
this.req = req;
}
return req;
}
@Override
public String getMethod() {
return request.method();
}
@Override
public void setMethod(String method) {
request.setMethod(method);
}
@Override
public MultivaluedMap<String, String> getHeaders() {
MultivaluedMap<String, String> headers = this.headers;
if (headers == null) {
headers = new MultivaluedMapWrapper<>(request.headers());
this.headers = headers;
}
return headers;
}
@Override
public String getHeaderString(String name) {
return request.header(name);
}
@Override
public Date getDate() {
return null;
}
@Override
public Locale getLanguage() {
return request.locale();
}
@Override
public int getLength() {
return request.contentLength();
}
@Override
public MediaType getMediaType() {
return Helper.toMediaType(request.mediaType());
}
@Override
public List<MediaType> getAcceptableMediaTypes() {
return Helper.toMediaTypes(request.accept());
}
@Override
public List<Locale> getAcceptableLanguages() {
return request.locales();
}
@Override
public Map<String, Cookie> getCookies() {
Collection<HttpCookie> cookies = request.cookies();
Map<String, Cookie> result = new HashMap<>(cookies.size());
for (HttpCookie cookie : cookies) {
result.put(cookie.name(), Helper.convert(cookie));
}
return result;
}
@Override
@SuppressWarnings("resource")
public boolean hasEntity() {
return request.inputStream() != null;
}
@Override
public InputStream getEntityStream() {
return request.inputStream();
}
@Override
public void setEntityStream(InputStream input) {
request.setInputStream(input);
}
@Override
public SecurityContext getSecurityContext() {
return null;
}
@Override
public void setSecurityContext(SecurityContext context) {}
@Override
public void abortWith(Response response) {
this.response.setBody(Helper.toBody(response));
aborted = true;
}
public boolean isAborted() {
return aborted;
}
}
|
ContainerRequestContextImpl
|
java
|
apache__hadoop
|
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/gpu/TestGpuDiscoverer.java
|
{
"start": 2407,
"end": 23413
}
|
class ____ {
private static final Logger LOG = LoggerFactory.getLogger(
TestGpuDiscoverer.class);
private static final String PATH = "PATH";
private static final String NVIDIA = "nvidia";
private static final String EXEC_PERMISSION = "u+x";
private static final String BASH_SHEBANG = "#!/bin/bash\n\n";
private static final String TEST_PARENT_DIR = new File("target/temp/" +
TestGpuDiscoverer.class.getName()).getAbsolutePath();
private NvidiaBinaryHelper binaryHelper = new NvidiaBinaryHelper();
private String getTestParentFolder() {
File f = new File("target/temp/" + TestGpuDiscoverer.class.getName());
return f.getAbsolutePath();
}
private void touchFile(File f) throws IOException {
new FileOutputStream(f).close();
}
private File setupFakeBinary(Configuration conf) {
return setupFakeBinary(conf,
GpuDiscoverer.DEFAULT_BINARY_NAME, false);
}
private File setupFakeBinary(Configuration conf, String filename,
boolean useFullPath) {
File fakeBinary;
try {
fakeBinary = new File(getTestParentFolder(),
filename);
touchFile(fakeBinary);
if (useFullPath) {
conf.set(YarnConfiguration.NM_GPU_PATH_TO_EXEC,
fakeBinary.getAbsolutePath());
} else {
conf.set(YarnConfiguration.NM_GPU_PATH_TO_EXEC, getTestParentFolder());
}
} catch (Exception e) {
throw new RuntimeException("Failed to init fake binary", e);
}
return fakeBinary;
}
@BeforeEach
public void before() throws IOException {
assumeNotWindows();
File f = new File(TEST_PARENT_DIR);
FileUtils.deleteDirectory(f);
f.mkdirs();
}
private Configuration createConfigWithAllowedDevices(String s) {
Configuration conf = new Configuration(false);
conf.set(NM_GPU_ALLOWED_DEVICES, s);
setupFakeBinary(conf);
return conf;
}
private void createNvidiaSmiScript(File file) {
writeToFile(file, BASH_SHEBANG +
"echo '<nvidia_smi_log></nvidia_smi_log>'");
}
private void createFaultyNvidiaSmiScript(File file) {
writeToFile(file, BASH_SHEBANG + "echo <<'");
}
private void createNvidiaSmiScriptWithInvalidXml(File file) {
writeToFile(file, BASH_SHEBANG + "echo '<nvidia_smi_log></bla>'");
}
private static void writeToFile(File file, String contents) {
try {
PrintWriter fileWriter = new PrintWriter(file);
fileWriter.write(contents);
fileWriter.close();
} catch (Exception e) {
throw new RuntimeException("Error while writing nvidia-smi script file!",
e);
}
}
private void assertNvidiaIsOnPath(GpuDiscoverer discoverer) {
String path = discoverer.getEnvironmentToRunCommand().get(PATH);
assertNotNull(path);
assertTrue(path.contains(NVIDIA));
}
private File createFakeNvidiaSmiScriptAsRunnableFile(
Consumer<File> scriptFileCreator) throws IOException {
File fakeBinary = new File(TEST_PARENT_DIR, DEFAULT_BINARY_NAME);
touchFile(fakeBinary);
scriptFileCreator.accept(fakeBinary);
Shell.execCommand(Shell.getSetPermissionCommand(EXEC_PERMISSION, false,
fakeBinary.getAbsolutePath()));
return fakeBinary;
}
private GpuDiscoverer creatediscovererWithGpuPathDefined(
Configuration conf) throws YarnException {
conf.set(YarnConfiguration.NM_GPU_PATH_TO_EXEC, TEST_PARENT_DIR);
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
return discoverer;
}
@Test
public void testLinuxGpuResourceDiscoverPluginConfig() throws Exception {
// Only run this on demand.
assumeTrue(Boolean.valueOf(
System.getProperty("RunLinuxGpuResourceDiscoverPluginConfigTest")));
// test case 1, check default setting.
Configuration conf = new Configuration(false);
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
assertEquals(DEFAULT_BINARY_NAME, discoverer.getPathOfGpuBinary());
assertNvidiaIsOnPath(discoverer);
// test case 2, check mandatory set path.
File fakeBinary = setupFakeBinary(conf);
discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
assertEquals(fakeBinary.getAbsolutePath(),
discoverer.getPathOfGpuBinary());
assertNull(discoverer.getEnvironmentToRunCommand().get(PATH));
// test case 3, check mandatory set path,
// but binary doesn't exist so default path will be used.
fakeBinary.delete();
discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
assertEquals(DEFAULT_BINARY_NAME,
discoverer.getPathOfGpuBinary());
assertNvidiaIsOnPath(discoverer);
}
@Test
public void testGetGpuDeviceInformationValidNvidiaSmiScript()
throws YarnException, IOException {
Configuration conf = new Configuration(false);
File fakeBinary = createFakeNvidiaSmiScriptAsRunnableFile(
this::createNvidiaSmiScript);
GpuDiscoverer discoverer = creatediscovererWithGpuPathDefined(conf);
assertEquals(fakeBinary.getAbsolutePath(),
discoverer.getPathOfGpuBinary());
assertNull(discoverer.getEnvironmentToRunCommand().get(PATH));
GpuDeviceInformation result =
discoverer.getGpuDeviceInformation();
assertNotNull(result);
}
@Test
public void testGetGpuDeviceInformationFakeNvidiaSmiScriptConsecutiveRun()
throws YarnException, IOException {
Configuration conf = new Configuration(false);
File fakeBinary = createFakeNvidiaSmiScriptAsRunnableFile(
this::createNvidiaSmiScript);
GpuDiscoverer discoverer = creatediscovererWithGpuPathDefined(conf);
assertEquals(fakeBinary.getAbsolutePath(),
discoverer.getPathOfGpuBinary());
assertNull(discoverer.getEnvironmentToRunCommand().get(PATH));
for (int i = 0; i < 5; i++) {
GpuDeviceInformation result = discoverer.getGpuDeviceInformation();
assertNotNull(result);
}
}
@Test
public void testGetGpuDeviceInformationFaultyNvidiaSmiScript()
throws YarnException, IOException {
YarnException exception = assertThrows(YarnException.class, () -> {
Configuration conf = new Configuration(false);
File fakeBinary = createFakeNvidiaSmiScriptAsRunnableFile(
this::createFaultyNvidiaSmiScript);
GpuDiscoverer discoverer = creatediscovererWithGpuPathDefined(conf);
assertEquals(fakeBinary.getAbsolutePath(),
discoverer.getPathOfGpuBinary());
assertNull(discoverer.getEnvironmentToRunCommand().get(PATH));
discoverer.getGpuDeviceInformation();
});
assertThat(exception.getMessage()).contains("Failed to execute GPU device detection script");
}
@Test
public void testGetGpuDeviceInformationFaultyNvidiaSmiScriptConsecutiveRun()
throws YarnException, IOException {
Configuration conf = new Configuration(false);
File fakeBinary = createFakeNvidiaSmiScriptAsRunnableFile(
this::createNvidiaSmiScript);
GpuDiscoverer discoverer = creatediscovererWithGpuPathDefined(conf);
assertEquals(fakeBinary.getAbsolutePath(),
discoverer.getPathOfGpuBinary());
assertNull(discoverer.getEnvironmentToRunCommand().get(PATH));
LOG.debug("Querying nvidia-smi correctly, once...");
discoverer.getGpuDeviceInformation();
LOG.debug("Replacing script with faulty version!");
createFaultyNvidiaSmiScript(fakeBinary);
final String terminateMsg = "Failed to execute GPU device " +
"detection script (" + fakeBinary.getAbsolutePath() + ") for 10 times";
final String msg = "Failed to execute GPU device detection script";
for (int i = 0; i < 10; i++) {
try {
LOG.debug("Executing faulty nvidia-smi script...");
discoverer.getGpuDeviceInformation();
fail("Query of GPU device info via nvidia-smi should fail as " +
"script should be faulty: " + fakeBinary);
} catch (YarnException e) {
assertThat(e.getMessage()).contains(msg);
assertThat(e.getMessage()).doesNotContain(terminateMsg);
}
}
try {
LOG.debug("Executing faulty nvidia-smi script again..." +
"We should reach the error threshold now!");
discoverer.getGpuDeviceInformation();
fail("Query of GPU device info via nvidia-smi should fail as " +
"script should be faulty: " + fakeBinary);
} catch (YarnException e) {
assertThat(e.getMessage()).contains(terminateMsg);
}
LOG.debug("Verifying if GPUs are still hold the value of " +
"first successful query");
assertNotNull(discoverer.getGpusUsableByYarn());
}
@Test
public void testGetGpuDeviceInformationOverrideMaxErrors()
throws YarnException, IOException {
Configuration conf = new Configuration(false);
// The default is 10 max errors. Override to 11.
conf.setInt(YarnConfiguration.NM_GPU_DISCOVERY_MAX_ERRORS, 11);
// Initial creation will call the script once. Start out with a successful
// script. Otherwise, our error count assertions will be off by one later.
File fakeBinary = createFakeNvidiaSmiScriptAsRunnableFile(
this::createNvidiaSmiScript);
GpuDiscoverer discoverer = creatediscovererWithGpuPathDefined(conf);
assertEquals(fakeBinary.getAbsolutePath(),
discoverer.getPathOfGpuBinary());
assertNull(discoverer.getEnvironmentToRunCommand().get(PATH));
LOG.debug("Replacing script with faulty version!");
createFaultyNvidiaSmiScript(fakeBinary);
final String terminateMsg = "Failed to execute GPU device " +
"detection script (" + fakeBinary.getAbsolutePath() + ") for 11 times";
final String msg = "Failed to execute GPU device detection script";
// We expect 11 attempts (not the default of 10).
for (int i = 0; i < 11; i++) {
try {
LOG.debug("Executing faulty nvidia-smi script...");
discoverer.getGpuDeviceInformation();
fail("Query of GPU device info via nvidia-smi should fail as " +
"script should be faulty: " + fakeBinary);
} catch (YarnException e) {
assertThat(e.getMessage()).contains(msg);
assertThat(e.getMessage()).doesNotContain(terminateMsg);
}
}
// On a 12th attempt, we've exceed the configured max of 11, so we expect
// the termination message.
try {
LOG.debug("Executing faulty nvidia-smi script again..." +
"We should reach the error threshold now!");
discoverer.getGpuDeviceInformation();
fail("Query of GPU device info via nvidia-smi should fail as " +
"script should be faulty: " + fakeBinary);
} catch (YarnException e) {
assertThat(e.getMessage()).contains(terminateMsg);
}
LOG.debug("Verifying if GPUs are still hold the value of " +
"first successful query");
assertNotNull(discoverer.getGpusUsableByYarn());
}
@Test
public void testGetGpuDeviceInformationDisableMaxErrors()
throws YarnException, IOException {
Configuration conf = new Configuration(false);
// A negative value should disable max errors enforcement.
conf.setInt(YarnConfiguration.NM_GPU_DISCOVERY_MAX_ERRORS, -1);
File fakeBinary = createFakeNvidiaSmiScriptAsRunnableFile(
this::createFaultyNvidiaSmiScript);
GpuDiscoverer discoverer = creatediscovererWithGpuPathDefined(conf);
assertEquals(fakeBinary.getAbsolutePath(),
discoverer.getPathOfGpuBinary());
assertNull(discoverer.getEnvironmentToRunCommand().get(PATH));
final String terminateMsg = "Failed to execute GPU device " +
"detection script (" + fakeBinary.getAbsolutePath() + ") for 10 times";
final String msg = "Failed to execute GPU device detection script";
// The default max errors is 10. Verify that it keeps going for more, and we
// never see the termination message.
for (int i = 0; i < 20; ++i) {
YarnException exception = assertThrows(YarnException.class, () -> {
discoverer.getGpuDeviceInformation();
});
assertThat(exception.getMessage()).contains(msg);
assertThat(exception.getMessage()).doesNotContain(terminateMsg);
}
}
@Test
public void testGetGpuDeviceInformationNvidiaSmiScriptWithInvalidXml()
throws YarnException, IOException {
YarnException yarnException = assertThrows(YarnException.class, () -> {
Configuration conf = new Configuration(false);
File fakeBinary = createFakeNvidiaSmiScriptAsRunnableFile(
this::createNvidiaSmiScriptWithInvalidXml);
GpuDiscoverer discoverer = creatediscovererWithGpuPathDefined(conf);
assertEquals(fakeBinary.getAbsolutePath(),
discoverer.getPathOfGpuBinary());
assertNull(discoverer.getEnvironmentToRunCommand().get(PATH));
discoverer.getGpuDeviceInformation();
});
assertThat(yarnException.getMessage()).contains("Failed to parse XML output of " +
"GPU device detection script");
}
@Test
public void testGpuDiscover() throws YarnException {
// Since this is more of a performance unit test, only run if
// RunUserLimitThroughput is set (-DRunUserLimitThroughput=true)
assumeTrue(
Boolean.valueOf(System.getProperty("runGpuDiscoverUnitTest")));
Configuration conf = new Configuration(false);
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
GpuDeviceInformation info = discoverer.getGpuDeviceInformation();
assertTrue(info.getGpus().size() > 0);
assertEquals(discoverer.getGpusUsableByYarn().size(),
info.getGpus().size());
}
@Test
public void testGetNumberOfUsableGpusFromConfigSingleDevice()
throws YarnException {
Configuration conf = createConfigWithAllowedDevices("1:2");
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
List<GpuDevice> usableGpuDevices = discoverer.getGpusUsableByYarn();
assertEquals(1, usableGpuDevices.size());
assertEquals(1, usableGpuDevices.get(0).getIndex());
assertEquals(2, usableGpuDevices.get(0).getMinorNumber());
}
@Test
public void testGetNumberOfUsableGpusFromConfigIllegalFormat()
throws YarnException {
assertThrows(GpuDeviceSpecificationException.class, () -> {
Configuration conf = createConfigWithAllowedDevices("0:0,1:1,2:2,3");
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
discoverer.getGpusUsableByYarn();
});
}
@Test
public void testGetNumberOfUsableGpusFromConfig() throws YarnException {
Configuration conf = createConfigWithAllowedDevices("0:0,1:1,2:2,3:4");
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
List<GpuDevice> usableGpuDevices = discoverer.getGpusUsableByYarn();
assertEquals(4, usableGpuDevices.size());
assertEquals(0, usableGpuDevices.get(0).getIndex());
assertEquals(0, usableGpuDevices.get(0).getMinorNumber());
assertEquals(1, usableGpuDevices.get(1).getIndex());
assertEquals(1, usableGpuDevices.get(1).getMinorNumber());
assertEquals(2, usableGpuDevices.get(2).getIndex());
assertEquals(2, usableGpuDevices.get(2).getMinorNumber());
assertEquals(3, usableGpuDevices.get(3).getIndex());
assertEquals(4, usableGpuDevices.get(3).getMinorNumber());
}
@Test
public void testGetNumberOfUsableGpusFromConfigDuplicateValues()
throws YarnException {
assertThrows(GpuDeviceSpecificationException.class, () -> {
Configuration conf = createConfigWithAllowedDevices("0:0,1:1,2:2,1:1");
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
discoverer.getGpusUsableByYarn();
});
}
@Test
public void testGetNumberOfUsableGpusFromConfigDuplicateValues2()
throws YarnException {
assertThrows(GpuDeviceSpecificationException.class, () -> {
Configuration conf = createConfigWithAllowedDevices("0:0,1:1,2:2,1:1,2:2");
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
discoverer.getGpusUsableByYarn();
});
}
@Test
public void testGetNumberOfUsableGpusFromConfigIncludingSpaces()
throws YarnException {
assertThrows(GpuDeviceSpecificationException.class, () -> {
Configuration conf = createConfigWithAllowedDevices("0 : 0,1 : 1");
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
discoverer.getGpusUsableByYarn();
});
}
@Test
public void testGetNumberOfUsableGpusFromConfigIncludingGibberish()
throws YarnException {
assertThrows(GpuDeviceSpecificationException.class, () -> {
Configuration conf = createConfigWithAllowedDevices("0:@$1,1:1");
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
discoverer.getGpusUsableByYarn();
});
}
@Test
public void testGetNumberOfUsableGpusFromConfigIncludingLetters()
throws YarnException {
assertThrows(GpuDeviceSpecificationException.class, () -> {
Configuration conf = createConfigWithAllowedDevices("x:0, 1:y");
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
discoverer.getGpusUsableByYarn();
});
}
@Test
public void testGetNumberOfUsableGpusFromConfigWithoutIndexNumber()
throws YarnException {
assertThrows(GpuDeviceSpecificationException.class, () -> {
Configuration conf = createConfigWithAllowedDevices(":0, :1");
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
discoverer.getGpusUsableByYarn();
});
}
@Test
public void testGetNumberOfUsableGpusFromConfigEmptyString()
throws YarnException {
assertThrows(GpuDeviceSpecificationException.class, () -> {
Configuration conf = createConfigWithAllowedDevices("");
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
discoverer.getGpusUsableByYarn();
});
}
@Test
public void testGetNumberOfUsableGpusFromConfigValueWithoutComma()
throws YarnException {
assertThrows(GpuDeviceSpecificationException.class, () -> {
Configuration conf = createConfigWithAllowedDevices("0:0 0:1");
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
discoverer.getGpusUsableByYarn();
});
}
@Test
public void testGetNumberOfUsableGpusFromConfigValueWithoutComma2()
throws YarnException {
assertThrows(GpuDeviceSpecificationException.class, () -> {
Configuration conf = createConfigWithAllowedDevices("0.1 0.2");
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
discoverer.getGpusUsableByYarn();
});
}
@Test
public void testGetNumberOfUsableGpusFromConfigValueWithoutColonSeparator()
throws YarnException {
assertThrows(GpuDeviceSpecificationException.class, () -> {
Configuration conf = createConfigWithAllowedDevices("0.1,0.2");
GpuDiscoverer discoverer = new GpuDiscoverer();
discoverer.initialize(conf, binaryHelper);
discoverer.getGpusUsableByYarn();
});
}
@Test
public void testGpuBinaryIsANotExistingFile() {
Configuration conf = new Configuration(false);
conf.set(YarnConfiguration.NM_GPU_PATH_TO_EXEC, "/blabla");
GpuDiscoverer plugin = new GpuDiscoverer();
try {
plugin.initialize(conf, binaryHelper);
plugin.getGpusUsableByYarn();
fail("Illegal format, should fail.");
} catch (YarnException e) {
String message = e.getMessage();
assertTrue(message.startsWith("Failed to find GPU discovery " +
"executable, please double check"));
assertTrue(message.contains("Also tried to find the " +
"executable in the default directories:"));
}
}
@Test
public void testScriptNotCalled() throws YarnException, IOException {
Configuration conf = new Configuration();
conf.set(YarnConfiguration.NM_GPU_ALLOWED_DEVICES, "0:1,2:3");
GpuDiscoverer gpuSpy = spy(GpuDiscoverer.class);
gpuSpy.initialize(conf, binaryHelper);
gpuSpy.getGpusUsableByYarn();
verify(gpuSpy, never()).getGpuDeviceInformation();
}
@Test
public void testBinaryIsNotNvidiaSmi() throws YarnException {
YarnException yarnException = assertThrows(YarnException.class, () -> {
Configuration conf = new Configuration(false);
setupFakeBinary(conf, "badfile", true);
GpuDiscoverer plugin = new GpuDiscoverer();
plugin.initialize(conf, binaryHelper);
});
String format = String.format("It should point to an %s binary, which is now %s",
"nvidia-smi", "badfile");
assertThat(yarnException.getMessage()).contains(format);
}
}
|
TestGpuDiscoverer
|
java
|
elastic__elasticsearch
|
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/Sha256.java
|
{
"start": 880,
"end": 2057
}
|
class ____ extends AbstractHashFunction {
public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(Expression.class, "SHA256", Sha256::new);
private static final Hash.HashFunction SHA256 = Hash.HashFunction.create("SHA256");
@FunctionInfo(
returnType = "keyword",
description = "Computes the SHA256 hash of the input.",
examples = { @Example(file = "hash", tag = "sha256") }
)
public Sha256(Source source, @Param(name = "input", type = { "keyword", "text" }, description = "Input to hash.") Expression input) {
super(source, input);
}
private Sha256(StreamInput in) throws IOException {
super(in);
}
@Override
protected Hash.HashFunction getHashFunction() {
return SHA256;
}
@Override
public String getWriteableName() {
return ENTRY.name;
}
@Override
public Expression replaceChildren(List<Expression> newChildren) {
return new Sha256(source(), newChildren.get(0));
}
@Override
protected NodeInfo<? extends Expression> info() {
return NodeInfo.create(this, Sha256::new, field);
}
}
|
Sha256
|
java
|
apache__flink
|
flink-runtime/src/main/java/org/apache/flink/runtime/state/ttl/TtlReducingState.java
|
{
"start": 1235,
"end": 2525
}
|
class ____<K, N, T>
extends AbstractTtlState<K, N, T, TtlValue<T>, InternalReducingState<K, N, TtlValue<T>>>
implements InternalReducingState<K, N, T> {
TtlReducingState(
TtlStateContext<InternalReducingState<K, N, TtlValue<T>>, T> tTtlStateContext) {
super(tTtlStateContext);
}
@Override
public T get() throws Exception {
accessCallback.run();
return getInternal();
}
@Override
public void add(T value) throws Exception {
accessCallback.run();
original.add(wrapWithTs(value));
}
@Nullable
@Override
public TtlValue<T> getUnexpiredOrNull(@Nonnull TtlValue<T> ttlValue) {
return expired(ttlValue) ? null : ttlValue;
}
@Override
public void clear() {
original.clear();
}
@Override
public void mergeNamespaces(N target, Collection<N> sources) throws Exception {
original.mergeNamespaces(target, sources);
}
@Override
public T getInternal() throws Exception {
return getWithTtlCheckAndUpdate(original::getInternal, original::updateInternal);
}
@Override
public void updateInternal(T valueToStore) throws Exception {
original.updateInternal(wrapWithTs(valueToStore));
}
}
|
TtlReducingState
|
java
|
apache__commons-lang
|
src/test/java/org/apache/commons/lang3/exception/ExceptionUtilsTest.java
|
{
"start": 3845,
"end": 41306
}
|
class ____ extends Throwable {
private static final long serialVersionUID = 1L;
}
private static int redeclareCheckedException() {
return throwsCheckedException();
}
private static int throwsCheckedException() {
try {
throw new IOException();
} catch (final Exception e) {
ExceptionUtils.asRuntimeException(e);
return -1;
}
}
private ExceptionWithCause cyclicCause;
private Throwable jdkNoCause;
private NestableException nested;
private Throwable notVisibleException;
private Throwable withCause;
private Throwable withoutCause;
private Throwable createExceptionWithCause() {
try {
try {
throw new ExceptionWithCause(createExceptionWithoutCause());
} catch (final Throwable t) {
throw new ExceptionWithCause(t);
}
} catch (final Throwable t) {
return t;
}
}
private Throwable createExceptionWithoutCause() {
try {
throw new ExceptionWithoutCause();
} catch (final Throwable t) {
return t;
}
}
@BeforeEach
public void setUp() {
withoutCause = createExceptionWithoutCause();
nested = new NestableException(withoutCause);
withCause = new ExceptionWithCause(nested);
jdkNoCause = new NullPointerException();
final ExceptionWithCause a = new ExceptionWithCause(null);
final ExceptionWithCause b = new ExceptionWithCause(a);
a.setCause(b);
cyclicCause = new ExceptionWithCause(a);
notVisibleException = NotVisibleExceptionFactory.createException(withoutCause);
}
@AfterEach
public void tearDown() {
withoutCause = null;
nested = null;
withCause = null;
jdkNoCause = null;
cyclicCause = null;
notVisibleException = null;
}
@Test
void test_getMessage_Throwable() {
Throwable th = null;
assertEquals("", ExceptionUtils.getMessage(th));
th = new IllegalArgumentException("Base");
assertEquals("IllegalArgumentException: Base", ExceptionUtils.getMessage(th));
th = new ExceptionWithCause("Wrapper", th);
assertEquals("ExceptionUtilsTest.ExceptionWithCause: Wrapper", ExceptionUtils.getMessage(th));
}
@Test
void test_getRootCauseMessage_Throwable() {
Throwable th = null;
assertEquals("", ExceptionUtils.getRootCauseMessage(th));
th = new IllegalArgumentException("Base");
assertEquals("IllegalArgumentException: Base", ExceptionUtils.getRootCauseMessage(th));
th = new ExceptionWithCause("Wrapper", th);
assertEquals("IllegalArgumentException: Base", ExceptionUtils.getRootCauseMessage(th));
}
@Test
void testAsRuntimeException() {
final Exception expected = new InterruptedException();
assertSame(expected, assertThrows(Exception.class, () -> ExceptionUtils.asRuntimeException(expected)));
assertNotSame(expected, assertThrows(Exception.class, () -> ExceptionUtils.asRuntimeException(new InterruptedException())));
// API return typed to compile to Object
assertThrows(expected.getClass(), () -> {
@SuppressWarnings("unused")
final Object retVal = ExceptionUtils.asRuntimeException(expected);
});
// API return typed to compile to RuntimeException
assertThrows(expected.getClass(), () -> {
@SuppressWarnings("unused")
final RuntimeException retVal = ExceptionUtils.asRuntimeException(expected);
});
// API return typed to compile to RuntimeException subclass
assertThrows(expected.getClass(), () -> {
@SuppressWarnings("unused")
final IllegalStateException retVal = ExceptionUtils.asRuntimeException(expected);
});
}
@Test
void testCatchTechniques() {
IOException ioe = assertThrows(IOException.class, ExceptionUtilsTest::throwsCheckedException);
assertEquals(1, ExceptionUtils.getThrowableCount(ioe));
ioe = assertThrows(IOException.class, ExceptionUtilsTest::redeclareCheckedException);
assertEquals(1, ExceptionUtils.getThrowableCount(ioe));
}
@Test
void testConstructor() {
assertNotNull(new ExceptionUtils());
final Constructor<?>[] cons = ExceptionUtils.class.getDeclaredConstructors();
assertEquals(1, cons.length);
assertTrue(Modifier.isPublic(cons[0].getModifiers()));
assertTrue(Modifier.isPublic(ExceptionUtils.class.getModifiers()));
assertFalse(Modifier.isFinal(ExceptionUtils.class.getModifiers()));
}
@Test
void testForEach_jdkNoCause() {
final List<Throwable> throwables = new ArrayList<>();
ExceptionUtils.forEach(jdkNoCause, throwables::add);
assertEquals(1, throwables.size());
assertSame(jdkNoCause, throwables.get(0));
}
@Test
void testForEach_nested() {
final List<Throwable> throwables = new ArrayList<>();
ExceptionUtils.forEach(nested, throwables::add);
assertEquals(2, throwables.size());
assertSame(nested, throwables.get(0));
assertSame(withoutCause, throwables.get(1));
}
@Test
void testForEach_null() {
final List<Throwable> throwables = new ArrayList<>();
ExceptionUtils.forEach(null, throwables::add);
assertEquals(0, throwables.size());
}
@Test
void testForEach_recursiveCause() {
final List<Throwable> throwables = new ArrayList<>();
ExceptionUtils.forEach(cyclicCause, throwables::add);
assertEquals(3, throwables.size());
assertSame(cyclicCause, throwables.get(0));
assertSame(cyclicCause.getCause(), throwables.get(1));
assertSame(cyclicCause.getCause().getCause(), throwables.get(2));
}
@Test
void testForEach_withCause() {
final List<Throwable> throwables = new ArrayList<>();
ExceptionUtils.forEach(withCause, throwables::add);
assertEquals(3, throwables.size());
assertSame(withCause, throwables.get(0));
assertSame(nested, throwables.get(1));
assertSame(withoutCause, throwables.get(2));
}
@Test
void testForEach_withoutCause() {
final List<Throwable> throwables = new ArrayList<>();
ExceptionUtils.forEach(withoutCause, throwables::add);
assertEquals(1, throwables.size());
assertSame(withoutCause, throwables.get(0));
}
@SuppressWarnings("deprecation") // Specifically tests the deprecated methods
@Test
void testGetCause_Throwable() {
assertSame(null, ExceptionUtils.getCause(null));
assertSame(null, ExceptionUtils.getCause(withoutCause));
assertSame(withoutCause, ExceptionUtils.getCause(nested));
assertSame(nested, ExceptionUtils.getCause(withCause));
assertSame(null, ExceptionUtils.getCause(jdkNoCause));
assertSame(cyclicCause.getCause(), ExceptionUtils.getCause(cyclicCause));
assertSame(cyclicCause.getCause().getCause(), ExceptionUtils.getCause(cyclicCause.getCause()));
assertSame(cyclicCause.getCause(), ExceptionUtils.getCause(cyclicCause.getCause().getCause()));
assertSame(withoutCause, ExceptionUtils.getCause(notVisibleException));
}
@SuppressWarnings("deprecation") // Specifically tests the deprecated methods
@Test
void testGetCause_ThrowableArray() {
assertSame(null, ExceptionUtils.getCause(null, null));
assertSame(null, ExceptionUtils.getCause(null, new String[0]));
// not known type, so match on supplied method names
assertSame(nested, ExceptionUtils.getCause(withCause, null)); // default names
assertSame(null, ExceptionUtils.getCause(withCause, new String[0]));
assertSame(null, ExceptionUtils.getCause(withCause, new String[]{null}));
assertSame(nested, ExceptionUtils.getCause(withCause, new String[]{"getCause"}));
// not known type, so match on supplied method names
assertSame(null, ExceptionUtils.getCause(withoutCause, null));
assertSame(null, ExceptionUtils.getCause(withoutCause, new String[0]));
assertSame(null, ExceptionUtils.getCause(withoutCause, new String[]{null}));
assertSame(null, ExceptionUtils.getCause(withoutCause, new String[]{"getCause"}));
assertSame(null, ExceptionUtils.getCause(withoutCause, new String[]{"getTargetException"}));
}
@Test
void testGetRootCause_Throwable() {
assertSame(null, ExceptionUtils.getRootCause(null));
assertSame(withoutCause, ExceptionUtils.getRootCause(withoutCause));
assertSame(withoutCause, ExceptionUtils.getRootCause(nested));
assertSame(withoutCause, ExceptionUtils.getRootCause(withCause));
assertSame(jdkNoCause, ExceptionUtils.getRootCause(jdkNoCause));
assertSame(cyclicCause.getCause().getCause(), ExceptionUtils.getRootCause(cyclicCause));
}
@Test
void testGetRootCauseStackTrace_Throwable() {
assertEquals(0, ExceptionUtils.getRootCauseStackTrace(null).length);
final Throwable cause = createExceptionWithCause();
String[] stackTrace = ExceptionUtils.getRootCauseStackTrace(cause);
boolean match = false;
for (final String element : stackTrace) {
if (element.startsWith(ExceptionUtils.WRAPPED_MARKER)) {
match = true;
break;
}
}
assertTrue(match);
stackTrace = ExceptionUtils.getRootCauseStackTrace(withoutCause);
match = false;
for (final String element : stackTrace) {
if (element.startsWith(ExceptionUtils.WRAPPED_MARKER)) {
match = true;
break;
}
}
assertFalse(match);
}
@Test
void testGetRootCauseStackTraceList_Throwable() {
assertEquals(0, ExceptionUtils.getRootCauseStackTraceList(null).size());
final Throwable cause = createExceptionWithCause();
List<String> stackTrace = ExceptionUtils.getRootCauseStackTraceList(cause);
boolean match = false;
for (final String element : stackTrace) {
if (element.startsWith(ExceptionUtils.WRAPPED_MARKER)) {
match = true;
break;
}
}
assertTrue(match);
stackTrace = ExceptionUtils.getRootCauseStackTraceList(withoutCause);
match = false;
for (final String element : stackTrace) {
if (element.startsWith(ExceptionUtils.WRAPPED_MARKER)) {
match = true;
break;
}
}
assertFalse(match);
}
@Test
@DisplayName("getStackFrames returns empty string array when the argument is null")
void testgetStackFramesHappyPath() {
final String[] actual = ExceptionUtils.getStackFrames(new Throwable() {
private static final long serialVersionUID = 1L;
// provide static stack trace to make test stable
@Override
public void printStackTrace(final PrintWriter s) {
s.write("org.apache.commons.lang3.exception.ExceptionUtilsTest$1\n" +
"\tat org.apache.commons.lang3.exception.ExceptionUtilsTest.testgetStackFramesGappyPath(ExceptionUtilsTest.java:706)\n" +
"\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n" +
"\tat com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)\n" +
"\tat com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)\n");
}
});
assertArrayEquals(new String[]{
"org.apache.commons.lang3.exception.ExceptionUtilsTest$1",
"\tat org.apache.commons.lang3.exception.ExceptionUtilsTest.testgetStackFramesGappyPath(ExceptionUtilsTest.java:706)",
"\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)",
"\tat com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)",
"\tat com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)"
}, actual);
}
@Test
@DisplayName("getStackFrames returns the string array of the stack frames when there is a real exception")
void testgetStackFramesNullArg() {
final String[] actual = ExceptionUtils.getStackFrames((Throwable) null);
assertEquals(0, actual.length);
}
@Test
void testGetThrowableCount_Throwable() {
assertEquals(0, ExceptionUtils.getThrowableCount(null));
assertEquals(1, ExceptionUtils.getThrowableCount(withoutCause));
assertEquals(2, ExceptionUtils.getThrowableCount(nested));
assertEquals(3, ExceptionUtils.getThrowableCount(withCause));
assertEquals(1, ExceptionUtils.getThrowableCount(jdkNoCause));
assertEquals(3, ExceptionUtils.getThrowableCount(cyclicCause));
}
@Test
void testGetThrowableList_Throwable_jdkNoCause() {
final List<?> throwables = ExceptionUtils.getThrowableList(jdkNoCause);
assertEquals(1, throwables.size());
assertSame(jdkNoCause, throwables.get(0));
}
@Test
void testGetThrowableList_Throwable_nested() {
final List<?> throwables = ExceptionUtils.getThrowableList(nested);
assertEquals(2, throwables.size());
assertSame(nested, throwables.get(0));
assertSame(withoutCause, throwables.get(1));
}
@Test
void testGetThrowableList_Throwable_null() {
final List<?> throwables = ExceptionUtils.getThrowableList(null);
assertEquals(0, throwables.size());
}
@Test
void testGetThrowableList_Throwable_recursiveCause() {
final List<?> throwables = ExceptionUtils.getThrowableList(cyclicCause);
assertEquals(3, throwables.size());
assertSame(cyclicCause, throwables.get(0));
assertSame(cyclicCause.getCause(), throwables.get(1));
assertSame(cyclicCause.getCause().getCause(), throwables.get(2));
}
@Test
void testGetThrowableList_Throwable_withCause() {
final List<?> throwables = ExceptionUtils.getThrowableList(withCause);
assertEquals(3, throwables.size());
assertSame(withCause, throwables.get(0));
assertSame(nested, throwables.get(1));
assertSame(withoutCause, throwables.get(2));
}
@Test
void testGetThrowableList_Throwable_withoutCause() {
final List<?> throwables = ExceptionUtils.getThrowableList(withoutCause);
assertEquals(1, throwables.size());
assertSame(withoutCause, throwables.get(0));
}
@Test
void testGetThrowables_Throwable_jdkNoCause() {
final Throwable[] throwables = ExceptionUtils.getThrowables(jdkNoCause);
assertEquals(1, throwables.length);
assertSame(jdkNoCause, throwables[0]);
}
@Test
void testGetThrowables_Throwable_nested() {
final Throwable[] throwables = ExceptionUtils.getThrowables(nested);
assertEquals(2, throwables.length);
assertSame(nested, throwables[0]);
assertSame(withoutCause, throwables[1]);
}
@Test
void testGetThrowables_Throwable_null() {
assertEquals(0, ExceptionUtils.getThrowables(null).length);
}
@Test
void testGetThrowables_Throwable_recursiveCause() {
final Throwable[] throwables = ExceptionUtils.getThrowables(cyclicCause);
assertEquals(3, throwables.length);
assertSame(cyclicCause, throwables[0]);
assertSame(cyclicCause.getCause(), throwables[1]);
assertSame(cyclicCause.getCause().getCause(), throwables[2]);
}
@Test
void testGetThrowables_Throwable_withCause() {
final Throwable[] throwables = ExceptionUtils.getThrowables(withCause);
assertEquals(3, throwables.length);
assertSame(withCause, throwables[0]);
assertSame(nested, throwables[1]);
assertSame(withoutCause, throwables[2]);
}
@Test
void testGetThrowables_Throwable_withoutCause() {
final Throwable[] throwables = ExceptionUtils.getThrowables(withoutCause);
assertEquals(1, throwables.length);
assertSame(withoutCause, throwables[0]);
}
@Test
void testIndexOf_ThrowableClass() {
assertEquals(-1, ExceptionUtils.indexOfThrowable(null, null));
assertEquals(-1, ExceptionUtils.indexOfThrowable(null, NestableException.class));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withoutCause, null));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withoutCause, ExceptionWithCause.class));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withoutCause, NestableException.class));
assertEquals(0, ExceptionUtils.indexOfThrowable(withoutCause, ExceptionWithoutCause.class));
assertEquals(-1, ExceptionUtils.indexOfThrowable(nested, null));
assertEquals(-1, ExceptionUtils.indexOfThrowable(nested, ExceptionWithCause.class));
assertEquals(0, ExceptionUtils.indexOfThrowable(nested, NestableException.class));
assertEquals(1, ExceptionUtils.indexOfThrowable(nested, ExceptionWithoutCause.class));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withCause, null));
assertEquals(0, ExceptionUtils.indexOfThrowable(withCause, ExceptionWithCause.class));
assertEquals(1, ExceptionUtils.indexOfThrowable(withCause, NestableException.class));
assertEquals(2, ExceptionUtils.indexOfThrowable(withCause, ExceptionWithoutCause.class));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withCause, Exception.class));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withCause, Throwable.class));
}
@Test
void testIndexOf_ThrowableClassInt() {
assertEquals(-1, ExceptionUtils.indexOfThrowable(null, null, 0));
assertEquals(-1, ExceptionUtils.indexOfThrowable(null, NestableException.class, 0));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withoutCause, null));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withoutCause, ExceptionWithCause.class, 0));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withoutCause, NestableException.class, 0));
assertEquals(0, ExceptionUtils.indexOfThrowable(withoutCause, ExceptionWithoutCause.class, 0));
assertEquals(-1, ExceptionUtils.indexOfThrowable(nested, null, 0));
assertEquals(-1, ExceptionUtils.indexOfThrowable(nested, ExceptionWithCause.class, 0));
assertEquals(0, ExceptionUtils.indexOfThrowable(nested, NestableException.class, 0));
assertEquals(1, ExceptionUtils.indexOfThrowable(nested, ExceptionWithoutCause.class, 0));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withCause, null));
assertEquals(0, ExceptionUtils.indexOfThrowable(withCause, ExceptionWithCause.class, 0));
assertEquals(1, ExceptionUtils.indexOfThrowable(withCause, NestableException.class, 0));
assertEquals(2, ExceptionUtils.indexOfThrowable(withCause, ExceptionWithoutCause.class, 0));
assertEquals(0, ExceptionUtils.indexOfThrowable(withCause, ExceptionWithCause.class, -1));
assertEquals(0, ExceptionUtils.indexOfThrowable(withCause, ExceptionWithCause.class, 0));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withCause, ExceptionWithCause.class, 1));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withCause, ExceptionWithCause.class, 9));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withCause, Exception.class, 0));
assertEquals(-1, ExceptionUtils.indexOfThrowable(withCause, Throwable.class, 0));
}
@Test
void testIndexOfType_ThrowableClass() {
assertEquals(-1, ExceptionUtils.indexOfType(null, null));
assertEquals(-1, ExceptionUtils.indexOfType(null, NestableException.class));
assertEquals(-1, ExceptionUtils.indexOfType(withoutCause, null));
assertEquals(-1, ExceptionUtils.indexOfType(withoutCause, ExceptionWithCause.class));
assertEquals(-1, ExceptionUtils.indexOfType(withoutCause, NestableException.class));
assertEquals(0, ExceptionUtils.indexOfType(withoutCause, ExceptionWithoutCause.class));
assertEquals(-1, ExceptionUtils.indexOfType(nested, null));
assertEquals(-1, ExceptionUtils.indexOfType(nested, ExceptionWithCause.class));
assertEquals(0, ExceptionUtils.indexOfType(nested, NestableException.class));
assertEquals(1, ExceptionUtils.indexOfType(nested, ExceptionWithoutCause.class));
assertEquals(-1, ExceptionUtils.indexOfType(withCause, null));
assertEquals(0, ExceptionUtils.indexOfType(withCause, ExceptionWithCause.class));
assertEquals(1, ExceptionUtils.indexOfType(withCause, NestableException.class));
assertEquals(2, ExceptionUtils.indexOfType(withCause, ExceptionWithoutCause.class));
assertEquals(0, ExceptionUtils.indexOfType(withCause, Exception.class));
assertEquals(0, ExceptionUtils.indexOfType(withCause, Throwable.class));
}
@Test
void testIndexOfType_ThrowableClassInt() {
assertEquals(-1, ExceptionUtils.indexOfType(null, null, 0));
assertEquals(-1, ExceptionUtils.indexOfType(null, NestableException.class, 0));
assertEquals(-1, ExceptionUtils.indexOfType(withoutCause, null));
assertEquals(-1, ExceptionUtils.indexOfType(withoutCause, ExceptionWithCause.class, 0));
assertEquals(-1, ExceptionUtils.indexOfType(withoutCause, NestableException.class, 0));
assertEquals(0, ExceptionUtils.indexOfType(withoutCause, ExceptionWithoutCause.class, 0));
assertEquals(-1, ExceptionUtils.indexOfType(nested, null, 0));
assertEquals(-1, ExceptionUtils.indexOfType(nested, ExceptionWithCause.class, 0));
assertEquals(0, ExceptionUtils.indexOfType(nested, NestableException.class, 0));
assertEquals(1, ExceptionUtils.indexOfType(nested, ExceptionWithoutCause.class, 0));
assertEquals(-1, ExceptionUtils.indexOfType(withCause, null));
assertEquals(0, ExceptionUtils.indexOfType(withCause, ExceptionWithCause.class, 0));
assertEquals(1, ExceptionUtils.indexOfType(withCause, NestableException.class, 0));
assertEquals(2, ExceptionUtils.indexOfType(withCause, ExceptionWithoutCause.class, 0));
assertEquals(0, ExceptionUtils.indexOfType(withCause, ExceptionWithCause.class, -1));
assertEquals(0, ExceptionUtils.indexOfType(withCause, ExceptionWithCause.class, 0));
assertEquals(-1, ExceptionUtils.indexOfType(withCause, ExceptionWithCause.class, 1));
assertEquals(-1, ExceptionUtils.indexOfType(withCause, ExceptionWithCause.class, 9));
assertEquals(0, ExceptionUtils.indexOfType(withCause, Exception.class, 0));
assertEquals(0, ExceptionUtils.indexOfType(withCause, Throwable.class, 0));
}
@Test
void testIsChecked_checked() {
assertTrue(ExceptionUtils.isChecked(new IOException()));
}
@Test
void testIsChecked_error() {
assertFalse(ExceptionUtils.isChecked(new StackOverflowError()));
}
@Test
void testIsChecked_null() {
assertFalse(ExceptionUtils.isChecked(null));
}
@Test
void testIsChecked_unchecked() {
assertFalse(ExceptionUtils.isChecked(new IllegalArgumentException()));
}
@Test
void testIsCheckedCustomThrowable() {
assertTrue(ExceptionUtils.isChecked(new TestThrowable()));
}
@Test
void testIsUnchecked_checked() {
assertFalse(ExceptionUtils.isUnchecked(new IOException()));
}
@Test
void testIsUnchecked_error() {
assertTrue(ExceptionUtils.isUnchecked(new StackOverflowError()));
}
@Test
void testIsUnchecked_null() {
assertFalse(ExceptionUtils.isUnchecked(null));
}
@Test
void testIsUnchecked_unchecked() {
assertTrue(ExceptionUtils.isUnchecked(new IllegalArgumentException()));
}
@Test
void testIsUnCheckedCustomThrowable() {
assertFalse(ExceptionUtils.isUnchecked(new TestThrowable()));
}
@Test
void testPrintRootCauseStackTrace_Throwable() {
ExceptionUtils.printRootCauseStackTrace(null);
// could pipe system.err to a known stream, but not much point as
// internally this method calls stream method anyway
}
@Test
void testPrintRootCauseStackTrace_ThrowableStream() {
ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
ExceptionUtils.printRootCauseStackTrace(null, (PrintStream) null);
ExceptionUtils.printRootCauseStackTrace(null, new PrintStream(out));
assertEquals(0, out.toString().length());
assertNullPointerException(() -> ExceptionUtils.printRootCauseStackTrace(withCause, (PrintStream) null));
out = new ByteArrayOutputStream(1024);
final Throwable cause = createExceptionWithCause();
ExceptionUtils.printRootCauseStackTrace(cause, new PrintStream(out));
String stackTrace = out.toString();
assertTrue(stackTrace.contains(ExceptionUtils.WRAPPED_MARKER));
out = new ByteArrayOutputStream(1024);
ExceptionUtils.printRootCauseStackTrace(withoutCause, new PrintStream(out));
stackTrace = out.toString();
assertFalse(stackTrace.contains(ExceptionUtils.WRAPPED_MARKER));
}
@Test
void testPrintRootCauseStackTrace_ThrowableWriter() {
StringWriter writer = new StringWriter(1024);
ExceptionUtils.printRootCauseStackTrace(null, (PrintWriter) null);
ExceptionUtils.printRootCauseStackTrace(null, new PrintWriter(writer));
assertEquals(0, writer.getBuffer().length());
assertNullPointerException(() -> ExceptionUtils.printRootCauseStackTrace(withCause, (PrintWriter) null));
writer = new StringWriter(1024);
final Throwable cause = createExceptionWithCause();
ExceptionUtils.printRootCauseStackTrace(cause, new PrintWriter(writer));
String stackTrace = writer.toString();
assertTrue(stackTrace.contains(ExceptionUtils.WRAPPED_MARKER));
writer = new StringWriter(1024);
ExceptionUtils.printRootCauseStackTrace(withoutCause, new PrintWriter(writer));
stackTrace = writer.toString();
assertFalse(stackTrace.contains(ExceptionUtils.WRAPPED_MARKER));
}
@Test
void testRemoveCommonFrames_ListList() {
assertNullPointerException(() -> ExceptionUtils.removeCommonFrames(null, null));
}
@Test
void testRethrow() {
final Exception expected = new InterruptedException();
// API return typed to compile to Object
assertThrows(expected.getClass(), () -> {
@SuppressWarnings("unused")
final Object retVal = ExceptionUtils.rethrow(expected);
});
// API return typed to compile to Object subclass
assertThrows(expected.getClass(), () -> {
@SuppressWarnings("unused")
final String retVal = ExceptionUtils.rethrow(expected);
});
// API return typed to compile to primitive
assertThrows(expected.getClass(), () -> {
@SuppressWarnings("unused")
final int retVal = ExceptionUtils.rethrow(expected);
});
//
assertSame(expected, assertThrows(expected.getClass(), () -> ExceptionUtils.rethrow(expected)));
assertNotSame(expected, assertThrows(expected.getClass(), () -> ExceptionUtils.rethrow(new InterruptedException())));
}
@Test
void testStream_jdkNoCause() {
assertEquals(1, ExceptionUtils.stream(jdkNoCause).count());
assertSame(jdkNoCause, ExceptionUtils.stream(jdkNoCause).toArray()[0]);
}
@Test
void testStream_nested() {
assertEquals(2, ExceptionUtils.stream(nested).count());
final Object[] array = ExceptionUtils.stream(nested).toArray();
assertSame(nested, array[0]);
assertSame(withoutCause, array[1]);
}
@Test
void testStream_null() {
assertEquals(0, ExceptionUtils.stream(null).count());
}
@Test
void testStream_recursiveCause() {
final List<?> throwables = ExceptionUtils.stream(cyclicCause).collect(Collectors.toList());
assertEquals(3, throwables.size());
assertSame(cyclicCause, throwables.get(0));
assertSame(cyclicCause.getCause(), throwables.get(1));
assertSame(cyclicCause.getCause().getCause(), throwables.get(2));
}
@Test
void testStream_withCause() {
final List<?> throwables = ExceptionUtils.stream(withCause).collect(Collectors.toList());
assertEquals(3, throwables.size());
assertSame(withCause, throwables.get(0));
assertSame(nested, throwables.get(1));
assertSame(withoutCause, throwables.get(2));
}
@Test
void testStream_withoutCause() {
final List<?> throwables = ExceptionUtils.stream(withoutCause).collect(Collectors.toList());
assertEquals(1, throwables.size());
assertSame(withoutCause, throwables.get(0));
}
@Test
void testThrowableOf_ThrowableClass() {
assertNull(ExceptionUtils.throwableOfThrowable(null, null));
assertNull(ExceptionUtils.throwableOfThrowable(null, NestableException.class));
assertNull(ExceptionUtils.throwableOfThrowable(withoutCause, null));
assertNull(ExceptionUtils.throwableOfThrowable(withoutCause, ExceptionWithCause.class));
assertNull(ExceptionUtils.throwableOfThrowable(withoutCause, NestableException.class));
assertEquals(withoutCause, ExceptionUtils.throwableOfThrowable(withoutCause, ExceptionWithoutCause.class));
assertNull(ExceptionUtils.throwableOfThrowable(nested, null));
assertNull(ExceptionUtils.throwableOfThrowable(nested, ExceptionWithCause.class));
assertEquals(nested, ExceptionUtils.throwableOfThrowable(nested, NestableException.class));
assertEquals(nested.getCause(), ExceptionUtils.throwableOfThrowable(nested, ExceptionWithoutCause.class));
assertNull(ExceptionUtils.throwableOfThrowable(withCause, null));
assertEquals(withCause, ExceptionUtils.throwableOfThrowable(withCause, ExceptionWithCause.class));
assertEquals(withCause.getCause(), ExceptionUtils.throwableOfThrowable(withCause, NestableException.class));
assertEquals(withCause.getCause().getCause(), ExceptionUtils.throwableOfThrowable(withCause, ExceptionWithoutCause.class));
assertNull(ExceptionUtils.throwableOfThrowable(withCause, Exception.class));
assertNull(ExceptionUtils.throwableOfThrowable(withCause, Throwable.class));
}
@Test
void testThrowableOf_ThrowableClassInt() {
assertNull(ExceptionUtils.throwableOfThrowable(null, null, 0));
assertNull(ExceptionUtils.throwableOfThrowable(null, NestableException.class, 0));
assertNull(ExceptionUtils.throwableOfThrowable(withoutCause, null));
assertNull(ExceptionUtils.throwableOfThrowable(withoutCause, ExceptionWithCause.class, 0));
assertNull(ExceptionUtils.throwableOfThrowable(withoutCause, NestableException.class, 0));
assertEquals(withoutCause, ExceptionUtils.throwableOfThrowable(withoutCause, ExceptionWithoutCause.class, 0));
assertNull(ExceptionUtils.throwableOfThrowable(nested, null, 0));
assertNull(ExceptionUtils.throwableOfThrowable(nested, ExceptionWithCause.class, 0));
assertEquals(nested, ExceptionUtils.throwableOfThrowable(nested, NestableException.class, 0));
assertEquals(nested.getCause(), ExceptionUtils.throwableOfThrowable(nested, ExceptionWithoutCause.class, 0));
assertNull(ExceptionUtils.throwableOfThrowable(withCause, null));
assertEquals(withCause, ExceptionUtils.throwableOfThrowable(withCause, ExceptionWithCause.class, 0));
assertEquals(withCause.getCause(), ExceptionUtils.throwableOfThrowable(withCause, NestableException.class, 0));
assertEquals(withCause.getCause().getCause(), ExceptionUtils.throwableOfThrowable(withCause, ExceptionWithoutCause.class, 0));
assertEquals(withCause, ExceptionUtils.throwableOfThrowable(withCause, ExceptionWithCause.class, -1));
assertEquals(withCause, ExceptionUtils.throwableOfThrowable(withCause, ExceptionWithCause.class, 0));
assertNull(ExceptionUtils.throwableOfThrowable(withCause, ExceptionWithCause.class, 1));
assertNull(ExceptionUtils.throwableOfThrowable(withCause, ExceptionWithCause.class, 9));
assertNull(ExceptionUtils.throwableOfThrowable(withCause, Exception.class, 0));
assertNull(ExceptionUtils.throwableOfThrowable(withCause, Throwable.class, 0));
}
@Test
void testThrowableOfType_ThrowableClass() {
assertNull(ExceptionUtils.throwableOfType(null, null));
assertNull(ExceptionUtils.throwableOfType(null, NestableException.class));
assertNull(ExceptionUtils.throwableOfType(withoutCause, null));
assertNull(ExceptionUtils.throwableOfType(withoutCause, ExceptionWithCause.class));
assertNull(ExceptionUtils.throwableOfType(withoutCause, NestableException.class));
assertEquals(withoutCause, ExceptionUtils.throwableOfType(withoutCause, ExceptionWithoutCause.class));
assertNull(ExceptionUtils.throwableOfType(nested, null));
assertNull(ExceptionUtils.throwableOfType(nested, ExceptionWithCause.class));
assertEquals(nested, ExceptionUtils.throwableOfType(nested, NestableException.class));
assertEquals(nested.getCause(), ExceptionUtils.throwableOfType(nested, ExceptionWithoutCause.class));
assertNull(ExceptionUtils.throwableOfType(withCause, null));
assertEquals(withCause, ExceptionUtils.throwableOfType(withCause, ExceptionWithCause.class));
assertEquals(withCause.getCause(), ExceptionUtils.throwableOfType(withCause, NestableException.class));
assertEquals(withCause.getCause().getCause(), ExceptionUtils.throwableOfType(withCause, ExceptionWithoutCause.class));
assertEquals(withCause, ExceptionUtils.throwableOfType(withCause, Exception.class));
assertEquals(withCause, ExceptionUtils.throwableOfType(withCause, Throwable.class));
}
@Test
void testThrowableOfType_ThrowableClassInt() {
assertNull(ExceptionUtils.throwableOfType(null, null, 0));
assertNull(ExceptionUtils.throwableOfType(null, NestableException.class, 0));
assertNull(ExceptionUtils.throwableOfType(withoutCause, null));
assertNull(ExceptionUtils.throwableOfType(withoutCause, ExceptionWithCause.class, 0));
assertNull(ExceptionUtils.throwableOfType(withoutCause, NestableException.class, 0));
assertEquals(withoutCause, ExceptionUtils.throwableOfType(withoutCause, ExceptionWithoutCause.class, 0));
assertNull(ExceptionUtils.throwableOfType(nested, null, 0));
assertNull(ExceptionUtils.throwableOfType(nested, ExceptionWithCause.class, 0));
assertEquals(nested, ExceptionUtils.throwableOfType(nested, NestableException.class, 0));
assertEquals(nested.getCause(), ExceptionUtils.throwableOfType(nested, ExceptionWithoutCause.class, 0));
assertNull(ExceptionUtils.throwableOfType(withCause, null));
assertEquals(withCause, ExceptionUtils.throwableOfType(withCause, ExceptionWithCause.class, 0));
assertEquals(withCause.getCause(), ExceptionUtils.throwableOfType(withCause, NestableException.class, 0));
assertEquals(withCause.getCause().getCause(), ExceptionUtils.throwableOfType(withCause, ExceptionWithoutCause.class, 0));
assertEquals(withCause, ExceptionUtils.throwableOfType(withCause, ExceptionWithCause.class, -1));
assertEquals(withCause, ExceptionUtils.throwableOfType(withCause, ExceptionWithCause.class, 0));
assertNull(ExceptionUtils.throwableOfType(withCause, ExceptionWithCause.class, 1));
assertNull(ExceptionUtils.throwableOfType(withCause, ExceptionWithCause.class, 9));
assertEquals(withCause, ExceptionUtils.throwableOfType(withCause, Exception.class, 0));
assertEquals(withCause, ExceptionUtils.throwableOfType(withCause, Throwable.class, 0));
}
@Test
void testWrapAndUnwrapCheckedException() {
final Throwable t = assertThrows(Throwable.class, () -> ExceptionUtils.wrapAndThrow(new IOException()));
assertTrue(ExceptionUtils.hasCause(t, IOException.class));
}
@Test
void testWrapAndUnwrapError() {
final Throwable t = assertThrows(Throwable.class, () -> ExceptionUtils.wrapAndThrow(new OutOfMemoryError()));
assertTrue(ExceptionUtils.hasCause(t, Error.class));
}
@Test
void testWrapAndUnwrapRuntimeException() {
final Throwable t = assertThrows(Throwable.class, () -> ExceptionUtils.wrapAndThrow(new IllegalArgumentException()));
assertTrue(ExceptionUtils.hasCause(t, RuntimeException.class));
}
@Test
void testWrapAndUnwrapThrowable() {
final Throwable t = assertThrows(Throwable.class, () -> ExceptionUtils.wrapAndThrow(new TestThrowable()));
assertTrue(ExceptionUtils.hasCause(t, TestThrowable.class));
}
}
|
TestThrowable
|
java
|
quarkusio__quarkus
|
independent-projects/tools/message-writer/src/main/java/io/quarkus/devtools/messagewriter/DefaultMessageWriter.java
|
{
"start": 225,
"end": 1218
}
|
class ____ implements MessageWriter {
protected final PrintStream out;
protected boolean debug;
DefaultMessageWriter() {
this(System.out, false);
}
DefaultMessageWriter(PrintStream out) {
this(out, false);
}
DefaultMessageWriter(boolean debug) {
this(System.out, debug);
}
DefaultMessageWriter(PrintStream out, boolean debug) {
this.out = out;
this.debug = debug;
}
@Override
public boolean isDebugEnabled() {
return debug;
}
@Override
public void info(String msg) {
out.println(msg);
}
@Override
public void error(String msg) {
out.println(ERROR_ICON + " " + msg);
}
@Override
public void debug(String msg) {
if (!isDebugEnabled()) {
return;
}
out.println("[DEBUG] " + msg);
}
@Override
public void warn(String msg) {
out.println(WARN_ICON + " " + msg);
}
}
|
DefaultMessageWriter
|
java
|
apache__maven
|
its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4304ProjectDependencyArtifactsTest.java
|
{
"start": 1184,
"end": 2090
}
|
class ____ extends AbstractMavenIntegrationTestCase {
/**
* Verify that MavenProject.getDependencyArtifacts() is properly populated with the direct artifacts of the
* project.
*
* @throws Exception in case of failure
*/
@Test
public void testit() throws Exception {
File testDir = extractResources("/mng-4304");
Verifier verifier = newVerifier(testDir.getAbsolutePath());
verifier.setAutoclean(false);
verifier.deleteDirectory("target");
verifier.addCliArgument("validate");
verifier.execute();
verifier.verifyErrorFreeLog();
List<String> artifacts = verifier.loadLines("target/artifacts.txt");
assertTrue(artifacts.contains("org.apache.maven.its:maven-core-it-support:jar:1.4"), artifacts.toString());
assertEquals(1, artifacts.size());
}
}
|
MavenITmng4304ProjectDependencyArtifactsTest
|
java
|
elastic__elasticsearch
|
server/src/test/java/org/elasticsearch/cluster/routing/allocation/allocator/BalancingRoundSummaryTests.java
|
{
"start": 884,
"end": 6707
}
|
class ____ extends ESTestCase {
/**
* Tests the {@link BalancingRoundSummary.CombinedBalancingRoundSummary#combine(List)} method.
*/
public void testCombine() {
final DiscoveryNode NODE_1 = DiscoveryNodeUtils.create("node1", "node1Id");
final DiscoveryNode NODE_2 = DiscoveryNodeUtils.create("node2", "node2Id");
final var node1BaseWeights = new DesiredBalanceMetrics.NodeWeightStats(10, 20, 30, 40);
final var node2BaseWeights = new DesiredBalanceMetrics.NodeWeightStats(100, 200, 300, 400);
final var commonDiff = new BalancingRoundSummary.NodeWeightsDiff(1, 2, 3, 4);
final long shardMovesSummary1 = 50;
final long shardMovesSummary2 = 150;
// Set up a summaries list with two summary entries for a two node cluster
List<BalancingRoundSummary> summaries = new ArrayList<>();
summaries.add(
new BalancingRoundSummary(
Map.of(
NODE_1,
new BalancingRoundSummary.NodesWeightsChanges(node1BaseWeights, commonDiff),
NODE_2,
new BalancingRoundSummary.NodesWeightsChanges(node2BaseWeights, commonDiff)
),
shardMovesSummary1
)
);
summaries.add(
new BalancingRoundSummary(
Map.of(
NODE_1,
new BalancingRoundSummary.NodesWeightsChanges(
// The base weights for the next BalancingRoundSummary will be the previous BalancingRoundSummary's base + diff
// weights.
new DesiredBalanceMetrics.NodeWeightStats(
node1BaseWeights.shardCount() + commonDiff.shardCountDiff(),
node1BaseWeights.diskUsageInBytes() + commonDiff.diskUsageInBytesDiff(),
node1BaseWeights.writeLoad() + commonDiff.writeLoadDiff(),
node1BaseWeights.nodeWeight() + commonDiff.totalWeightDiff()
),
commonDiff
),
NODE_2,
new BalancingRoundSummary.NodesWeightsChanges(
new DesiredBalanceMetrics.NodeWeightStats(
node2BaseWeights.shardCount() + commonDiff.shardCountDiff(),
node2BaseWeights.diskUsageInBytes() + commonDiff.diskUsageInBytesDiff(),
node2BaseWeights.writeLoad() + commonDiff.writeLoadDiff(),
node2BaseWeights.nodeWeight() + commonDiff.totalWeightDiff()
),
commonDiff
)
),
shardMovesSummary2
)
);
// Combine the summaries.
CombinedBalancingRoundSummary combined = BalancingRoundSummary.CombinedBalancingRoundSummary.combine(summaries);
assertEquals(2, combined.numberOfBalancingRounds());
assertEquals(shardMovesSummary1 + shardMovesSummary2, combined.numberOfShardMoves());
assertEquals(2, combined.nodeToWeightChanges().size());
var combinedNode1WeightsChanges = combined.nodeToWeightChanges().get(NODE_1);
var combinedNode2WeightsChanges = combined.nodeToWeightChanges().get(NODE_2);
// The base weights for each node should match the first BalancingRoundSummary's base weight values. The diff weights will be summed
// across all BalancingRoundSummary entries (in this case, there are two BalancingRoundSummary entries).
assertEquals(node1BaseWeights.shardCount(), combinedNode1WeightsChanges.baseWeights().shardCount());
assertDoublesEqual(node1BaseWeights.diskUsageInBytes(), combinedNode1WeightsChanges.baseWeights().diskUsageInBytes());
assertDoublesEqual(node1BaseWeights.writeLoad(), combinedNode1WeightsChanges.baseWeights().writeLoad());
assertDoublesEqual(node1BaseWeights.nodeWeight(), combinedNode1WeightsChanges.baseWeights().nodeWeight());
assertEquals(2 * commonDiff.shardCountDiff(), combinedNode1WeightsChanges.weightsDiff().shardCountDiff());
assertDoublesEqual(2 * commonDiff.diskUsageInBytesDiff(), combinedNode1WeightsChanges.weightsDiff().diskUsageInBytesDiff());
assertDoublesEqual(2 * commonDiff.writeLoadDiff(), combinedNode1WeightsChanges.weightsDiff().writeLoadDiff());
assertDoublesEqual(2 * commonDiff.totalWeightDiff(), combinedNode1WeightsChanges.weightsDiff().totalWeightDiff());
assertEquals(node2BaseWeights.shardCount(), combinedNode2WeightsChanges.baseWeights().shardCount());
assertDoublesEqual(node2BaseWeights.diskUsageInBytes(), combinedNode2WeightsChanges.baseWeights().diskUsageInBytes());
assertDoublesEqual(node2BaseWeights.writeLoad(), combinedNode2WeightsChanges.baseWeights().writeLoad());
assertDoublesEqual(node2BaseWeights.nodeWeight(), combinedNode2WeightsChanges.baseWeights().nodeWeight());
assertEquals(2 * commonDiff.shardCountDiff(), combinedNode2WeightsChanges.weightsDiff().shardCountDiff());
assertDoublesEqual(2 * commonDiff.diskUsageInBytesDiff(), combinedNode2WeightsChanges.weightsDiff().diskUsageInBytesDiff());
assertDoublesEqual(2 * commonDiff.writeLoadDiff(), combinedNode2WeightsChanges.weightsDiff().writeLoadDiff());
assertDoublesEqual(2 * commonDiff.totalWeightDiff(), combinedNode2WeightsChanges.weightsDiff().totalWeightDiff());
}
/**
* Helper for double type inputs. assertEquals on double type inputs require a delta.
*/
private void assertDoublesEqual(double expected, double actual) {
assertEquals(expected, actual, 0.00001);
}
}
|
BalancingRoundSummaryTests
|
java
|
apache__camel
|
core/camel-core/src/test/java/org/apache/camel/processor/ShutdownCompleteCurrentTaskOnlyTest.java
|
{
"start": 1395,
"end": 3193
}
|
class ____ extends ContextTestSupport {
public static final String FILE_QUERY = "?initialDelay=0&delay=10&synchronous=true";
@Override
@BeforeEach
public void setUp() throws Exception {
super.setUp();
String url = fileUri(FILE_QUERY);
template.sendBodyAndHeader(url, "A", Exchange.FILE_NAME, "a.txt");
template.sendBodyAndHeader(url, "B", Exchange.FILE_NAME, "b.txt");
template.sendBodyAndHeader(url, "C", Exchange.FILE_NAME, "c.txt");
template.sendBodyAndHeader(url, "D", Exchange.FILE_NAME, "d.txt");
template.sendBodyAndHeader(url, "E", Exchange.FILE_NAME, "e.txt");
}
@Test
public void testShutdownCompleteCurrentTaskOnly() throws Exception {
// give it 20 seconds to shutdown
context.getShutdownStrategy().setTimeout(20);
MockEndpoint bar = getMockEndpoint("mock:bar");
bar.expectedMinimumMessageCount(1);
assertMockEndpointsSatisfied();
// shutdown during processing
context.stop();
// should NOT route all 5
assertTrue(bar.getReceivedCounter() < 5, "Should NOT complete all messages, was: " + bar.getReceivedCounter());
}
@Override
protected RouteBuilder createRouteBuilder() {
String url = fileUri(FILE_QUERY);
return new RouteBuilder() {
@Override
public void configure() {
from(url)
// let it complete only current task so we shutdown faster
.shutdownRunningTask(ShutdownRunningTask.CompleteCurrentTaskOnly).delay(1000).syncDelayed()
.to("seda:foo");
from("seda:foo").routeId("route2").to("mock:bar");
}
};
}
}
|
ShutdownCompleteCurrentTaskOnlyTest
|
java
|
mockito__mockito
|
mockito-core/src/test/java/org/mockitousage/junitrule/StubbingWarningsMultiThreadingTest.java
|
{
"start": 670,
"end": 2712
}
|
class ____ {
private SimpleMockitoLogger logger = new SimpleMockitoLogger();
@Rule public SafeJUnitRule rule = new SafeJUnitRule(new JUnitRule(logger, Strictness.WARN));
@Mock IMethods mock;
@Test
public void using_stubbing_from_different_thread() throws Throwable {
// expect no warnings
rule.expectSuccess(
new Runnable() {
public void run() {
assertTrue(logger.getLoggedInfo().isEmpty());
}
});
// when stubbing is declared
when(mock.simpleMethod()).thenReturn("1");
// and used from a different thread
ConcurrentTesting.inThread(
new Runnable() {
public void run() {
mock.simpleMethod();
}
});
}
@Test
public void unused_stub_from_different_thread() throws Throwable {
// expect warnings
rule.expectSuccess(
new Runnable() {
public void run() {
assertEquals(
"[MockitoHint] StubbingWarningsMultiThreadingTest.unused_stub_from_different_thread (see javadoc for MockitoHint):\n"
+ "[MockitoHint] 1. Unused -> at org.mockitousage.junitrule.StubbingWarningsMultiThreadingTest.unused_stub_from_different_thread(StubbingWarningsMultiThreadingTest.java:0)\n",
filterLineNo(logger.getLoggedInfo()));
}
});
// when stubbings are declared
when(mock.simpleMethod(1)).thenReturn("1");
when(mock.simpleMethod(2)).thenReturn("2");
// and one of the stubbings is used from a different thread
ConcurrentTesting.inThread(
new Runnable() {
public void run() {
mock.simpleMethod(1);
}
});
}
}
|
StubbingWarningsMultiThreadingTest
|
java
|
netty__netty
|
transport-classes-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollChannel.java
|
{
"start": 2719,
"end": 16331
}
|
class ____ extends AbstractChannel implements UnixChannel {
private static final ChannelMetadata METADATA = new ChannelMetadata(false);
protected final LinuxSocket socket;
/**
* The future of the current connection attempt. If not null, subsequent
* connection attempts will fail.
*/
private ChannelPromise connectPromise;
private Future<?> connectTimeoutFuture;
private SocketAddress requestedRemoteAddress;
private volatile SocketAddress local;
private volatile SocketAddress remote;
private IoRegistration registration;
boolean inputClosedSeenErrorOnRead;
private EpollIoOps ops;
private EpollIoOps inital;
protected volatile boolean active;
AbstractEpollChannel(Channel parent, LinuxSocket fd, boolean active, EpollIoOps initialOps) {
super(parent);
this.socket = checkNotNull(fd, "fd");
this.active = active;
if (active) {
// Directly cache the remote and local addresses
// See https://github.com/netty/netty/issues/2359
this.local = fd.localAddress();
this.remote = fd.remoteAddress();
}
this.ops = initialOps;
}
AbstractEpollChannel(Channel parent, LinuxSocket fd, SocketAddress remote, EpollIoOps initialOps) {
super(parent);
this.socket = checkNotNull(fd, "fd");
this.active = true;
// Directly cache the remote and local addresses
// See https://github.com/netty/netty/issues/2359
this.remote = remote;
this.local = fd.localAddress();
this.ops = initialOps;
}
static boolean isSoErrorZero(Socket fd) {
try {
return fd.getSoError() == 0;
} catch (IOException e) {
throw new ChannelException(e);
}
}
protected void setFlag(int flag) throws IOException {
if (ops.contains(flag)) {
// we can save a syscall if the ops did not change
return;
}
ops = ops.with(EpollIoOps.valueOf(flag));
if (isRegistered()) {
IoRegistration registration = registration();
registration.submit(ops);
} else {
ops = ops.with(EpollIoOps.valueOf(flag));
}
}
void clearFlag(int flag) throws IOException {
IoRegistration registration = registration();
if (!ops.contains(flag)) {
// we can save a syscall if the ops did not change
return;
}
ops = ops.without(EpollIoOps.valueOf(flag));
registration.submit(ops);
}
protected final IoRegistration registration() {
assert registration != null;
return registration;
}
boolean isFlagSet(int flag) {
return (ops.value & flag) != 0;
}
@Override
public final FileDescriptor fd() {
return socket;
}
@Override
public abstract EpollChannelConfig config();
@Override
public boolean isActive() {
return active;
}
@Override
public ChannelMetadata metadata() {
return METADATA;
}
@Override
protected void doClose() throws Exception {
active = false;
// Even if we allow half closed sockets we should give up on reading. Otherwise we may allow a read attempt on a
// socket which has not even been connected yet. This has been observed to block during unit tests.
inputClosedSeenErrorOnRead = true;
try {
ChannelPromise promise = connectPromise;
if (promise != null) {
// Use tryFailure() instead of setFailure() to avoid the race against cancel().
promise.tryFailure(new ClosedChannelException());
connectPromise = null;
}
Future<?> future = connectTimeoutFuture;
if (future != null) {
future.cancel(false);
connectTimeoutFuture = null;
}
if (isRegistered()) {
// Need to check if we are on the EventLoop as doClose() may be triggered by the GlobalEventExecutor
// if SO_LINGER is used.
//
// See https://github.com/netty/netty/issues/7159
EventLoop loop = eventLoop();
if (loop.inEventLoop()) {
doDeregister();
} else {
loop.execute(new Runnable() {
@Override
public void run() {
try {
doDeregister();
} catch (Throwable cause) {
pipeline().fireExceptionCaught(cause);
}
}
});
}
}
} finally {
socket.close();
}
}
void resetCachedAddresses() {
local = socket.localAddress();
remote = socket.remoteAddress();
}
@Override
protected void doDisconnect() throws Exception {
doClose();
}
@Override
public boolean isOpen() {
return socket.isOpen();
}
@Override
protected void doDeregister() throws Exception {
IoRegistration registration = this.registration;
if (registration != null) {
ops = inital;
registration.cancel();
}
}
@Override
protected boolean isCompatible(EventLoop loop) {
return loop instanceof IoEventLoop && ((IoEventLoop) loop).isCompatible(AbstractEpollUnsafe.class);
}
@Override
protected void doBeginRead() throws Exception {
// Channel.read() or ChannelHandlerContext.read() was called
final AbstractEpollUnsafe unsafe = (AbstractEpollUnsafe) unsafe();
unsafe.readPending = true;
// We must set the read flag here as it is possible the user didn't read in the last read loop, the
// executeEpollInReadyRunnable could read nothing, and if the user doesn't explicitly call read they will
// never get data after this.
setFlag(Native.EPOLLIN);
}
final boolean shouldBreakEpollInReady(ChannelConfig config) {
return socket.isInputShutdown() && (inputClosedSeenErrorOnRead || !isAllowHalfClosure(config));
}
private static boolean isAllowHalfClosure(ChannelConfig config) {
if (config instanceof EpollDomainSocketChannelConfig) {
return ((EpollDomainSocketChannelConfig) config).isAllowHalfClosure();
}
return config instanceof SocketChannelConfig &&
((SocketChannelConfig) config).isAllowHalfClosure();
}
final void clearEpollIn() {
// Only clear if registered with an EventLoop as otherwise
if (isRegistered()) {
final EventLoop loop = eventLoop();
final AbstractEpollUnsafe unsafe = (AbstractEpollUnsafe) unsafe();
if (loop.inEventLoop()) {
unsafe.clearEpollIn0();
} else {
// schedule a task to clear the EPOLLIN as it is not safe to modify it directly
loop.execute(new Runnable() {
@Override
public void run() {
if (!unsafe.readPending && !config().isAutoRead()) {
// Still no read triggered so clear it now
unsafe.clearEpollIn0();
}
}
});
}
} else {
// The EventLoop is not registered atm so just update the flags so the correct value
// will be used once the channel is registered
ops = ops.without(EpollIoOps.EPOLLIN);
}
}
@Override
protected void doRegister(ChannelPromise promise) {
((IoEventLoop) eventLoop()).register((AbstractEpollUnsafe) unsafe()).addListener(f -> {
if (f.isSuccess()) {
registration = (IoRegistration) f.getNow();
registration.submit(ops);
inital = ops;
promise.setSuccess();
} else {
promise.setFailure(f.cause());
}
});
}
@Override
protected abstract AbstractEpollUnsafe newUnsafe();
/**
* Returns an off-heap copy of the specified {@link ByteBuf}, and releases the original one.
*/
protected final ByteBuf newDirectBuffer(ByteBuf buf) {
return newDirectBuffer(buf, buf);
}
/**
* Returns an off-heap copy of the specified {@link ByteBuf}, and releases the specified holder.
* The caller must ensure that the holder releases the original {@link ByteBuf} when the holder is released by
* this method.
*/
protected final ByteBuf newDirectBuffer(Object holder, ByteBuf buf) {
final int readableBytes = buf.readableBytes();
if (readableBytes == 0) {
ReferenceCountUtil.release(holder);
return Unpooled.EMPTY_BUFFER;
}
final ByteBufAllocator alloc = alloc();
if (alloc.isDirectBufferPooled()) {
return newDirectBuffer0(holder, buf, alloc, readableBytes);
}
final ByteBuf directBuf = ByteBufUtil.threadLocalDirectBuffer();
if (directBuf == null) {
return newDirectBuffer0(holder, buf, alloc, readableBytes);
}
directBuf.writeBytes(buf, buf.readerIndex(), readableBytes);
ReferenceCountUtil.safeRelease(holder);
return directBuf;
}
private static ByteBuf newDirectBuffer0(Object holder, ByteBuf buf, ByteBufAllocator alloc, int capacity) {
final ByteBuf directBuf = alloc.directBuffer(capacity);
directBuf.writeBytes(buf, buf.readerIndex(), capacity);
ReferenceCountUtil.safeRelease(holder);
return directBuf;
}
protected static void checkResolvable(InetSocketAddress addr) {
if (addr.isUnresolved()) {
throw new UnresolvedAddressException();
}
}
/**
* Read bytes into the given {@link ByteBuf} and return the amount.
*/
protected final int doReadBytes(ByteBuf byteBuf) throws Exception {
int writerIndex = byteBuf.writerIndex();
int localReadAmount;
unsafe().recvBufAllocHandle().attemptedBytesRead(byteBuf.writableBytes());
if (byteBuf.hasMemoryAddress()) {
localReadAmount = socket.recvAddress(byteBuf.memoryAddress(), writerIndex, byteBuf.capacity());
} else {
ByteBuffer buf = byteBuf.internalNioBuffer(writerIndex, byteBuf.writableBytes());
localReadAmount = socket.recv(buf, buf.position(), buf.limit());
}
if (localReadAmount > 0) {
byteBuf.writerIndex(writerIndex + localReadAmount);
}
return localReadAmount;
}
protected final int doWriteBytes(ChannelOutboundBuffer in, ByteBuf buf) throws Exception {
if (buf.hasMemoryAddress()) {
int localFlushedAmount = socket.sendAddress(buf.memoryAddress(), buf.readerIndex(), buf.writerIndex());
if (localFlushedAmount > 0) {
in.removeBytes(localFlushedAmount);
return 1;
}
} else {
final ByteBuffer nioBuf = buf.nioBufferCount() == 1 ?
buf.internalNioBuffer(buf.readerIndex(), buf.readableBytes()) : buf.nioBuffer();
int localFlushedAmount = socket.send(nioBuf, nioBuf.position(), nioBuf.limit());
if (localFlushedAmount > 0) {
nioBuf.position(nioBuf.position() + localFlushedAmount);
in.removeBytes(localFlushedAmount);
return 1;
}
}
return WRITE_STATUS_SNDBUF_FULL;
}
/**
* Write bytes to the socket, with or without a remote address.
* Used for datagram and TCP client fast open writes.
*/
final long doWriteOrSendBytes(ByteBuf data, InetSocketAddress remoteAddress, boolean fastOpen)
throws IOException {
assert !(fastOpen && remoteAddress == null) : "fastOpen requires a remote address";
if (data.hasMemoryAddress()) {
long memoryAddress = data.memoryAddress();
if (remoteAddress == null) {
return socket.sendAddress(memoryAddress, data.readerIndex(), data.writerIndex());
}
return socket.sendToAddress(memoryAddress, data.readerIndex(), data.writerIndex(),
remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen);
}
if (data.nioBufferCount() > 1) {
IovArray array = ((NativeArrays) registration.attachment()).cleanIovArray();
array.add(data, data.readerIndex(), data.readableBytes());
int cnt = array.count();
assert cnt != 0;
if (remoteAddress == null) {
return socket.writevAddresses(array.memoryAddress(0), cnt);
}
return socket.sendToAddresses(array.memoryAddress(0), cnt,
remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen);
}
ByteBuffer nioData = data.internalNioBuffer(data.readerIndex(), data.readableBytes());
if (remoteAddress == null) {
return socket.send(nioData, nioData.position(), nioData.limit());
}
return socket.sendTo(nioData, nioData.position(), nioData.limit(),
remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen);
}
protected abstract
|
AbstractEpollChannel
|
java
|
quarkusio__quarkus
|
extensions/resteasy-reactive/rest/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/security/AbstractCustomExceptionMapperTest.java
|
{
"start": 3104,
"end": 3400
}
|
class ____ {
@GET
public String hello(@Context SecurityContext context) {
var principalName = context.getUserPrincipal() == null ? "" : " " + context.getUserPrincipal().getName();
return "Hello" + principalName;
}
}
public static
|
HelloResource
|
java
|
apache__flink
|
flink-clients/src/main/java/org/apache/flink/client/program/artifact/FsArtifactFetcher.java
|
{
"start": 1217,
"end": 2114
}
|
class ____ extends ArtifactFetcher {
private static final Logger LOG = LoggerFactory.getLogger(FsArtifactFetcher.class);
@Override
File fetch(String uri, Configuration flinkConf, File targetDir) throws Exception {
ArtifactUtils.createMissingParents(targetDir);
Path source = new Path(uri);
long start = System.currentTimeMillis();
FileSystem fileSystem = source.getFileSystem();
String fileName = source.getName();
File targetFile = new File(targetDir, fileName);
try (FSDataInputStream inputStream = fileSystem.open(source)) {
FileUtils.copyToFile(inputStream, targetFile);
}
LOG.debug(
"Copied file from {} to {}, cost {} ms",
source,
targetFile,
System.currentTimeMillis() - start);
return targetFile;
}
}
|
FsArtifactFetcher
|
java
|
hibernate__hibernate-orm
|
hibernate-core/src/test/java/org/hibernate/orm/test/jpa/procedure/StoreProcedureRefCursorOutParameterByPositionTest.java
|
{
"start": 1415,
"end": 3762
}
|
class ____ {
@BeforeEach
public void startUp(EntityManagerFactoryScope scope) {
createProcedures( scope.getEntityManagerFactory() );
}
@AfterEach
public void cleanup(EntityManagerFactoryScope scope) {
scope.inTransaction( em -> {
em.createQuery( "delete from User" ).executeUpdate();
}
);
}
@Test
public void testNamedStoredProcedureExecution(EntityManagerFactoryScope scope) {
scope.inEntityManager( em -> {
StoredProcedureQuery query = em.createNamedStoredProcedureQuery( "User.findByName" );
query.setParameter( 1, "my_name" );
query.getResultList();
} );
}
private void createProcedures(EntityManagerFactory emf) {
final SessionFactoryImplementor sf = emf.unwrap( SessionFactoryImplementor.class );
final JdbcConnectionAccess connectionAccess = sf.getServiceRegistry()
.getService( JdbcServices.class )
.getBootstrapJdbcConnectionAccess();
final Connection conn;
try {
conn = connectionAccess.obtainConnection();
conn.setAutoCommit( false );
try {
Statement statement = conn.createStatement();
statement.execute(
"CREATE OR REPLACE PROCEDURE PROC_EXAMPLE ( " +
" USER_NAME_PARAM IN VARCHAR2, CURSOR_PARAM OUT SYS_REFCURSOR ) " +
"AS " +
"BEGIN " +
" OPEN CURSOR_PARAM FOR " +
" SELECT * FROM USERS WHERE NAME = USER_NAME_PARAM; " +
"END PROC_EXAMPLE; "
);
try {
statement.close();
}
catch (SQLException ignore) {
fail();
}
}
finally {
try {
conn.commit();
}
catch (SQLException e) {
System.out.println( "Unable to commit transaction after creating creating procedures" );
fail();
}
try {
connectionAccess.releaseConnection( conn );
}
catch (SQLException ignore) {
fail();
}
}
}
catch (SQLException e) {
throw new RuntimeException( "Unable to create stored procedures", e );
}
}
@NamedStoredProcedureQuery(name = "User.findByName",
resultClasses = User.class,
procedureName = "PROC_EXAMPLE"
,
parameters = {
@StoredProcedureParameter(mode = ParameterMode.IN, type = String.class),
@StoredProcedureParameter(mode = ParameterMode.REF_CURSOR, type = Class.class)
}
)
@Entity(name = "User")
@Table(name = "USERS")
public static
|
StoreProcedureRefCursorOutParameterByPositionTest
|
java
|
spring-projects__spring-boot
|
core/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java
|
{
"start": 89040,
"end": 89308
}
|
class ____ {
private final Nested nested;
ConstructorBindingWithOuterClassConstructorBoundProperties(Nested nested) {
this.nested = nested;
}
Nested getNested() {
return this.nested;
}
static
|
ConstructorBindingWithOuterClassConstructorBoundProperties
|
java
|
spring-projects__spring-framework
|
spring-context/src/test/java/org/springframework/aop/aspectj/generic/GenericBridgeMethodMatchingTests.java
|
{
"start": 1625,
"end": 2534
}
|
class ____ {
private ClassPathXmlApplicationContext ctx;
protected DerivedInterface<String> testBean;
protected GenericCounterAspect counterAspect;
@BeforeEach
@SuppressWarnings("unchecked")
void setup() {
this.ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
counterAspect = ctx.getBean("counterAspect", GenericCounterAspect.class);
counterAspect.count = 0;
testBean = (DerivedInterface<String>) ctx.getBean("testBean");
}
@AfterEach
void tearDown() {
this.ctx.close();
}
@Test
void testGenericDerivedInterfaceMethodThroughInterface() {
testBean.genericDerivedInterfaceMethod("");
assertThat(counterAspect.count).isEqualTo(1);
}
@Test
void testGenericBaseInterfaceMethodThroughInterface() {
testBean.genericBaseInterfaceMethod("");
assertThat(counterAspect.count).isEqualTo(1);
}
}
|
GenericBridgeMethodMatchingTests
|
java
|
apache__hadoop
|
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/DecayRpcSchedulerMXBean.java
|
{
"start": 896,
"end": 1199
}
|
interface ____ {
// Get an overview of the requests in history.
String getSchedulingDecisionSummary();
String getCallVolumeSummary();
int getUniqueIdentityCount();
long getTotalCallVolume();
double[] getAverageResponseTime();
long[] getResponseTimeCountInLastWindow();
}
|
DecayRpcSchedulerMXBean
|
java
|
redisson__redisson
|
redisson/src/main/java/org/redisson/RedissonLiveObjectService.java
|
{
"start": 39772,
"end": 44455
}
|
class ____ annotated with REntity.");
}
if (idField.getType().isAssignableFrom(RObject.class)) {
throw new IllegalArgumentException("Field with RId annotation cannot be a type of RObject");
}
}
private <T> void validateDetached(T detachedObject) {
if (detachedObject instanceof RLiveObject) {
throw new IllegalArgumentException("The object supplied is already a RLiveObject");
}
}
private <T> void validateAttached(T attachedObject) {
if (!(attachedObject instanceof RLiveObject)) {
throw new IllegalArgumentException("The object supplied is must be a RLiveObject");
}
}
private <T> Class<? extends T> createProxy(Class<T> entityClass, CommandAsyncExecutor commandExecutor) {
DynamicType.Builder<T> builder = new ByteBuddy()
.subclass(entityClass);
for (FieldDescription.InDefinedShape field
: Introspectior.getTypeDescription(LiveObjectTemplate.class)
.getDeclaredFields()) {
builder = builder.define(field);
}
Class<? extends T> proxied = builder.method(ElementMatchers.isDeclaredBy(
ElementMatchers.anyOf(RLiveObject.class, RExpirable.class, RObject.class))
.and(ElementMatchers.isGetter().or(ElementMatchers.isSetter())
.or(ElementMatchers.named("isPhantom"))
.or(ElementMatchers.named("delete"))))
.intercept(MethodDelegation.withDefaultConfiguration()
.withBinders(FieldProxy.Binder
.install(LiveObjectInterceptor.Getter.class,
LiveObjectInterceptor.Setter.class))
.to(new LiveObjectInterceptor(commandExecutor, this, entityClass, mapResolver)))
.implement(RLiveObject.class)
.method(ElementMatchers.isAnnotatedWith(RFieldAccessor.class)
.and(ElementMatchers.named("get")
.or(ElementMatchers.named("set"))))
.intercept(MethodDelegation.to(FieldAccessorInterceptor.class))
.method(ElementMatchers.isDeclaredBy(Map.class)
.or(ElementMatchers.isDeclaredBy(RExpirable.class))
.or(ElementMatchers.isDeclaredBy(RExpirableAsync.class))
.or(ElementMatchers.isDeclaredBy(ConcurrentMap.class))
.or(ElementMatchers.isDeclaredBy(RMapAsync.class))
.or(ElementMatchers.isDeclaredBy(RMap.class)))
.intercept(MethodDelegation.withDefaultConfiguration()
.withBinders(FieldProxy.Binder
.install(LiveObjectInterceptor.Getter.class,
LiveObjectInterceptor.Setter.class)).to(new RMapInterceptor(commandExecutor, entityClass, mapResolver)))
.implement(RMap.class)
.method(ElementMatchers.not(ElementMatchers.isDeclaredBy(Object.class))
.and(ElementMatchers.not(ElementMatchers.isDeclaredBy(RLiveObject.class)))
.and(ElementMatchers.not(ElementMatchers.isDeclaredBy(RExpirable.class)))
.and(ElementMatchers.not(ElementMatchers.isDeclaredBy(RExpirableAsync.class)))
.and(ElementMatchers.not(ElementMatchers.isDeclaredBy(RObject.class)))
.and(ElementMatchers.not(ElementMatchers.isDeclaredBy(RObjectAsync.class)))
.and(ElementMatchers.not(ElementMatchers.isDeclaredBy(ConcurrentMap.class)))
.and(ElementMatchers.not(ElementMatchers.isDeclaredBy(Map.class)))
.and(ElementMatchers.isGetter()
.or(ElementMatchers.isSetter()))
.and(ElementMatchers.isPublic()
.or(ElementMatchers.isProtected()))
)
.intercept(MethodDelegation.withDefaultConfiguration()
.withBinders(FieldProxy.Binder
.install(LiveObjectInterceptor.Getter.class,
LiveObjectInterceptor.Setter.class))
.to(new AccessorInterceptor(entityClass, commandExecutor, mapResolver)))
.make().load(entityClass.getClassLoader(),
ClassLoadingStrategy.Default.WRAPPER)
.getLoaded();
return proxied;
}
}
|
is
|
java
|
hibernate__hibernate-orm
|
hibernate-core/src/test/java/org/hibernate/orm/test/sharedSession/SimpleSharedSessionBuildingTests.java
|
{
"start": 10916,
"end": 11114
}
|
class ____ implements SessionEventListener {
private boolean closed;
public boolean wasClosed() {
return closed;
}
@Override
public void end() {
closed = true;
}
}
}
|
SessionListener
|
java
|
apache__camel
|
components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteEmbeddingStoreIT.java
|
{
"start": 2291,
"end": 9070
}
|
class ____ extends InfinispanRemoteTestSupport {
private static final String CACHE_NAME = "camel-infinispan-embeddings";
private static final int DIMENSION = 3;
private static final String ENTITY_TYPE_NAME = EmbeddingStoreUtil.DEFAULT_TYPE_NAME_PREFIX + DIMENSION;
@BeforeEach
protected void beforeEach() {
getCache(CACHE_NAME).clear();
Awaitility.await().atMost(Duration.ofSeconds(1)).until(() -> cacheContainer.isStarted());
}
@Test
public void embeddingStore() throws Exception {
Embedding embedding = Embedding.from(new float[] { 1.0f, 2.0f, 3.0f });
fluentTemplate.to("direct:put")
.withBody(embedding)
.send();
List<Object> results = fluentTemplate.toF("direct:query")
.withBody(embedding)
.request(List.class);
assertEquals(1, results.size());
}
@Test
public void dimensionUnspecifiedThrowsException() throws Exception {
assertThrows(IllegalArgumentException.class, () -> {
InfinispanRemoteConfiguration configuration = new InfinispanRemoteConfiguration();
new InfinispanRemoteManager(context, configuration).start();
});
}
@Test
public void embeddingStoreDisabled() {
InfinispanRemoteConfiguration configuration = createInfinispanRemoteConfiguration();
configuration.setEmbeddingStoreEnabled(false);
InfinispanRemoteManager manager = new InfinispanRemoteManager(context, configuration);
try {
manager.start();
Optional<Schema> metadata
= cacheContainer.administration().schemas().get(EmbeddingStoreUtil.getSchemeFileName(configuration));
assertTrue(metadata.isEmpty());
} finally {
manager.stop();
}
}
@Test
public void registerSchemaDisabled() {
InfinispanRemoteConfiguration configuration = createInfinispanRemoteConfiguration();
configuration.setEmbeddingStoreRegisterSchema(false);
configuration.setEmbeddingStoreDimension(999);
InfinispanRemoteManager manager = new InfinispanRemoteManager(context, configuration);
try {
manager.start();
Optional<Schema> metadata
= cacheContainer.administration().schemas().get(EmbeddingStoreUtil.getSchemeFileName(configuration));
assertTrue(metadata.isEmpty());
} finally {
manager.stop();
}
}
@ParameterizedTest
@EnumSource(VectorSimilarity.class)
public void registerSchema(VectorSimilarity similarity) {
int dimension = 900 + similarity.ordinal();
String typeName = EmbeddingStoreUtil.DEFAULT_TYPE_NAME_PREFIX + dimension;
InfinispanRemoteConfiguration configuration = createInfinispanRemoteConfiguration();
configuration.setEmbeddingStoreDimension(dimension);
configuration.setEmbeddingStoreTypeName(typeName);
configuration.setEmbeddingStoreVectorSimilarity(similarity);
InfinispanRemoteManager manager = new InfinispanRemoteManager(context, configuration);
BasicCache<Object, Object> metadataCache = null;
try {
manager.start();
Optional<Schema> metadata
= cacheContainer.administration().schemas().get(EmbeddingStoreUtil.getSchemeFileName(configuration));
assertTrue(metadata.isPresent());
assertNotNull(metadata);
} finally {
if (metadataCache != null) {
metadataCache.remove(EmbeddingStoreUtil.getSchemeFileName(configuration));
}
manager.stop();
}
}
@Override
protected RemoteCacheManager getCacheContainer() {
InfinispanRemoteConfiguration configuration = new InfinispanRemoteConfiguration();
configuration.setEmbeddingStoreDimension(DIMENSION);
ConfigurationBuilder builder = getConfiguration();
EmbeddingStoreUtil.configureMarshaller(configuration, builder);
return new RemoteCacheManager(builder.build());
}
@Override
protected void getOrCreateCache() {
String configuration = "<distributed-cache name=\"" + CACHE_NAME + "\">\n"
+ "<indexing storage=\"local-heap\">\n"
+ "<indexed-entities>\n"
+ "<indexed-entity>" + ENTITY_TYPE_NAME + "</indexed-entity>\n"
+ "</indexed-entities>\n"
+ "</indexing>\n"
+ "</distributed-cache>";
cacheContainer.administration().getOrCreateCache(CACHE_NAME, new StringConfiguration(configuration));
}
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
// Fake that langchain4j-embeddings is on the classpath
camelContext.addComponent("langchain4j-embeddings", camelContext.getComponent("stub"));
return camelContext;
}
@Override
protected RoutesBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:put")
.setHeader(CamelLangchain4jAttributes.CAMEL_LANGCHAIN4J_EMBEDDING_VECTOR).body()
.transform(new DataType("infinispan:embeddings"))
.toF("infinispan://%s?embeddingStoreDimension=3", CACHE_NAME);
from("direct:query")
.setHeader(CamelLangchain4jAttributes.CAMEL_LANGCHAIN4J_EMBEDDING_VECTOR).body()
.setHeader(InfinispanConstants.OPERATION).constant(InfinispanOperation.QUERY)
.transform(new DataType("infinispan:embeddings"))
.toF("infinispan://%s?embeddingStoreDimension=3&embeddingStoreDistance=2", CACHE_NAME);
}
};
}
private InfinispanRemoteConfiguration createInfinispanRemoteConfiguration() {
InfinispanRemoteConfiguration configuration = new InfinispanRemoteConfiguration();
configuration.setHosts(service.getServiceAddress());
configuration.setUsername(service.username());
configuration.setPassword(service.password());
configuration.setSaslMechanism("DIGEST-MD5");
configuration.setSecurityRealm("default");
configuration.setSecure(true);
if (SystemUtils.IS_OS_MAC) {
configuration.addConfigurationProperty("infinispan.client.hotrod.client_intelligence", "BASIC");
}
return configuration;
}
}
|
InfinispanRemoteEmbeddingStoreIT
|
java
|
google__guice
|
core/test/com/google/inject/BinderTestSuite.java
|
{
"start": 25363,
"end": 25632
}
|
class ____ extends Injectable {
@Inject
public void inject(
@Named("apple") ScopedA scopedA, @Named("apple") Provider<ScopedA> scopedAProvider) {
this.value = scopedA;
this.provider = scopedAProvider;
}
}
static
|
InjectsScopedANamedApple
|
java
|
hibernate__hibernate-orm
|
hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/EntityWithMutableAttributesTest.java
|
{
"start": 2084,
"end": 3943
}
|
class ____ {
@BeforeAll
static void beforeAll() {
String byteCodeProvider = Environment.getProperties().getProperty( AvailableSettings.BYTECODE_PROVIDER );
assumeFalse( byteCodeProvider != null && !BytecodeProviderInitiator.BYTECODE_PROVIDER_NAME_BYTEBUDDY.equals(
byteCodeProvider ) );
}
@BeforeEach
public void setUp(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
User user = new User();
user.setId( 1 );
user.setDate( new Date() );
user.setEmail( "not null string" );
Role role = new Role();
role.setId( 2 );
role.setDate( new Date() );
role.setName( "manager" );
user.setRole( role );
session.persist( role );
session.persist( user );
}
);
}
@AfterEach
public void tearDown(SessionFactoryScope scope) {
scope.getSessionFactory().getSchemaManager().truncate();
}
@Test
public void testLoad(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
User user = session.getReference( User.class, 1 );
assertThat(
user, instanceOf( PersistentAttributeInterceptable.class )
);
final PersistentAttributeInterceptable interceptable = (PersistentAttributeInterceptable) user;
assertThat(
interceptable.$$_hibernate_getInterceptor(),
instanceOf( EnhancementAsProxyLazinessInterceptor.class )
);
}
);
}
@Test
public void testMutableAttributeIsUpdated(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
User user = session.getReference( User.class, 1 );
user.getDate().setTime( 0 );
}
);
scope.inTransaction(
session -> {
User user = session.getReference( User.class, 1 );
assertThat( user.getDate().getTime(), is( 0L ) );
}
);
}
@Entity(name = "User")
@Table(name = "appuser")
public static
|
EntityWithMutableAttributesTest
|
java
|
spring-projects__spring-boot
|
core/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java
|
{
"start": 13517,
"end": 13561
}
|
class ____ {
}
@FunctionalInterface
|
Example
|
java
|
quarkusio__quarkus
|
extensions/resteasy-reactive/rest/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusInvokerFactory.java
|
{
"start": 1122,
"end": 4229
}
|
class ____ implements EndpointInvokerFactory {
private final Predicate<String> applicationClassPredicate;
final BuildProducer<GeneratedClassBuildItem> generatedClassBuildItemBuildProducer;
final ResteasyReactiveRecorder recorder;
private final Map<String, Supplier<EndpointInvoker>> generatedInvokers = new HashMap<>();
public QuarkusInvokerFactory(Predicate<String> applicationClassPredicate,
BuildProducer<GeneratedClassBuildItem> generatedClassBuildItemBuildProducer,
ResteasyReactiveRecorder recorder) {
this.applicationClassPredicate = applicationClassPredicate;
this.generatedClassBuildItemBuildProducer = generatedClassBuildItemBuildProducer;
this.recorder = recorder;
}
@Override
public Supplier<EndpointInvoker> create(ResourceMethod method, ClassInfo currentClassInfo, MethodInfo info) {
String endpointIdentifier = info.toString() +
method.getHttpMethod() +
method.getPath() +
Arrays.toString(method.getConsumes()) +
Arrays.toString(method.getProduces());
String baseName = currentClassInfo.name() + "$quarkusrestinvoker$" + method.getName() + "_"
+ HashUtil.sha1(endpointIdentifier);
if (generatedInvokers.containsKey(baseName)) {
return generatedInvokers.get(baseName);
}
ClassOutput classOutput = new GeneratedClassGizmo2Adaptor(generatedClassBuildItemBuildProducer, null,
applicationClassPredicate.test(currentClassInfo.name().toString()));
Gizmo g = Gizmo.create(classOutput)
.withDebugInfo(false)
.withParameters(false);
g.class_(baseName, cc -> {
cc.defaultConstructor();
cc.implements_(EndpointInvoker.class);
cc.method("invoke", mc -> {
ParamVar resourceParam = mc.parameter("resource", Object.class);
ParamVar resourceMethodArgsParam = mc.parameter("args", Object[].class);
mc.returning(Object.class);
mc.body(bc -> {
List<Expr> args = new ArrayList<>(method.getParameters().length);
Expr res;
for (int i = 0; i < method.getParameters().length; ++i) {
args.add(resourceMethodArgsParam.elem(i));
}
if (Modifier.isInterface(currentClassInfo.flags())) {
res = bc.invokeInterface(methodDescOf(info), resourceParam, args);
} else {
res = bc.invokeVirtual(methodDescOf(info), resourceParam, args);
}
if (info.returnType().kind() == Type.Kind.VOID) {
bc.returnNull();
} else {
bc.return_(res);
}
});
});
});
var result = recorder.invoker(baseName);
generatedInvokers.put(baseName, result);
return result;
}
}
|
QuarkusInvokerFactory
|
java
|
quarkusio__quarkus
|
independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injectionpoint/BeanWithInjectionPointMetadata.java
|
{
"start": 351,
"end": 1166
}
|
class ____ {
@Inject
InjectionPoint field;
InjectionPoint constructor;
InjectionPoint initializer;
@Inject
public BeanWithInjectionPointMetadata(InjectionPoint ip) {
this.constructor = ip;
}
@Inject
void init(InjectionPoint ip) {
this.initializer = ip;
}
public void assertPresent(Consumer<InjectionPoint> asserter) {
assertNotNull(field);
assertNotNull(constructor);
assertNotNull(initializer);
if (asserter != null) {
asserter.accept(field);
asserter.accept(constructor);
asserter.accept(initializer);
}
}
public void assertAbsent() {
assertNull(field);
assertNull(constructor);
assertNull(initializer);
}
}
|
BeanWithInjectionPointMetadata
|
java
|
apache__hadoop
|
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/Writable.java
|
{
"start": 2362,
"end": 3037
}
|
interface ____ {
/**
* Serialize the fields of this object to <code>out</code>.
*
* @param out <code>DataOuput</code> to serialize this object into.
* @throws IOException any other problem for write.
*/
void write(DataOutput out) throws IOException;
/**
* Deserialize the fields of this object from <code>in</code>.
*
* <p>For efficiency, implementations should attempt to re-use storage in the
* existing object where possible.</p>
*
* @param in <code>DataInput</code> to deseriablize this object from.
* @throws IOException any other problem for readFields.
*/
void readFields(DataInput in) throws IOException;
}
|
Writable
|
java
|
quarkusio__quarkus
|
integration-tests/smallrye-graphql-client/src/main/java/io/quarkus/io/smallrye/graphql/client/LuckyNumbersResource.java
|
{
"start": 573,
"end": 1749
}
|
class ____ {
private volatile Integer luckyNumber = 12;
@Inject
CurrentVertxRequest request;
@Inject
SmallRyeContext context;
@Query(value = "get")
public Integer luckyNumber() {
return luckyNumber;
}
@Mutation(value = "set")
public Integer setLuckyNumber(Integer newLuckyNumber) {
luckyNumber = newLuckyNumber;
return luckyNumber;
}
@Subscription
public Multi<Integer> primeNumbers() {
return Multi.createFrom().items(2, 3, 5, 7, 11, 13);
}
@Query(value = "echoList")
public List<Integer> echoList(@NonNull List<Integer> list) {
return list;
}
@Query
public String returnHeader(String key) {
return request.getCurrent().request().getHeader(key);
}
@Query
public String piNumber() {
QueryDirectives directives = context.getDataFetchingEnvironment().getQueryDirectives();
if (directives.getImmediateAppliedDirective("skip").isEmpty()) {
throw new IllegalArgumentException("Directive 'skip' was not found in the query (on the server side).");
}
return "3.14159";
}
}
|
LuckyNumbersResource
|
java
|
google__guava
|
android/guava-testlib/test/com/google/common/testing/ArbitraryInstancesTest.java
|
{
"start": 5223,
"end": 19884
}
|
class ____ extends TestCase {
public void testGet_primitives() {
assertThat(ArbitraryInstances.get(void.class)).isNull();
assertThat(ArbitraryInstances.get(Void.class)).isNull();
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(Boolean.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(char.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(Character.class));
assertEquals(Byte.valueOf((byte) 0), ArbitraryInstances.get(byte.class));
assertEquals(Byte.valueOf((byte) 0), ArbitraryInstances.get(Byte.class));
assertEquals(Short.valueOf((short) 0), ArbitraryInstances.get(short.class));
assertEquals(Short.valueOf((short) 0), ArbitraryInstances.get(Short.class));
assertEquals(Integer.valueOf(0), ArbitraryInstances.get(int.class));
assertEquals(Integer.valueOf(0), ArbitraryInstances.get(Integer.class));
assertEquals(Long.valueOf(0), ArbitraryInstances.get(long.class));
assertEquals(Long.valueOf(0), ArbitraryInstances.get(Long.class));
assertEquals(Float.valueOf(0), ArbitraryInstances.get(float.class));
assertEquals(Float.valueOf(0), ArbitraryInstances.get(Float.class));
assertThat(ArbitraryInstances.get(double.class)).isEqualTo(Double.valueOf(0));
assertThat(ArbitraryInstances.get(Double.class)).isEqualTo(Double.valueOf(0));
assertEquals(UnsignedInteger.ZERO, ArbitraryInstances.get(UnsignedInteger.class));
assertEquals(UnsignedLong.ZERO, ArbitraryInstances.get(UnsignedLong.class));
assertEquals(0, ArbitraryInstances.get(BigDecimal.class).intValue());
assertEquals(0, ArbitraryInstances.get(BigInteger.class).intValue());
assertEquals("", ArbitraryInstances.get(String.class));
assertEquals("", ArbitraryInstances.get(CharSequence.class));
assertEquals(SECONDS, ArbitraryInstances.get(TimeUnit.class));
assertThat(ArbitraryInstances.get(Object.class)).isNotNull();
assertEquals(0, ArbitraryInstances.get(Number.class));
assertEquals(UTF_8, ArbitraryInstances.get(Charset.class));
assertThat(ArbitraryInstances.get(UUID.class)).isNotNull();
}
public void testGet_collections() {
assertEquals(ImmutableSet.of().iterator(), ArbitraryInstances.get(Iterator.class));
assertFalse(ArbitraryInstances.get(PeekingIterator.class).hasNext());
assertFalse(ArbitraryInstances.get(ListIterator.class).hasNext());
assertEquals(ImmutableSet.of(), ArbitraryInstances.get(Iterable.class));
assertEquals(ImmutableSet.of(), ArbitraryInstances.get(Set.class));
assertEquals(ImmutableSet.of(), ArbitraryInstances.get(ImmutableSet.class));
assertEquals(ImmutableSortedSet.of(), ArbitraryInstances.get(SortedSet.class));
assertEquals(ImmutableSortedSet.of(), ArbitraryInstances.get(ImmutableSortedSet.class));
assertEquals(ImmutableList.of(), ArbitraryInstances.get(Collection.class));
assertEquals(ImmutableList.of(), ArbitraryInstances.get(ImmutableCollection.class));
assertEquals(ImmutableList.of(), ArbitraryInstances.get(List.class));
assertEquals(ImmutableList.of(), ArbitraryInstances.get(ImmutableList.class));
assertEquals(ImmutableMap.of(), ArbitraryInstances.get(Map.class));
assertEquals(ImmutableMap.of(), ArbitraryInstances.get(ImmutableMap.class));
assertEquals(ImmutableSortedMap.of(), ArbitraryInstances.get(SortedMap.class));
assertEquals(ImmutableSortedMap.of(), ArbitraryInstances.get(ImmutableSortedMap.class));
assertEquals(ImmutableMultiset.of(), ArbitraryInstances.get(Multiset.class));
assertEquals(ImmutableMultiset.of(), ArbitraryInstances.get(ImmutableMultiset.class));
assertTrue(ArbitraryInstances.get(SortedMultiset.class).isEmpty());
assertEquals(ImmutableMultimap.of(), ArbitraryInstances.get(Multimap.class));
assertEquals(ImmutableMultimap.of(), ArbitraryInstances.get(ImmutableMultimap.class));
assertTrue(ArbitraryInstances.get(SortedSetMultimap.class).isEmpty());
assertEquals(ImmutableTable.of(), ArbitraryInstances.get(Table.class));
assertEquals(ImmutableTable.of(), ArbitraryInstances.get(ImmutableTable.class));
assertTrue(ArbitraryInstances.get(RowSortedTable.class).isEmpty());
assertEquals(ImmutableBiMap.of(), ArbitraryInstances.get(BiMap.class));
assertEquals(ImmutableBiMap.of(), ArbitraryInstances.get(ImmutableBiMap.class));
assertTrue(ArbitraryInstances.get(ImmutableClassToInstanceMap.class).isEmpty());
assertTrue(ArbitraryInstances.get(ClassToInstanceMap.class).isEmpty());
assertTrue(ArbitraryInstances.get(ListMultimap.class).isEmpty());
assertTrue(ArbitraryInstances.get(ImmutableListMultimap.class).isEmpty());
assertTrue(ArbitraryInstances.get(SetMultimap.class).isEmpty());
assertTrue(ArbitraryInstances.get(ImmutableSetMultimap.class).isEmpty());
assertTrue(ArbitraryInstances.get(MapDifference.class).areEqual());
assertTrue(ArbitraryInstances.get(SortedMapDifference.class).areEqual());
assertEquals(Range.all(), ArbitraryInstances.get(Range.class));
assertTrue(ArbitraryInstances.get(NavigableSet.class).isEmpty());
assertTrue(ArbitraryInstances.get(NavigableMap.class).isEmpty());
assertTrue(ArbitraryInstances.get(LinkedList.class).isEmpty());
assertTrue(ArbitraryInstances.get(Deque.class).isEmpty());
assertTrue(ArbitraryInstances.get(Queue.class).isEmpty());
assertTrue(ArbitraryInstances.get(PriorityQueue.class).isEmpty());
assertTrue(ArbitraryInstances.get(BitSet.class).isEmpty());
assertTrue(ArbitraryInstances.get(TreeSet.class).isEmpty());
assertTrue(ArbitraryInstances.get(TreeMap.class).isEmpty());
assertFreshInstanceReturned(
LinkedList.class,
Deque.class,
Queue.class,
PriorityQueue.class,
BitSet.class,
TreeSet.class,
TreeMap.class);
}
public void testGet_misc() {
assertThat(ArbitraryInstances.get(CharMatcher.class)).isNotNull();
assertThat(ArbitraryInstances.get(Currency.class).getCurrencyCode()).isNotNull();
assertThat(ArbitraryInstances.get(Locale.class)).isNotNull();
assertThat(ArbitraryInstances.get(Joiner.class).join(ImmutableList.of("a"))).isNotNull();
assertThat(ArbitraryInstances.get(Splitter.class).split("a,b")).isNotNull();
assertThat(ArbitraryInstances.get(com.google.common.base.Optional.class)).isAbsent();
ArbitraryInstances.get(Stopwatch.class).start();
assertThat(ArbitraryInstances.get(Ticker.class)).isNotNull();
assertFreshInstanceReturned(Random.class);
assertEquals(
ArbitraryInstances.get(Random.class).nextInt(),
ArbitraryInstances.get(Random.class).nextInt());
}
public void testGet_concurrent() {
assertTrue(ArbitraryInstances.get(BlockingDeque.class).isEmpty());
assertTrue(ArbitraryInstances.get(BlockingQueue.class).isEmpty());
assertTrue(ArbitraryInstances.get(DelayQueue.class).isEmpty());
assertTrue(ArbitraryInstances.get(SynchronousQueue.class).isEmpty());
assertTrue(ArbitraryInstances.get(PriorityBlockingQueue.class).isEmpty());
assertTrue(ArbitraryInstances.get(ConcurrentMap.class).isEmpty());
assertTrue(ArbitraryInstances.get(ConcurrentNavigableMap.class).isEmpty());
ArbitraryInstances.get(Executor.class).execute(ArbitraryInstances.get(Runnable.class));
assertThat(ArbitraryInstances.get(ThreadFactory.class)).isNotNull();
assertFreshInstanceReturned(
BlockingQueue.class,
BlockingDeque.class,
PriorityBlockingQueue.class,
DelayQueue.class,
SynchronousQueue.class,
ConcurrentMap.class,
ConcurrentNavigableMap.class,
AtomicReference.class,
AtomicBoolean.class,
AtomicInteger.class,
AtomicLong.class,
AtomicDouble.class);
}
@SuppressWarnings("unchecked") // functor classes have no type parameters
public void testGet_functors() {
assertEquals(0, ArbitraryInstances.get(Comparator.class).compare("abc", 123));
assertTrue(ArbitraryInstances.get(Predicate.class).apply("abc"));
assertTrue(ArbitraryInstances.get(Equivalence.class).equivalent(1, 1));
assertFalse(ArbitraryInstances.get(Equivalence.class).equivalent(1, 2));
}
@SuppressWarnings("SelfComparison")
public void testGet_comparable() {
@SuppressWarnings("unchecked") // The null value can compare with any Object
Comparable<Object> comparable = ArbitraryInstances.get(Comparable.class);
assertEquals(0, comparable.compareTo(comparable));
assertThat(comparable.compareTo("")).isGreaterThan(0);
assertThrows(NullPointerException.class, () -> comparable.compareTo(null));
}
public void testGet_array() {
assertThat(ArbitraryInstances.get(int[].class)).isEmpty();
assertThat(ArbitraryInstances.get(Object[].class)).isEmpty();
assertThat(ArbitraryInstances.get(String[].class)).isEmpty();
}
public void testGet_enum() {
assertThat(ArbitraryInstances.get(EmptyEnum.class)).isNull();
assertEquals(Direction.UP, ArbitraryInstances.get(Direction.class));
}
public void testGet_interface() {
assertThat(ArbitraryInstances.get(SomeInterface.class)).isNull();
}
public void testGet_runnable() {
ArbitraryInstances.get(Runnable.class).run();
}
public void testGet_class() {
assertSame(SomeAbstractClass.INSTANCE, ArbitraryInstances.get(SomeAbstractClass.class));
assertSame(
WithPrivateConstructor.INSTANCE, ArbitraryInstances.get(WithPrivateConstructor.class));
assertThat(ArbitraryInstances.get(NoDefaultConstructor.class)).isNull();
assertSame(
WithExceptionalConstructor.INSTANCE,
ArbitraryInstances.get(WithExceptionalConstructor.class));
assertThat(ArbitraryInstances.get(NonPublicClass.class)).isNull();
}
public void testGet_mutable() {
assertEquals(0, ArbitraryInstances.get(ArrayList.class).size());
assertEquals(0, ArbitraryInstances.get(HashMap.class).size());
assertThat(ArbitraryInstances.get(Appendable.class).toString()).isEmpty();
assertThat(ArbitraryInstances.get(StringBuilder.class).toString()).isEmpty();
assertThat(ArbitraryInstances.get(StringBuffer.class).toString()).isEmpty();
assertFreshInstanceReturned(
ArrayList.class,
HashMap.class,
Appendable.class,
StringBuilder.class,
StringBuffer.class,
Throwable.class,
Exception.class);
}
public void testGet_io() throws IOException {
assertEquals(-1, ArbitraryInstances.get(InputStream.class).read());
assertEquals(-1, ArbitraryInstances.get(ByteArrayInputStream.class).read());
assertEquals(-1, ArbitraryInstances.get(Readable.class).read(CharBuffer.allocate(1)));
assertEquals(-1, ArbitraryInstances.get(Reader.class).read());
assertEquals(-1, ArbitraryInstances.get(StringReader.class).read());
assertEquals(0, ArbitraryInstances.get(Buffer.class).capacity());
assertEquals(0, ArbitraryInstances.get(CharBuffer.class).capacity());
assertEquals(0, ArbitraryInstances.get(ByteBuffer.class).capacity());
assertEquals(0, ArbitraryInstances.get(ShortBuffer.class).capacity());
assertEquals(0, ArbitraryInstances.get(IntBuffer.class).capacity());
assertEquals(0, ArbitraryInstances.get(LongBuffer.class).capacity());
assertEquals(0, ArbitraryInstances.get(FloatBuffer.class).capacity());
assertEquals(0, ArbitraryInstances.get(DoubleBuffer.class).capacity());
ArbitraryInstances.get(PrintStream.class).println("test");
ArbitraryInstances.get(PrintWriter.class).println("test");
assertThat(ArbitraryInstances.get(File.class)).isNotNull();
assertFreshInstanceReturned(
ByteArrayOutputStream.class, OutputStream.class,
Writer.class, StringWriter.class,
PrintStream.class, PrintWriter.class);
assertEquals(ByteSource.empty(), ArbitraryInstances.get(ByteSource.class));
assertEquals(CharSource.empty(), ArbitraryInstances.get(CharSource.class));
assertThat(ArbitraryInstances.get(ByteSink.class)).isNotNull();
assertThat(ArbitraryInstances.get(CharSink.class)).isNotNull();
}
public void testGet_reflect() {
assertThat(ArbitraryInstances.get(Type.class)).isNotNull();
assertThat(ArbitraryInstances.get(AnnotatedElement.class)).isNotNull();
assertThat(ArbitraryInstances.get(GenericDeclaration.class)).isNotNull();
}
public void testGet_regex() {
assertEquals(Pattern.compile("").pattern(), ArbitraryInstances.get(Pattern.class).pattern());
assertEquals(0, ArbitraryInstances.get(MatchResult.class).groupCount());
}
public void testGet_usePublicConstant() {
assertSame(WithPublicConstant.INSTANCE, ArbitraryInstances.get(WithPublicConstant.class));
}
public void testGet_useFirstPublicConstant() {
assertSame(WithPublicConstants.FIRST, ArbitraryInstances.get(WithPublicConstants.class));
}
public void testGet_nullConstantIgnored() {
assertSame(FirstConstantIsNull.SECOND, ArbitraryInstances.get(FirstConstantIsNull.class));
}
public void testGet_constantWithGenericsNotUsed() {
assertThat(ArbitraryInstances.get(WithGenericConstant.class)).isNull();
}
public void testGet_nullConstant() {
assertThat(ArbitraryInstances.get(WithNullConstant.class)).isNull();
}
public void testGet_constantTypeDoesNotMatch() {
assertThat(ArbitraryInstances.get(ParentClassHasConstant.class)).isNull();
}
public void testGet_nonPublicConstantNotUsed() {
assertThat(ArbitraryInstances.get(NonPublicConstantIgnored.class)).isNull();
}
public void testGet_nonStaticFieldNotUsed() {
assertThat(ArbitraryInstances.get(NonStaticFieldIgnored.class)).isNull();
}
public void testGet_constructorPreferredOverConstants() {
assertThat(ArbitraryInstances.get(WithPublicConstructorAndConstant.class)).isNotNull();
assertTrue(
ArbitraryInstances.get(WithPublicConstructorAndConstant.class)
!= ArbitraryInstances.get(WithPublicConstructorAndConstant.class));
}
public void testGet_nonFinalFieldNotUsed() {
assertThat(ArbitraryInstances.get(NonFinalFieldIgnored.class)).isNull();
}
private static void assertFreshInstanceReturned(Class<?>... mutableClasses) {
for (Class<?> mutableClass : mutableClasses) {
Object instance = ArbitraryInstances.get(mutableClass);
assertWithMessage("Expected to return non-null for: " + mutableClass)
.that(instance)
.isNotNull();
assertNotSame(
"Expected to return fresh instance for: " + mutableClass,
instance,
ArbitraryInstances.get(mutableClass));
}
}
private
|
ArbitraryInstancesTest
|
java
|
quarkusio__quarkus
|
test-framework/common/src/main/java/io/quarkus/test/util/annotations/AnnotationUtils.java
|
{
"start": 1118,
"end": 3720
}
|
class ____
* finding an annotation that is <em>indirectly present</em> on the class
* (meaning that the same process will be repeated for superclasses if {@link Inherited} is present on
* {@code annotationType}).
*
* @param <A> the annotation type
* @param element the element on which to search for the annotation; may be
* {@code null}
* @param annotationType the annotation type to search for; never {@code null}
* @return an {@code Optional} containing the annotation and the element on which it was present; never {@code null} but
* potentially empty
*/
public static <A extends Annotation> Optional<AnnotationContainer<A>> findAnnotation(AnnotatedElement element,
Class<A> annotationType) {
Preconditions.notNull(annotationType, "annotationType must not be null");
boolean inherited = annotationType.isAnnotationPresent(Inherited.class);
return findAnnotation(element, annotationType, inherited, new HashSet<>());
}
private static <A extends Annotation> Optional<AnnotationContainer<A>> findAnnotation(AnnotatedElement element,
Class<A> annotationType,
boolean inherited, Set<Annotation> visited) {
Preconditions.notNull(annotationType, "annotationType must not be null");
if (element == null) {
return Optional.empty();
}
// Directly present?
A annotation = element.getDeclaredAnnotation(annotationType);
if (annotation != null) {
return Optional.of(new AnnotationContainer<>(element, annotation));
}
// Meta-present on directly present annotations?
Optional<AnnotationContainer<A>> directMetaAnnotation = findMetaAnnotation(annotationType,
element.getDeclaredAnnotations(),
inherited, visited);
if (directMetaAnnotation.isPresent()) {
return directMetaAnnotation;
}
if (element instanceof Class) {
Class<?> clazz = (Class<?>) element;
// Search on interfaces
for (Class<?> ifc : clazz.getInterfaces()) {
if (ifc != Annotation.class) {
Optional<AnnotationContainer<A>> annotationOnInterface = findAnnotation(ifc, annotationType, inherited,
visited);
if (annotationOnInterface.isPresent()) {
return annotationOnInterface;
}
}
}
// Indirectly present?
// Search in
|
before
|
java
|
ReactiveX__RxJava
|
src/main/java/io/reactivex/rxjava3/core/Completable.java
|
{
"start": 1529,
"end": 1898
}
|
class ____ a deferred computation without any value but
* only indication for completion or exception.
* <p>
* {@code Completable} behaves similarly to {@link Observable} except that it can only emit either
* a completion or error signal (there is no {@code onNext} or {@code onSuccess} as with the other
* reactive types).
* <p>
* The {@code Completable}
|
represents
|
java
|
spring-projects__spring-framework
|
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/condition/RequestMethodsRequestConditionTests.java
|
{
"start": 1587,
"end": 5611
}
|
class ____ {
@Test
void getMatchingCondition() {
testMatch(new RequestMethodsRequestCondition(GET), GET);
testMatch(new RequestMethodsRequestCondition(GET, POST), GET);
testNoMatch(new RequestMethodsRequestCondition(GET), POST);
}
@Test
void getMatchingConditionWithHttpHead() {
testMatch(new RequestMethodsRequestCondition(HEAD), HEAD);
testMatch(new RequestMethodsRequestCondition(GET), GET);
testNoMatch(new RequestMethodsRequestCondition(POST), HEAD);
}
@Test
void getMatchingConditionWithEmptyConditions() {
RequestMethodsRequestCondition condition = new RequestMethodsRequestCondition();
for (RequestMethod method : RequestMethod.values()) {
if (method != OPTIONS) {
HttpServletRequest request = new MockHttpServletRequest(method.name(), "");
assertThat(condition.getMatchingCondition(request)).isNotNull();
}
}
testNoMatch(condition, OPTIONS);
}
@Test
void getMatchingConditionWithCustomMethod() {
HttpServletRequest request = new MockHttpServletRequest("PROPFIND", "");
assertThat(new RequestMethodsRequestCondition().getMatchingCondition(request)).isNotNull();
assertThat(new RequestMethodsRequestCondition(GET, POST).getMatchingCondition(request)).isNull();
}
@Test
void getMatchingConditionWithCorsPreFlight() {
MockHttpServletRequest request = new MockHttpServletRequest("OPTIONS", "");
request.addHeader("Origin", "https://example.com");
request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "PUT");
assertThat(new RequestMethodsRequestCondition().getMatchingCondition(request)).isNotNull();
assertThat(new RequestMethodsRequestCondition(PUT).getMatchingCondition(request)).isNotNull();
assertThat(new RequestMethodsRequestCondition(DELETE).getMatchingCondition(request)).isNull();
}
@Test // SPR-14410
public void getMatchingConditionWithHttpOptionsInErrorDispatch() {
MockHttpServletRequest request = new MockHttpServletRequest("OPTIONS", "/path");
request.setDispatcherType(DispatcherType.ERROR);
RequestMethodsRequestCondition condition = new RequestMethodsRequestCondition();
RequestMethodsRequestCondition result = condition.getMatchingCondition(request);
assertThat(result).isNotNull();
assertThat(result).isSameAs(condition);
}
@Test
void compareTo() {
RequestMethodsRequestCondition c1 = new RequestMethodsRequestCondition(GET, HEAD);
RequestMethodsRequestCondition c2 = new RequestMethodsRequestCondition(POST);
RequestMethodsRequestCondition c3 = new RequestMethodsRequestCondition();
MockHttpServletRequest request = new MockHttpServletRequest();
int result = c1.compareTo(c2, request);
assertThat(result).as("Invalid comparison result: " + result).isLessThan(0);
result = c2.compareTo(c1, request);
assertThat(result).as("Invalid comparison result: " + result).isGreaterThan(0);
result = c2.compareTo(c3, request);
assertThat(result).as("Invalid comparison result: " + result).isLessThan(0);
result = c1.compareTo(c1, request);
assertThat(result).as("Invalid comparison result ").isEqualTo(0);
}
@Test
void combine() {
RequestMethodsRequestCondition condition1 = new RequestMethodsRequestCondition(GET);
RequestMethodsRequestCondition condition2 = new RequestMethodsRequestCondition(POST);
RequestMethodsRequestCondition result = condition1.combine(condition2);
assertThat(result.getContent()).hasSize(2);
}
private void testMatch(RequestMethodsRequestCondition condition, RequestMethod method) {
MockHttpServletRequest request = new MockHttpServletRequest(method.name(), "");
RequestMethodsRequestCondition actual = condition.getMatchingCondition(request);
assertThat(actual).isNotNull();
assertThat(actual.getContent()).isEqualTo(Collections.singleton(method));
}
private void testNoMatch(RequestMethodsRequestCondition condition, RequestMethod method) {
MockHttpServletRequest request = new MockHttpServletRequest(method.name(), "");
assertThat(condition.getMatchingCondition(request)).isNull();
}
}
|
RequestMethodsRequestConditionTests
|
java
|
elastic__elasticsearch
|
test/framework/src/main/java/org/elasticsearch/test/NettyGlobalThreadsFilter.java
|
{
"start": 821,
"end": 1000
}
|
class ____ implements ThreadFilter {
@Override
public boolean reject(Thread t) {
return t.getName().startsWith("globalEventExecutor");
}
}
|
NettyGlobalThreadsFilter
|
java
|
apache__camel
|
dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KameletEndpointBuilderFactory.java
|
{
"start": 10523,
"end": 10879
}
|
interface ____
extends
EndpointProducerBuilder {
default AdvancedKameletEndpointProducerBuilder advanced() {
return (AdvancedKameletEndpointProducerBuilder) this;
}
}
/**
* Advanced builder for endpoint producers for the Kamelet component.
*/
public
|
KameletEndpointProducerBuilder
|
java
|
google__error-prone
|
core/src/test/java/com/google/errorprone/bugpatterns/nullness/ReturnMissingNullableTest.java
|
{
"start": 9876,
"end": 10438
}
|
class ____ {
final Object nullObject = null;
Object get() {
// BUG: Diagnostic contains: @Nullable
return nullObject;
}
}
""")
.doTest();
}
@Test
public void memberSelectFinalField() {
createCompilationTestHelper()
.addSourceLines(
"com/google/errorprone/bugpatterns/nullness/LiteralNullReturnTest.java",
"""
package com.google.errorprone.bugpatterns.nullness;
abstract
|
LiteralNullReturnTest
|
java
|
mybatis__mybatis-3
|
src/main/java/org/apache/ibatis/binding/MapperProxyFactory.java
|
{
"start": 904,
"end": 1742
}
|
class ____<T> {
private final Class<T> mapperInterface;
private final Map<Method, MapperMethodInvoker> methodCache = new ConcurrentHashMap<>();
public MapperProxyFactory(Class<T> mapperInterface) {
this.mapperInterface = mapperInterface;
}
public Class<T> getMapperInterface() {
return mapperInterface;
}
public Map<Method, MapperMethodInvoker> getMethodCache() {
return methodCache;
}
@SuppressWarnings("unchecked")
protected T newInstance(MapperProxy<T> mapperProxy) {
return (T) Proxy.newProxyInstance(mapperInterface.getClassLoader(), new Class[] { mapperInterface }, mapperProxy);
}
public T newInstance(SqlSession sqlSession) {
final MapperProxy<T> mapperProxy = new MapperProxy<>(sqlSession, mapperInterface, methodCache);
return newInstance(mapperProxy);
}
}
|
MapperProxyFactory
|
java
|
playframework__playframework
|
web/play-java-forms/src/main/java/play/data/validation/Constraints.java
|
{
"start": 933,
"end": 1578
}
|
class ____<T> {
/**
* @param object the value to test.
* @return {@code true} if this value is valid.
*/
public abstract boolean isValid(T object);
/**
* @param object the object to check
* @param constraintContext The JSR-303 validation context.
* @return {@code true} if this value is valid for the given constraint.
*/
public boolean isValid(T object, ConstraintValidatorContext constraintContext) {
return isValid(object);
}
public abstract Tuple<String, Object[]> getErrorMessageKey();
}
/** Super-type for validators with a payload. */
public abstract static
|
Validator
|
java
|
apache__maven
|
its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2690MojoLoadingErrorsTest.java
|
{
"start": 2248,
"end": 2488
}
|
class ____ missing.*");
assertTrue(msg >= 0, "User-friendly message was not found in output.");
int cls = lines.get(msg).toString().replace('/', '.').indexOf("junit.framework.TestCase");
assertTrue(cls >= 0, "Missing
|
is
|
java
|
micronaut-projects__micronaut-core
|
http-client-core/src/main/java/io/micronaut/http/client/ProxyHttpClientFactoryResolver.java
|
{
"start": 878,
"end": 1673
}
|
class ____ {
private static volatile ProxyHttpClientFactory factory;
static ProxyHttpClientFactory getFactory() {
if (factory == null) {
synchronized (ProxyHttpClientFactoryResolver.class) { // double check
if (factory == null) {
factory = resolveClientFactory();
}
}
}
return factory;
}
private static ProxyHttpClientFactory resolveClientFactory() {
final Iterator<ProxyHttpClientFactory> i = ServiceLoader.load(ProxyHttpClientFactory.class).iterator();
if (i.hasNext()) {
return i.next();
}
throw new IllegalStateException("No ProxyHttpClientFactory present on classpath, cannot create client");
}
}
|
ProxyHttpClientFactoryResolver
|
java
|
apache__camel
|
components/camel-http/src/test/java/org/apache/camel/component/http/HttpCamelHeadersNotCopiedTest.java
|
{
"start": 1137,
"end": 1900
}
|
class ____ extends HttpCamelHeadersTest {
@Override
protected void assertHeaders(Map<String, Object> headers) {
assertEquals(HttpStatus.SC_OK, headers.get(Exchange.HTTP_RESPONSE_CODE), "Should return " + HttpStatus.SC_OK);
assertEquals("12", headers.get("Content-Length"), "Should return mocked 12 CL");
assertNotNull(headers.get("Content-Type"), "Should have any Content-Type header propagated");
assertNull(headers.get("TestHeader"), "Should not copy TestHeader from in to out");
assertNull(headers.get("Accept-Language"), "Should not copy Accept-Language from in to out");
}
@Override
protected String setupEndpointParams() {
return "?copyHeaders=false";
}
}
|
HttpCamelHeadersNotCopiedTest
|
java
|
elastic__elasticsearch
|
test/framework/src/main/java/org/elasticsearch/index/engine/EngineTestCase.java
|
{
"start": 28965,
"end": 67807
}
|
interface ____ {
IndexWriter createWriter(Directory directory, IndexWriterConfig iwc) throws IOException;
}
/**
* Generate a new sequence number and return it. Only works on InternalEngines
*/
public static long generateNewSeqNo(final Engine engine) {
assert engine instanceof InternalEngine : "expected InternalEngine, got: " + engine.getClass();
InternalEngine internalEngine = (InternalEngine) engine;
return internalEngine.getLocalCheckpointTracker().generateSeqNo();
}
public static InternalEngine createInternalEngine(
@Nullable final IndexWriterFactory indexWriterFactory,
@Nullable final BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier,
@Nullable final ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation,
final EngineConfig config
) {
if (localCheckpointTrackerSupplier == null) {
return new InternalTestEngine(config) {
@Override
protected IndexWriter createWriter(Directory directory, IndexWriterConfig iwc) throws IOException {
return (indexWriterFactory != null)
? indexWriterFactory.createWriter(directory, iwc)
: super.createWriter(directory, iwc);
}
@Override
protected long doGenerateSeqNoForOperation(final Operation operation) {
return seqNoForOperation != null
? seqNoForOperation.applyAsLong(this, operation)
: super.doGenerateSeqNoForOperation(operation);
}
};
} else {
return new InternalTestEngine(config, IndexWriter.MAX_DOCS, localCheckpointTrackerSupplier) {
@Override
protected IndexWriter createWriter(Directory directory, IndexWriterConfig iwc) throws IOException {
return (indexWriterFactory != null)
? indexWriterFactory.createWriter(directory, iwc)
: super.createWriter(directory, iwc);
}
@Override
protected long doGenerateSeqNoForOperation(final Operation operation) {
return seqNoForOperation != null
? seqNoForOperation.applyAsLong(this, operation)
: super.doGenerateSeqNoForOperation(operation);
}
};
}
}
public EngineConfig config(
IndexSettings indexSettings,
Store store,
Path translogPath,
MergePolicy mergePolicy,
ReferenceManager.RefreshListener refreshListener
) {
return config(indexSettings, store, translogPath, mergePolicy, refreshListener, null, () -> SequenceNumbers.NO_OPS_PERFORMED);
}
public EngineConfig config(
IndexSettings indexSettings,
Store store,
Path translogPath,
MergePolicy mergePolicy,
ReferenceManager.RefreshListener refreshListener,
Sort indexSort,
LongSupplier globalCheckpointSupplier
) {
return config(
indexSettings,
store,
translogPath,
mergePolicy,
refreshListener,
indexSort,
globalCheckpointSupplier,
globalCheckpointSupplier == null ? null : () -> RetentionLeases.EMPTY
);
}
public EngineConfig config(
final IndexSettings indexSettings,
final Store store,
final Path translogPath,
final MergePolicy mergePolicy,
final ReferenceManager.RefreshListener refreshListener,
final Sort indexSort,
final LongSupplier globalCheckpointSupplier,
final Supplier<RetentionLeases> retentionLeasesSupplier
) {
return config(
indexSettings,
store,
translogPath,
mergePolicy,
refreshListener,
null,
indexSort,
globalCheckpointSupplier,
retentionLeasesSupplier,
new NoneCircuitBreakerService(),
null,
Function.identity()
);
}
public EngineConfig config(
IndexSettings indexSettings,
Store store,
Path translogPath,
MergePolicy mergePolicy,
ReferenceManager.RefreshListener externalRefreshListener,
ReferenceManager.RefreshListener internalRefreshListener,
Sort indexSort,
@Nullable LongSupplier maybeGlobalCheckpointSupplier,
CircuitBreakerService breakerService
) {
return config(
indexSettings,
store,
translogPath,
mergePolicy,
externalRefreshListener,
internalRefreshListener,
indexSort,
maybeGlobalCheckpointSupplier,
maybeGlobalCheckpointSupplier == null ? null : () -> RetentionLeases.EMPTY,
breakerService,
null,
Function.identity()
);
}
public EngineConfig config(
final IndexSettings indexSettings,
final Store store,
final Path translogPath,
final MergePolicy mergePolicy,
final ReferenceManager.RefreshListener externalRefreshListener,
final ReferenceManager.RefreshListener internalRefreshListener,
final Sort indexSort,
final @Nullable LongSupplier maybeGlobalCheckpointSupplier,
final @Nullable Supplier<RetentionLeases> maybeRetentionLeasesSupplier,
final CircuitBreakerService breakerService,
final @Nullable Engine.IndexCommitListener indexCommitListener,
final @Nullable Function<ElasticsearchIndexDeletionPolicy, ElasticsearchIndexDeletionPolicy> indexDeletionPolicyWrapper
) {
final IndexWriterConfig iwc = newIndexWriterConfig();
final TranslogConfig translogConfig = new TranslogConfig(shardId, translogPath, indexSettings, BigArrays.NON_RECYCLING_INSTANCE);
final Engine.EventListener eventListener = new Engine.EventListener() {
}; // we don't need to notify anybody in this test
final List<ReferenceManager.RefreshListener> extRefreshListenerList = externalRefreshListener == null
? emptyList()
: Collections.singletonList(externalRefreshListener);
final List<ReferenceManager.RefreshListener> intRefreshListenerList = internalRefreshListener == null
? emptyList()
: Collections.singletonList(internalRefreshListener);
final LongSupplier globalCheckpointSupplier;
final Supplier<RetentionLeases> retentionLeasesSupplier;
if (maybeGlobalCheckpointSupplier == null) {
assert maybeRetentionLeasesSupplier == null;
final ReplicationTracker replicationTracker = new ReplicationTracker(
shardId,
allocationId.getId(),
indexSettings,
randomNonNegativeLong(),
SequenceNumbers.NO_OPS_PERFORMED,
update -> {},
() -> 0L,
(leases, listener) -> listener.onResponse(new ReplicationResponse()),
() -> SafeCommitInfo.EMPTY
);
globalCheckpointSupplier = replicationTracker;
retentionLeasesSupplier = replicationTracker::getRetentionLeases;
} else {
assert maybeRetentionLeasesSupplier != null;
globalCheckpointSupplier = maybeGlobalCheckpointSupplier;
retentionLeasesSupplier = maybeRetentionLeasesSupplier;
}
return new EngineConfig(
shardId,
threadPool,
threadPoolMergeExecutorService,
indexSettings,
null,
store,
mergePolicy,
iwc.getAnalyzer(),
iwc.getSimilarity(),
newCodecService(),
eventListener,
IndexSearcher.getDefaultQueryCache(),
IndexSearcher.getDefaultQueryCachingPolicy(),
translogConfig,
TimeValue.timeValueMinutes(5),
extRefreshListenerList,
intRefreshListenerList,
indexSort,
breakerService,
globalCheckpointSupplier,
retentionLeasesSupplier,
primaryTerm,
IndexModule.DEFAULT_SNAPSHOT_COMMIT_SUPPLIER,
null,
this::relativeTimeInNanos,
indexCommitListener,
true,
mapperService,
new EngineResetLock(),
mergeMetrics,
indexDeletionPolicyWrapper == null ? Function.identity() : indexDeletionPolicyWrapper
);
}
protected EngineConfig config(EngineConfig config, Store store, Path translogPath) {
IndexSettings indexSettings = IndexSettingsModule.newIndexSettings(
"test",
Settings.builder()
.put(config.getIndexSettings().getSettings())
.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)
.build()
);
TranslogConfig translogConfig = new TranslogConfig(shardId, translogPath, indexSettings, BigArrays.NON_RECYCLING_INSTANCE);
return new EngineConfig(
config.getShardId(),
config.getThreadPool(),
config.getThreadPoolMergeExecutorService(),
indexSettings,
config.getWarmer(),
store,
config.getMergePolicy(),
config.getAnalyzer(),
config.getSimilarity(),
newCodecService(),
config.getEventListener(),
config.getQueryCache(),
config.getQueryCachingPolicy(),
translogConfig,
config.getFlushMergesAfter(),
config.getExternalRefreshListener(),
config.getInternalRefreshListener(),
config.getIndexSort(),
config.getCircuitBreakerService(),
config.getGlobalCheckpointSupplier(),
config.retentionLeasesSupplier(),
config.getPrimaryTermSupplier(),
config.getSnapshotCommitSupplier(),
config.getLeafSorter(),
config.getRelativeTimeInNanosSupplier(),
config.getIndexCommitListener(),
config.isPromotableToPrimary(),
config.getMapperService(),
config.getEngineResetLock(),
config.getMergeMetrics(),
config.getIndexDeletionPolicyWrapper()
);
}
protected EngineConfig noOpConfig(IndexSettings indexSettings, Store store, Path translogPath) {
return noOpConfig(indexSettings, store, translogPath, null);
}
protected EngineConfig noOpConfig(IndexSettings indexSettings, Store store, Path translogPath, LongSupplier globalCheckpointSupplier) {
return config(indexSettings, store, translogPath, newMergePolicy(), null, null, globalCheckpointSupplier);
}
protected static final BytesReference B_1 = new BytesArray(new byte[] { 1 });
protected static final BytesReference B_2 = new BytesArray(new byte[] { 2 });
protected static final BytesReference B_3 = new BytesArray(new byte[] { 3 });
protected static final BytesArray SOURCE = bytesArray("{}");
protected static BytesArray bytesArray(String string) {
return new BytesArray(string.getBytes(Charset.defaultCharset()));
}
public static BytesRef newUid(ParsedDocument doc) {
return Uid.encodeId(doc.id());
}
protected Engine.Get newGet(boolean realtime, ParsedDocument doc) {
return new Engine.Get(realtime, realtime, doc.id());
}
protected Engine.Index indexForDoc(ParsedDocument doc) {
return new Engine.Index(newUid(doc), primaryTerm.get(), doc);
}
protected Engine.Index replicaIndexForDoc(ParsedDocument doc, long version, long seqNo, boolean isRetry) {
return new Engine.Index(
newUid(doc),
doc,
seqNo,
primaryTerm.get(),
version,
null,
Engine.Operation.Origin.REPLICA,
System.nanoTime(),
IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP,
isRetry,
SequenceNumbers.UNASSIGNED_SEQ_NO,
0
);
}
protected Engine.Delete replicaDeleteForDoc(String id, long version, long seqNo, long startTime) {
return new Engine.Delete(
id,
Uid.encodeId(id),
seqNo,
1,
version,
null,
Engine.Operation.Origin.REPLICA,
startTime,
SequenceNumbers.UNASSIGNED_SEQ_NO,
0
);
}
protected static void assertVisibleCount(InternalEngine engine, int numDocs) throws IOException {
assertVisibleCount(engine, numDocs, true);
}
protected static void assertVisibleCount(InternalEngine engine, int numDocs, boolean refresh) throws IOException {
if (refresh) {
engine.refresh("test");
}
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
Integer totalHits = searcher.search(new MatchAllDocsQuery(), new TotalHitCountCollectorManager(searcher.getSlices()));
assertThat(totalHits, equalTo(numDocs));
}
}
public static List<Engine.Operation> generateSingleDocHistory(
boolean forReplica,
VersionType versionType,
long primaryTerm,
int minOpCount,
int maxOpCount,
String docId
) {
final int numOfOps = randomIntBetween(minOpCount, maxOpCount);
final List<Engine.Operation> ops = new ArrayList<>();
final BytesRef id = Uid.encodeId(docId);
final int startWithSeqNo = 0;
final String valuePrefix = (forReplica ? "r_" : "p_") + docId + "_";
final boolean incrementTermWhenIntroducingSeqNo = randomBoolean();
for (int i = 0; i < numOfOps; i++) {
final Engine.Operation op;
final long version = switch (versionType) {
case INTERNAL -> forReplica ? i : Versions.MATCH_ANY;
case EXTERNAL -> i;
case EXTERNAL_GTE -> randomBoolean() ? Math.max(i - 1, 0) : i;
};
if (randomBoolean()) {
op = new Engine.Index(
id,
testParsedDocument(docId, null, testDocumentWithTextField(valuePrefix + i), SOURCE, null, false),
forReplica && i >= startWithSeqNo ? i * 2 : SequenceNumbers.UNASSIGNED_SEQ_NO,
forReplica && i >= startWithSeqNo && incrementTermWhenIntroducingSeqNo ? primaryTerm + 1 : primaryTerm,
version,
forReplica ? null : versionType,
forReplica ? REPLICA : PRIMARY,
System.currentTimeMillis(),
-1,
false,
SequenceNumbers.UNASSIGNED_SEQ_NO,
0
);
} else {
op = new Engine.Delete(
docId,
id,
forReplica && i >= startWithSeqNo ? i * 2 : SequenceNumbers.UNASSIGNED_SEQ_NO,
forReplica && i >= startWithSeqNo && incrementTermWhenIntroducingSeqNo ? primaryTerm + 1 : primaryTerm,
version,
forReplica ? null : versionType,
forReplica ? REPLICA : PRIMARY,
System.currentTimeMillis(),
SequenceNumbers.UNASSIGNED_SEQ_NO,
0
);
}
ops.add(op);
}
return ops;
}
private CheckedBiFunction<String, Integer, ParsedDocument, IOException> nestedParsedDocFactory(MapperService mapperService) {
final DocumentMapper nestedMapper = mapperService.documentMapper();
return (docId, nestedFieldValues) -> {
final XContentBuilder source = XContentFactory.jsonBuilder().startObject().field("value", "test");
if (nestedFieldValues > 0) {
XContentBuilder nestedField = source.startObject("nested_field");
for (int i = 0; i < nestedFieldValues; i++) {
nestedField.field("field-" + i, "value-" + i);
}
source.endObject();
}
source.endObject();
return nestedMapper.parse(new SourceToParse(docId, BytesReference.bytes(source), XContentType.JSON));
};
}
public List<Engine.Operation> generateHistoryOnReplica(
int numOps,
boolean allowGapInSeqNo,
boolean allowDuplicate,
boolean includeNestedDocs
) throws Exception {
return generateHistoryOnReplica(numOps, 0L, allowGapInSeqNo, allowDuplicate, includeNestedDocs);
}
public List<Engine.Operation> generateHistoryOnReplica(
int numOps,
long startingSeqNo,
boolean allowGapInSeqNo,
boolean allowDuplicate,
boolean includeNestedDocs
) throws Exception {
long seqNo = startingSeqNo;
final int maxIdValue = randomInt(numOps * 2);
final List<Engine.Operation> operations = new ArrayList<>(numOps);
CheckedBiFunction<String, Integer, ParsedDocument, IOException> nestedParsedDocFactory = nestedParsedDocFactory(
engine.engineConfig.getMapperService()
);
for (int i = 0; i < numOps; i++) {
final String id = Integer.toString(randomInt(maxIdValue));
final Engine.Operation.TYPE opType = randomFrom(Engine.Operation.TYPE.values());
final boolean isNestedDoc = includeNestedDocs && opType == Engine.Operation.TYPE.INDEX && randomBoolean();
final int nestedValues = between(0, 3);
final long startTime = threadPool.relativeTimeInNanos();
final int copies = allowDuplicate && rarely() ? between(2, 4) : 1;
final var nonNestedDoc = parseDocument(mapperService, id, null);
for (int copy = 0; copy < copies; copy++) {
final ParsedDocument doc = isNestedDoc ? nestedParsedDocFactory.apply(id, nestedValues) : nonNestedDoc;
switch (opType) {
case INDEX -> operations.add(
new Engine.Index(
EngineTestCase.newUid(doc),
doc,
seqNo,
primaryTerm.get(),
i,
null,
randomFrom(REPLICA, PEER_RECOVERY),
startTime,
-1,
true,
SequenceNumbers.UNASSIGNED_SEQ_NO,
0
)
);
case DELETE -> operations.add(
new Engine.Delete(
doc.id(),
EngineTestCase.newUid(doc),
seqNo,
primaryTerm.get(),
i,
null,
randomFrom(REPLICA, PEER_RECOVERY),
startTime,
SequenceNumbers.UNASSIGNED_SEQ_NO,
0
)
);
case NO_OP -> operations.add(
new Engine.NoOp(seqNo, primaryTerm.get(), randomFrom(REPLICA, PEER_RECOVERY), startTime, "test-" + i)
);
default -> throw new IllegalStateException("Unknown operation type [" + opType + "]");
}
}
seqNo++;
if (allowGapInSeqNo && rarely()) {
seqNo++;
}
}
Randomness.shuffle(operations);
return operations;
}
public static void assertOpsOnReplica(
final List<Engine.Operation> ops,
final InternalEngine replicaEngine,
boolean shuffleOps,
final Logger logger
) throws IOException {
final Engine.Operation lastOp = ops.get(ops.size() - 1);
final String lastFieldValue;
if (lastOp instanceof Engine.Index index) {
lastFieldValue = index.docs().get(0).get("value");
} else {
// delete
lastFieldValue = null;
}
if (shuffleOps) {
int firstOpWithSeqNo = 0;
while (firstOpWithSeqNo < ops.size() && ops.get(firstOpWithSeqNo).seqNo() < 0) {
firstOpWithSeqNo++;
}
// shuffle ops but make sure legacy ops are first
shuffle(ops.subList(0, firstOpWithSeqNo), random());
shuffle(ops.subList(firstOpWithSeqNo, ops.size()), random());
}
boolean firstOp = true;
for (Engine.Operation op : ops) {
logger.info(
"performing [{}], v [{}], seq# [{}], term [{}]",
op.operationType().name().charAt(0),
op.version(),
op.seqNo(),
op.primaryTerm()
);
if (op instanceof Engine.Index) {
Engine.IndexResult result = replicaEngine.index((Engine.Index) op);
// Replicas don't really care about the creation status of documents. This allows us to ignore the case where a document was
// found in the live version maps in a delete state and return false for the created flag in favor of code simplicity as
// deleted or not. This check is just to signal a regression so a decision can be made if it's intentional.
assertThat(result.isCreated(), equalTo(firstOp));
assertThat(result.getVersion(), equalTo(op.version()));
assertThat(result.getResultType(), equalTo(Engine.Result.Type.SUCCESS));
} else {
Engine.DeleteResult result = replicaEngine.delete((Engine.Delete) op);
// Replicas don't really care about the "found" status of documents. This allows us to ignore the case where a document was
// found in the live version maps in a delete state and return true for the found flag in favor of code simplicity. This
// check is just to signal a regression so a decision can be made if it's intentional.
assertThat(result.isFound(), equalTo(firstOp == false));
assertThat(result.getVersion(), equalTo(op.version()));
assertThat(result.getResultType(), equalTo(Engine.Result.Type.SUCCESS));
}
if (randomBoolean()) {
replicaEngine.refresh("test");
}
if (randomBoolean()) {
replicaEngine.flush();
replicaEngine.refresh("test");
}
firstOp = false;
}
assertVisibleCount(replicaEngine, lastFieldValue == null ? 0 : 1);
if (lastFieldValue != null) {
try (Engine.Searcher searcher = replicaEngine.acquireSearcher("test")) {
Integer totalHits = searcher.search(
new TermQuery(new Term("value", lastFieldValue)),
new TotalHitCountCollectorManager(searcher.getSlices())
);
assertThat(totalHits, equalTo(1));
}
}
}
public static void concurrentlyApplyOps(List<Engine.Operation> ops, InternalEngine engine) throws InterruptedException {
final int threadCount = randomIntBetween(3, 5);
AtomicInteger offset = new AtomicInteger(-1);
startInParallel(threadCount, i -> {
int docOffset;
while ((docOffset = offset.incrementAndGet()) < ops.size()) {
try {
applyOperation(engine, ops.get(docOffset));
if ((docOffset + 1) % 4 == 0) {
engine.refresh("test");
}
if (rarely()) {
engine.flush();
}
} catch (IOException e) {
throw new AssertionError(e);
}
}
});
}
public static void applyOperations(Engine engine, List<Engine.Operation> operations) throws IOException {
for (Engine.Operation operation : operations) {
applyOperation(engine, operation);
if (randomInt(100) < 10) {
engine.refresh("test");
}
if (rarely()) {
engine.flush();
}
}
}
public static Engine.Result applyOperation(Engine engine, Engine.Operation operation) throws IOException {
final Engine.Result result = switch (operation.operationType()) {
case INDEX -> engine.index((Engine.Index) operation);
case DELETE -> engine.delete((Engine.Delete) operation);
case NO_OP -> engine.noOp((Engine.NoOp) operation);
};
return result;
}
/**
* Gets a collection of tuples of docId, sequence number, and primary term of all live documents in the provided engine.
*/
public static List<DocIdSeqNoAndSource> getDocIds(Engine engine, boolean refresh) throws IOException {
if (refresh) {
engine.refresh("test_get_doc_ids");
}
try (Engine.Searcher searcher = engine.acquireSearcher("test_get_doc_ids", Engine.SearcherScope.INTERNAL)) {
List<DocIdSeqNoAndSource> docs = new ArrayList<>();
for (LeafReaderContext leafContext : searcher.getIndexReader().leaves()) {
LeafReader reader = leafContext.reader();
NumericDocValues seqNoDocValues = reader.getNumericDocValues(SeqNoFieldMapper.NAME);
NumericDocValues primaryTermDocValues = reader.getNumericDocValues(SeqNoFieldMapper.PRIMARY_TERM_NAME);
NumericDocValues versionDocValues = reader.getNumericDocValues(VersionFieldMapper.NAME);
Bits liveDocs = reader.getLiveDocs();
StoredFields storedFields = reader.storedFields();
for (int i = 0; i < reader.maxDoc(); i++) {
if (liveDocs == null || liveDocs.get(i)) {
if (primaryTermDocValues.advanceExact(i) == false) {
// We have to skip non-root docs because its _id field is not stored (indexed only).
continue;
}
final long primaryTerm = primaryTermDocValues.longValue();
Document doc = storedFields.document(i, Set.of(IdFieldMapper.NAME, SourceFieldMapper.NAME));
BytesRef binaryID = doc.getBinaryValue(IdFieldMapper.NAME);
String id = Uid.decodeId(Arrays.copyOfRange(binaryID.bytes, binaryID.offset, binaryID.offset + binaryID.length));
final BytesRef source = doc.getBinaryValue(SourceFieldMapper.NAME);
if (seqNoDocValues.advanceExact(i) == false) {
throw new AssertionError("seqNoDocValues not found for doc[" + i + "] id[" + id + "]");
}
final long seqNo = seqNoDocValues.longValue();
if (versionDocValues.advanceExact(i) == false) {
throw new AssertionError("versionDocValues not found for doc[" + i + "] id[" + id + "]");
}
final long version = versionDocValues.longValue();
docs.add(new DocIdSeqNoAndSource(id, source, seqNo, primaryTerm, version));
}
}
}
docs.sort(
Comparator.comparingLong(DocIdSeqNoAndSource::seqNo)
.thenComparingLong(DocIdSeqNoAndSource::primaryTerm)
.thenComparing((DocIdSeqNoAndSource::id))
);
return docs;
}
}
/**
* Reads all engine operations that have been processed by the engine from Lucene index.
* The returned operations are sorted and de-duplicated, thus each sequence number will be have at most one operation.
*/
public static List<Translog.Operation> readAllOperationsInLucene(Engine engine) throws IOException {
final List<Translog.Operation> operations = new ArrayList<>();
try (
Translog.Snapshot snapshot = engine.newChangesSnapshot(
"test",
0,
Long.MAX_VALUE,
false,
randomBoolean(),
randomBoolean(),
randomLongBetween(1, ByteSizeValue.ofMb(32).getBytes())
)
) {
Translog.Operation op;
while ((op = snapshot.next()) != null) {
operations.add(op);
}
}
return operations;
}
/**
* Asserts the provided engine has a consistent document history between translog and Lucene index.
*/
public static void assertConsistentHistoryBetweenTranslogAndLuceneIndex(Engine engine) throws IOException {
if (engine instanceof InternalEngine == false) {
return;
}
final List<Translog.Operation> translogOps = new ArrayList<>();
try (Translog.Snapshot snapshot = EngineTestCase.getTranslog(engine).newSnapshot()) {
Translog.Operation op;
while ((op = snapshot.next()) != null) {
translogOps.add(op);
}
}
final Map<Long, Translog.Operation> luceneOps = readAllOperationsInLucene(engine).stream()
.collect(Collectors.toMap(Translog.Operation::seqNo, Function.identity()));
final long maxSeqNo = ((InternalEngine) engine).getLocalCheckpointTracker().getMaxSeqNo();
for (Translog.Operation op : translogOps) {
assertThat("translog operation [" + op + "] > max_seq_no[" + maxSeqNo + "]", op.seqNo(), lessThanOrEqualTo(maxSeqNo));
}
for (Translog.Operation op : luceneOps.values()) {
assertThat("lucene operation [" + op + "] > max_seq_no[" + maxSeqNo + "]", op.seqNo(), lessThanOrEqualTo(maxSeqNo));
}
final long globalCheckpoint = EngineTestCase.getTranslog(engine).getLastSyncedGlobalCheckpoint();
final long retainedOps = engine.config().getIndexSettings().getSoftDeleteRetentionOperations();
final long minSeqNoToRetain;
if (engine.config().getIndexSettings().isSoftDeleteEnabled()) {
try (Engine.IndexCommitRef safeCommit = engine.acquireSafeIndexCommit()) {
final long seqNoForRecovery = Long.parseLong(
safeCommit.getIndexCommit().getUserData().get(SequenceNumbers.LOCAL_CHECKPOINT_KEY)
) + 1;
minSeqNoToRetain = Math.min(seqNoForRecovery, globalCheckpoint + 1 - retainedOps);
}
} else {
minSeqNoToRetain = engine.getMinRetainedSeqNo();
}
TranslogOperationAsserter translogOperationAsserter = TranslogOperationAsserter.withEngineConfig(engine.engineConfig);
for (Translog.Operation translogOp : translogOps) {
final Translog.Operation luceneOp = luceneOps.get(translogOp.seqNo());
if (luceneOp == null) {
if (minSeqNoToRetain <= translogOp.seqNo()) {
fail(
"Operation not found seq# ["
+ translogOp.seqNo()
+ "], global checkpoint ["
+ globalCheckpoint
+ "], "
+ "retention policy ["
+ retainedOps
+ "], maxSeqNo ["
+ maxSeqNo
+ "], translog op ["
+ translogOp
+ "]"
);
} else {
continue;
}
}
assertThat(luceneOp, notNullValue());
assertThat(
"primary term does not match, luceneOp=[" + luceneOp + "], translogOp=[" + translogOp + "]",
luceneOp.primaryTerm(),
equalTo(translogOp.primaryTerm())
);
assertThat(luceneOp.opType(), equalTo(translogOp.opType()));
if (luceneOp.opType() == Translog.Operation.Type.INDEX) {
if (engine.engineConfig.getIndexSettings().isRecoverySourceSyntheticEnabled()
|| engine.engineConfig.getMapperService().mappingLookup().inferenceFields().isEmpty() == false
|| engine.engineConfig.getMapperService().mappingLookup().syntheticVectorFields().isEmpty() == false) {
assertTrue(
"luceneOp=" + luceneOp + " != translogOp=" + translogOp,
translogOperationAsserter.assertSameIndexOperation((Translog.Index) luceneOp, (Translog.Index) translogOp)
);
} else {
assertThat(((Translog.Index) luceneOp).source(), equalBytes(((Translog.Index) translogOp).source()));
}
}
}
}
/**
* Asserts that the max_seq_no stored in the commit's user_data is never smaller than seq_no of any document in the commit.
*/
public static void assertMaxSeqNoInCommitUserData(Engine engine) throws Exception {
List<IndexCommit> commits = DirectoryReader.listCommits(engine.store.directory());
for (IndexCommit commit : commits) {
try (DirectoryReader reader = DirectoryReader.open(commit)) {
assertThat(
Long.parseLong(commit.getUserData().get(SequenceNumbers.MAX_SEQ_NO)),
greaterThanOrEqualTo(maxSeqNosInReader(reader))
);
}
}
}
public static void assertAtMostOneLuceneDocumentPerSequenceNumber(Engine engine) throws IOException {
if (engine instanceof InternalEngine) {
try {
engine.refresh("test");
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
assertAtMostOneLuceneDocumentPerSequenceNumber(engine.config().getIndexSettings(), searcher.getDirectoryReader());
}
} catch (AlreadyClosedException ignored) {
// engine was closed
}
}
}
public static void assertAtMostOneLuceneDocumentPerSequenceNumber(IndexSettings indexSettings, DirectoryReader reader)
throws IOException {
Set<Long> seqNos = new HashSet<>();
final DirectoryReader wrappedReader = indexSettings.isSoftDeleteEnabled() ? Lucene.wrapAllDocsLive(reader) : reader;
for (LeafReaderContext leaf : wrappedReader.leaves()) {
NumericDocValues primaryTermDocValues = leaf.reader().getNumericDocValues(SeqNoFieldMapper.PRIMARY_TERM_NAME);
NumericDocValues seqNoDocValues = leaf.reader().getNumericDocValues(SeqNoFieldMapper.NAME);
int docId;
while ((docId = seqNoDocValues.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
assertTrue(seqNoDocValues.advanceExact(docId));
long seqNo = seqNoDocValues.longValue();
assertThat(seqNo, greaterThanOrEqualTo(0L));
if (primaryTermDocValues.advanceExact(docId)) {
if (seqNos.add(seqNo) == false) {
IdStoredFieldLoader idLoader = new IdStoredFieldLoader(leaf.reader());
throw new AssertionError("found multiple documents for seq=" + seqNo + " id=" + idLoader.id(docId));
}
}
}
}
}
public static MapperService createMapperService() throws IOException {
return createMapperService(Settings.EMPTY, "{}", List.of());
}
public static MapperService createMapperService(Settings settings, String mappings) throws IOException {
return createMapperService(settings, mappings, List.of());
}
public static MapperService createMapperService(Settings settings, String mappings, List<MapperPlugin> extraMappers)
throws IOException {
IndexMetadata indexMetadata = IndexMetadata.builder("index")
.settings(indexSettings(1, 1).put(IndexMetadata.SETTING_VERSION_CREATED, IndexVersion.current()).put(settings))
.putMapping(mappings)
.build();
MapperService mapperService = MapperTestUtils.newMapperService(
extraMappers,
new NamedXContentRegistry(ClusterModule.getNamedXWriteables()),
createTempDir(),
indexMetadata.getSettings(),
"index"
);
mapperService.merge(indexMetadata, MapperService.MergeReason.MAPPING_UPDATE);
return mapperService;
}
public static MappingLookup mappingLookup() {
try {
return createMapperService().mappingLookup();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
/**
* Exposes a translog associated with the given engine for testing purpose.
*/
public static Translog getTranslog(Engine engine) {
assert engine instanceof InternalEngine : "only InternalEngines have translogs, got: " + engine.getClass();
InternalEngine internalEngine = (InternalEngine) engine;
return internalEngine.getTranslog();
}
/**
* Waits for all operations up to the provided sequence number to complete in the given internal engine.
*
* @param seqNo the sequence number that the checkpoint must advance to before this method returns
* @throws InterruptedException if the thread was interrupted while blocking on the condition
*/
public static void waitForOpsToComplete(InternalEngine engine, long seqNo) throws Exception {
assertBusy(() -> assertThat(engine.getLocalCheckpointTracker().getProcessedCheckpoint(), greaterThanOrEqualTo(seqNo)));
}
public static boolean hasAcquiredIndexCommitsForTesting(Engine engine) {
assert engine instanceof InternalEngine : "only InternalEngines have snapshotted commits, got: " + engine.getClass();
InternalEngine internalEngine = (InternalEngine) engine;
return internalEngine.hasAcquiredIndexCommitsForTesting();
}
public static final
|
IndexWriterFactory
|
java
|
spring-projects__spring-framework
|
spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSetMetaData.java
|
{
"start": 1409,
"end": 1800
}
|
interface ____ {
/**
* Retrieve the catalog name of the table that served as the source for the
* specified column.
* @param columnIndex the index of the column
* @return the catalog name
* @see java.sql.ResultSetMetaData#getCatalogName(int)
*/
String getCatalogName(int columnIndex) throws InvalidResultSetAccessException;
/**
* Retrieve the fully qualified
|
SqlRowSetMetaData
|
java
|
spring-cloud__spring-cloud-gateway
|
spring-cloud-gateway-server-webflux/src/main/java/org/springframework/cloud/gateway/filter/factory/AbstractNameValueGatewayFilterFactory.java
|
{
"start": 1406,
"end": 1976
}
|
class ____ {
@NotEmpty
protected @Nullable String name;
@NotEmpty
protected @Nullable String value;
public @Nullable String getName() {
return name;
}
public NameValueConfig setName(String name) {
this.name = name;
return this;
}
public @Nullable String getValue() {
return value;
}
public NameValueConfig setValue(String value) {
this.value = value;
return this;
}
@Override
public String toString() {
return new ToStringCreator(this).append("name", name).append("value", value).toString();
}
}
}
|
NameValueConfig
|
java
|
apache__kafka
|
tools/src/main/java/org/apache/kafka/tools/consumer/group/ConsumerGroupCommand.java
|
{
"start": 7947,
"end": 56839
}
|
class ____ implements AutoCloseable {
final ConsumerGroupCommandOptions opts;
final Map<String, String> configOverrides;
private final Admin adminClient;
private final OffsetsUtils offsetsUtils;
ConsumerGroupService(ConsumerGroupCommandOptions opts, Map<String, String> configOverrides) {
this.opts = opts;
this.configOverrides = configOverrides;
try {
this.adminClient = createAdminClient(configOverrides);
} catch (IOException e) {
throw new RuntimeException(e);
}
this.offsetsUtils = new OffsetsUtils(adminClient, opts.parser, getOffsetsUtilsOptions(opts));
}
private OffsetsUtils.OffsetsUtilsOptions getOffsetsUtilsOptions(ConsumerGroupCommandOptions opts) {
return
new OffsetsUtils.OffsetsUtilsOptions(opts.options.valuesOf(opts.groupOpt),
opts.options.valuesOf(opts.resetToOffsetOpt),
opts.options.valuesOf(opts.resetFromFileOpt),
opts.options.valuesOf(opts.resetToDatetimeOpt),
opts.options.valueOf(opts.resetByDurationOpt),
opts.options.valueOf(opts.resetShiftByOpt),
opts.options.valueOf(opts.timeoutMsOpt));
}
void listGroups() throws ExecutionException, InterruptedException {
boolean includeType = opts.options.has(opts.typeOpt);
boolean includeState = opts.options.has(opts.stateOpt);
if (includeType || includeState) {
Set<GroupType> types = typeValues();
Set<GroupState> states = stateValues();
List<GroupListing> listings = listConsumerGroupsWithFilters(types, states);
printGroupInfo(listings, includeType, includeState);
} else {
listConsumerGroups().forEach(System.out::println);
}
}
private Set<GroupState> stateValues() {
String stateValue = opts.options.valueOf(opts.stateOpt);
return (stateValue == null || stateValue.isEmpty())
? Set.of()
: groupStatesFromString(stateValue);
}
private Set<GroupType> typeValues() {
String typeValue = opts.options.valueOf(opts.typeOpt);
return (typeValue == null || typeValue.isEmpty())
? Set.of()
: consumerGroupTypesFromString(typeValue);
}
private void printGroupInfo(List<GroupListing> groups, boolean includeType, boolean includeState) {
Function<GroupListing, String> groupId = GroupListing::groupId;
Function<GroupListing, String> groupType = groupListing -> groupListing.type().orElse(GroupType.UNKNOWN).toString();
Function<GroupListing, String> groupState = groupListing -> groupListing.groupState().orElse(GroupState.UNKNOWN).toString();
OptionalInt maybeMax = groups.stream().mapToInt(groupListing -> Math.max(15, groupId.apply(groupListing).length())).max();
int maxGroupLen = maybeMax.orElse(15) + 10;
String format = "%-" + maxGroupLen + "s";
List<String> header = new ArrayList<>();
header.add("GROUP");
List<Function<GroupListing, String>> extractors = new ArrayList<>();
extractors.add(groupId);
if (includeType) {
header.add("TYPE");
extractors.add(groupType);
format += " %-20s";
}
if (includeState) {
header.add("STATE");
extractors.add(groupState);
format += " %-20s";
}
System.out.printf(format + "%n", header.toArray(new Object[0]));
for (GroupListing groupListing : groups) {
Object[] info = extractors.stream().map(extractor -> extractor.apply(groupListing)).toArray(Object[]::new);
System.out.printf(format + "%n", info);
}
}
List<String> listConsumerGroups() {
try {
ListGroupsResult result = adminClient.listGroups(withTimeoutMs(ListGroupsOptions.forConsumerGroups()));
Collection<GroupListing> listings = result.all().get();
return listings.stream().map(GroupListing::groupId).collect(Collectors.toList());
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
}
List<GroupListing> listConsumerGroupsWithFilters(Set<GroupType> types, Set<GroupState> states) throws ExecutionException, InterruptedException {
ListGroupsOptions listGroupsOptions = withTimeoutMs(ListGroupsOptions.forConsumerGroups());
listGroupsOptions
.inGroupStates(states)
.withTypes(types);
ListGroupsResult result = adminClient.listGroups(listGroupsOptions);
return new ArrayList<>(result.all().get());
}
private boolean shouldPrintMemberState(String group, Optional<GroupState> state, Optional<Integer> numRows) {
// numRows contains the number of data rows, if any, compiled from the API call in the caller method.
// if it's undefined or 0, there is no relevant group information to display.
if (numRows.isEmpty()) {
printError("The consumer group '" + group + "' does not exist.", Optional.empty());
return false;
}
int num = numRows.get();
GroupState state0 = state.orElse(GroupState.UNKNOWN);
switch (state0) {
case DEAD:
printError("Consumer group '" + group + "' does not exist.", Optional.empty());
break;
case EMPTY:
System.err.println("\nConsumer group '" + group + "' has no active members.");
break;
case PREPARING_REBALANCE:
case COMPLETING_REBALANCE:
case ASSIGNING:
case RECONCILING:
System.err.println("\nWarning: Consumer group '" + group + "' is rebalancing.");
break;
case STABLE:
break;
default:
// the control should never reach here
throw new KafkaException("Expected a valid consumer group state, but found '" + state0 + "'.");
}
return !state0.equals(GroupState.DEAD) && num > 0;
}
private Optional<Integer> size(Optional<? extends Collection<?>> colOpt) {
return colOpt.map(Collection::size);
}
private void printOffsets(
Map<String, Entry<Optional<GroupState>, Optional<Collection<PartitionAssignmentState>>>> offsets,
boolean verbose
) {
offsets.forEach((groupId, tuple) -> {
Optional<GroupState> state = tuple.getKey();
Optional<Collection<PartitionAssignmentState>> assignments = tuple.getValue();
if (shouldPrintMemberState(groupId, state, size(assignments))) {
String format = printOffsetFormat(assignments, verbose);
if (verbose) {
System.out.printf(format, "GROUP", "TOPIC", "PARTITION", "LEADER-EPOCH", "CURRENT-OFFSET", "LOG-END-OFFSET", "LAG", "CONSUMER-ID", "HOST", "CLIENT-ID");
} else {
System.out.printf(format, "GROUP", "TOPIC", "PARTITION", "CURRENT-OFFSET", "LOG-END-OFFSET", "LAG", "CONSUMER-ID", "HOST", "CLIENT-ID");
}
if (assignments.isPresent()) {
Collection<PartitionAssignmentState> consumerAssignments = assignments.get();
for (PartitionAssignmentState consumerAssignment : consumerAssignments) {
if (verbose) {
System.out.printf(format,
consumerAssignment.group(),
consumerAssignment.topic().orElse(MISSING_COLUMN_VALUE), consumerAssignment.partition().map(Object::toString).orElse(MISSING_COLUMN_VALUE),
consumerAssignment.leaderEpoch().map(Object::toString).orElse(MISSING_COLUMN_VALUE),
consumerAssignment.offset().map(Object::toString).orElse(MISSING_COLUMN_VALUE), consumerAssignment.logEndOffset().map(Object::toString).orElse(MISSING_COLUMN_VALUE),
consumerAssignment.lag().map(Object::toString).orElse(MISSING_COLUMN_VALUE), consumerAssignment.consumerId().orElse(MISSING_COLUMN_VALUE),
consumerAssignment.host().orElse(MISSING_COLUMN_VALUE), consumerAssignment.clientId().orElse(MISSING_COLUMN_VALUE)
);
} else {
System.out.printf(format,
consumerAssignment.group(),
consumerAssignment.topic().orElse(MISSING_COLUMN_VALUE), consumerAssignment.partition().map(Object::toString).orElse(MISSING_COLUMN_VALUE),
consumerAssignment.offset().map(Object::toString).orElse(MISSING_COLUMN_VALUE), consumerAssignment.logEndOffset().map(Object::toString).orElse(MISSING_COLUMN_VALUE),
consumerAssignment.lag().map(Object::toString).orElse(MISSING_COLUMN_VALUE), consumerAssignment.consumerId().orElse(MISSING_COLUMN_VALUE),
consumerAssignment.host().orElse(MISSING_COLUMN_VALUE), consumerAssignment.clientId().orElse(MISSING_COLUMN_VALUE)
);
}
}
System.out.println();
}
}
});
}
private static String printOffsetFormat(
Optional<Collection<PartitionAssignmentState>> assignments,
boolean verbose
) {
// find proper columns width
int maxGroupLen = 15, maxTopicLen = 15, maxConsumerIdLen = 15, maxHostLen = 15;
if (assignments.isPresent()) {
Collection<PartitionAssignmentState> consumerAssignments = assignments.get();
for (PartitionAssignmentState consumerAssignment : consumerAssignments) {
maxGroupLen = Math.max(maxGroupLen, consumerAssignment.group().length());
maxTopicLen = Math.max(maxTopicLen, consumerAssignment.topic().orElse(MISSING_COLUMN_VALUE).length());
maxConsumerIdLen = Math.max(maxConsumerIdLen, consumerAssignment.consumerId().orElse(MISSING_COLUMN_VALUE).length());
maxHostLen = Math.max(maxHostLen, consumerAssignment.host().orElse(MISSING_COLUMN_VALUE).length());
}
}
if (verbose) {
return "\n%" + (-maxGroupLen) + "s %" + (-maxTopicLen) + "s %-10s %-15s %-15s %-15s %-15s %" + (-maxConsumerIdLen) + "s %" + (-maxHostLen) + "s %s";
} else {
return "\n%" + (-maxGroupLen) + "s %" + (-maxTopicLen) + "s %-10s %-15s %-15s %-15s %" + (-maxConsumerIdLen) + "s %" + (-maxHostLen) + "s %s";
}
}
private void printMembers(Map<String, Entry<Optional<GroupState>, Optional<Collection<MemberAssignmentState>>>> members, boolean verbose) {
members.forEach((groupId, tuple) -> {
Optional<GroupState> groupState = tuple.getKey();
Optional<Collection<MemberAssignmentState>> assignments = tuple.getValue();
int maxGroupLen = 15, maxConsumerIdLen = 15, maxGroupInstanceIdLen = 17, maxHostLen = 15, maxClientIdLen = 15,
maxCurrentAssignment = 20, maxTargetAssignment = 20;
boolean includeGroupInstanceId = false;
boolean hasClassicMember = false;
boolean hasConsumerMember = false;
if (shouldPrintMemberState(groupId, groupState, size(assignments))) {
// find proper columns width
if (assignments.isPresent()) {
for (MemberAssignmentState memberAssignment : assignments.get()) {
maxGroupLen = Math.max(maxGroupLen, memberAssignment.group().length());
maxConsumerIdLen = Math.max(maxConsumerIdLen, memberAssignment.consumerId().length());
maxGroupInstanceIdLen = Math.max(maxGroupInstanceIdLen, memberAssignment.groupInstanceId().length());
maxHostLen = Math.max(maxHostLen, memberAssignment.host().length());
maxClientIdLen = Math.max(maxClientIdLen, memberAssignment.clientId().length());
includeGroupInstanceId = includeGroupInstanceId || !memberAssignment.groupInstanceId().isEmpty();
String currentAssignment = memberAssignment.assignment().isEmpty() ?
MISSING_COLUMN_VALUE : getAssignmentString(memberAssignment.assignment());
String targetAssignment = memberAssignment.targetAssignment().isEmpty() ?
MISSING_COLUMN_VALUE : getAssignmentString(memberAssignment.targetAssignment());
maxCurrentAssignment = Math.max(maxCurrentAssignment, currentAssignment.length());
maxTargetAssignment = Math.max(maxTargetAssignment, targetAssignment.length());
hasClassicMember = hasClassicMember || (memberAssignment.upgraded().isPresent() && !memberAssignment.upgraded().get());
hasConsumerMember = hasConsumerMember || (memberAssignment.upgraded().isPresent() && memberAssignment.upgraded().get());
}
}
}
String formatWithGroupInstanceId = "%" + -maxGroupLen + "s %" + -maxConsumerIdLen + "s %" + -maxGroupInstanceIdLen + "s %" + -maxHostLen + "s %" + -maxClientIdLen + "s %-15s ";
String formatWithoutGroupInstanceId = "%" + -maxGroupLen + "s %" + -maxConsumerIdLen + "s %" + -maxHostLen + "s %" + -maxClientIdLen + "s %-15s ";
if (includeGroupInstanceId) {
System.out.printf("\n" + formatWithGroupInstanceId, "GROUP", "CONSUMER-ID", "GROUP-INSTANCE-ID", "HOST", "CLIENT-ID", "#PARTITIONS");
} else {
System.out.printf("\n" + formatWithoutGroupInstanceId, "GROUP", "CONSUMER-ID", "HOST", "CLIENT-ID", "#PARTITIONS");
}
String formatWithUpgrade = "%-15s %" + -maxCurrentAssignment + "s %-15s %" + -maxTargetAssignment + "s %s";
String formatWithoutUpgrade = "%-15s %" + -maxCurrentAssignment + "s %-15s %" + -maxTargetAssignment + "s";
boolean hasMigrationMember = hasClassicMember && hasConsumerMember;
if (verbose) {
if (hasMigrationMember) {
System.out.printf(formatWithUpgrade, "CURRENT-EPOCH", "CURRENT-ASSIGNMENT", "TARGET-EPOCH", "TARGET-ASSIGNMENT", "UPGRADED");
} else {
System.out.printf(formatWithoutUpgrade, "CURRENT-EPOCH", "CURRENT-ASSIGNMENT", "TARGET-EPOCH", "TARGET-ASSIGNMENT");
}
}
System.out.println();
if (assignments.isPresent()) {
printMembersHelper(assignments.get(), verbose, includeGroupInstanceId, hasMigrationMember,
formatWithGroupInstanceId, formatWithoutGroupInstanceId, formatWithUpgrade, formatWithoutUpgrade);
}
});
}
private void printMembersHelper(
Collection<MemberAssignmentState> memberAssignments,
boolean verbose,
boolean includeGroupInstanceId,
boolean hasMigrationMember,
String formatWithGroupInstanceId,
String formatWithoutGroupInstanceId,
String formatWithUpgrade,
String formatWithoutUpgrade
) {
for (MemberAssignmentState memberAssignment : memberAssignments) {
if (includeGroupInstanceId) {
System.out.printf(formatWithGroupInstanceId, memberAssignment.group(), memberAssignment.consumerId(),
memberAssignment.groupInstanceId(), memberAssignment.host(), memberAssignment.clientId(),
memberAssignment.numPartitions());
} else {
System.out.printf(formatWithoutGroupInstanceId, memberAssignment.group(), memberAssignment.consumerId(),
memberAssignment.host(), memberAssignment.clientId(), memberAssignment.numPartitions());
}
if (verbose) {
String currentEpoch = memberAssignment.currentEpoch().map(Object::toString).orElse(MISSING_COLUMN_VALUE);
String currentAssignment = memberAssignment.assignment().isEmpty() ?
MISSING_COLUMN_VALUE : getAssignmentString(memberAssignment.assignment());
String targetEpoch = memberAssignment.targetEpoch().map(Object::toString).orElse(MISSING_COLUMN_VALUE);
String targetAssignment = memberAssignment.targetAssignment().isEmpty() ?
MISSING_COLUMN_VALUE : getAssignmentString(memberAssignment.targetAssignment());
if (hasMigrationMember) {
System.out.printf(formatWithUpgrade, currentEpoch, currentAssignment, targetEpoch, targetAssignment,
memberAssignment.upgraded().map(Object::toString).orElse(MISSING_COLUMN_VALUE));
} else {
System.out.printf(formatWithoutUpgrade, currentEpoch, currentAssignment, targetEpoch, targetAssignment);
}
}
System.out.println();
}
}
private String getAssignmentString(List<TopicPartition> assignment) {
Map<String, List<TopicPartition>> grouped = new HashMap<>();
assignment.forEach(tp ->
grouped
.computeIfAbsent(tp.topic(), key -> new ArrayList<>())
.add(tp)
);
return grouped.entrySet().stream().map(entry -> {
String topicName = entry.getKey();
List<TopicPartition> topicPartitions = entry.getValue();
return topicPartitions
.stream()
.map(TopicPartition::partition)
.sorted()
.map(Object::toString)
.collect(Collectors.joining(",", topicName + ":", ""));
}).sorted().collect(Collectors.joining(";"));
}
private void printStates(Map<String, GroupInformation> states, boolean verbose) {
states.forEach((groupId, state) -> {
if (shouldPrintMemberState(groupId, Optional.of(state.groupState()), Optional.of(1))) {
String coordinator = state.coordinator().host() + ":" + state.coordinator().port() + " (" + state.coordinator().idString() + ")";
int coordinatorColLen = Math.max(25, coordinator.length());
int groupColLen = Math.max(15, state.group().length());
String assignmentStrategy = state.assignmentStrategy().isEmpty() ? MISSING_COLUMN_VALUE : state.assignmentStrategy();
if (verbose) {
String format = "\n%" + -groupColLen + "s %" + -coordinatorColLen + "s %-20s %-20s %-15s %-25s %s";
System.out.printf(format, "GROUP", "COORDINATOR (ID)", "ASSIGNMENT-STRATEGY", "STATE",
"GROUP-EPOCH", "TARGET-ASSIGNMENT-EPOCH", "#MEMBERS");
System.out.printf(format, state.group(), coordinator, assignmentStrategy, state.groupState(),
state.groupEpoch().map(Object::toString).orElse(MISSING_COLUMN_VALUE), state.targetAssignmentEpoch().map(Object::toString).orElse(MISSING_COLUMN_VALUE), state.numMembers());
} else {
String format = "\n%" + -groupColLen + "s %" + -coordinatorColLen + "s %-20s %-20s %s";
System.out.printf(format, "GROUP", "COORDINATOR (ID)", "ASSIGNMENT-STRATEGY", "STATE", "#MEMBERS");
System.out.printf(format, state.group(), coordinator, assignmentStrategy, state.groupState(), state.numMembers());
}
System.out.println();
}
});
}
void describeGroups() throws Exception {
Collection<String> groupIds = opts.options.has(opts.allGroupsOpt)
? listConsumerGroups()
: opts.options.valuesOf(opts.groupOpt);
boolean membersOptPresent = opts.options.has(opts.membersOpt);
boolean stateOptPresent = opts.options.has(opts.stateOpt);
boolean offsetsOptPresent = opts.options.has(opts.offsetsOpt);
long subActions = Stream.of(membersOptPresent, offsetsOptPresent, stateOptPresent).filter(x -> x).count();
if (subActions == 0 || offsetsOptPresent) {
TreeMap<String, Entry<Optional<GroupState>, Optional<Collection<PartitionAssignmentState>>>> offsets
= collectGroupsOffsets(groupIds);
printOffsets(offsets, opts.options.has(opts.verboseOpt));
} else if (membersOptPresent) {
TreeMap<String, Entry<Optional<GroupState>, Optional<Collection<MemberAssignmentState>>>> members
= collectGroupsMembers(groupIds);
printMembers(members, opts.options.has(opts.verboseOpt));
} else {
TreeMap<String, GroupInformation> states = collectGroupsState(groupIds);
printStates(states, opts.options.has(opts.verboseOpt));
}
}
private Collection<PartitionAssignmentState> collectConsumerAssignment(
String group,
Optional<Node> coordinator,
Collection<TopicPartition> topicPartitions,
Map<TopicPartition, OffsetAndMetadata> committedOffsets,
Optional<String> consumerIdOpt,
Optional<String> hostOpt,
Optional<String> clientIdOpt
) {
if (topicPartitions.isEmpty()) {
return Set.of(
new PartitionAssignmentState(group, coordinator, Optional.empty(), Optional.empty(), Optional.empty(),
getLag(Optional.empty(), Optional.empty()), consumerIdOpt, hostOpt, clientIdOpt, Optional.empty(), Optional.empty())
);
} else {
return describePartitions(group, coordinator, topicPartitions, committedOffsets, consumerIdOpt, hostOpt, clientIdOpt);
}
}
private Optional<Long> getLag(Optional<Long> offset, Optional<Long> logEndOffset) {
return offset.filter(o -> o != -1).flatMap(offset0 -> logEndOffset.map(end -> end - offset0));
}
private Collection<PartitionAssignmentState> describePartitions(
String group,
Optional<Node> coordinator,
Collection<TopicPartition> topicPartitions,
Map<TopicPartition, OffsetAndMetadata> committedOffsets,
Optional<String> consumerIdOpt,
Optional<String> hostOpt,
Optional<String> clientIdOpt
) {
BiFunction<TopicPartition, Optional<Long>, PartitionAssignmentState> getDescribePartitionResult = (topicPartition, logEndOffsetOpt) -> {
// The admin client returns `null` as a value to indicate that there is not committed offset for a partition.
Optional<Long> offset = Optional.ofNullable(committedOffsets.get(topicPartition)).map(OffsetAndMetadata::offset);
Optional<Integer> leaderEpoch = Optional.ofNullable(committedOffsets.get(topicPartition)).flatMap(OffsetAndMetadata::leaderEpoch);
return new PartitionAssignmentState(group, coordinator, Optional.of(topicPartition.topic()),
Optional.of(topicPartition.partition()), offset, getLag(offset, logEndOffsetOpt),
consumerIdOpt, hostOpt, clientIdOpt, logEndOffsetOpt, leaderEpoch);
};
List<TopicPartition> topicPartitionsWithoutLeader = offsetsUtils.filterNoneLeaderPartitions(topicPartitions);
List<TopicPartition> topicPartitionsWithLeader = topicPartitions.stream().filter(tp -> !topicPartitionsWithoutLeader.contains(tp)).toList();
// prepare data for partitions with leaders
List<PartitionAssignmentState> existLeaderAssignments = offsetsUtils.getLogEndOffsets(topicPartitionsWithLeader).entrySet().stream().map(logEndOffsetResult -> {
if (logEndOffsetResult.getValue() instanceof OffsetsUtils.LogOffset)
return getDescribePartitionResult.apply(
logEndOffsetResult.getKey(),
Optional.of(((OffsetsUtils.LogOffset) logEndOffsetResult.getValue()).value())
);
else if (logEndOffsetResult.getValue() instanceof OffsetsUtils.Unknown)
return getDescribePartitionResult.apply(logEndOffsetResult.getKey(), Optional.empty());
else if (logEndOffsetResult.getValue() instanceof OffsetsUtils.Ignore)
return null;
throw new IllegalStateException("Unknown LogOffset subclass: " + logEndOffsetResult.getValue());
}).toList();
// prepare data for partitions without leaders
List<PartitionAssignmentState> noneLeaderAssignments = topicPartitionsWithoutLeader.stream()
.map(tp -> getDescribePartitionResult.apply(tp, Optional.empty())).toList();
// concat the data and then sort them
return Stream.concat(existLeaderAssignments.stream(), noneLeaderAssignments.stream())
.sorted(Comparator.<PartitionAssignmentState, String>comparing(
state -> state.topic().orElse(""), String::compareTo)
.thenComparingInt(state -> state.partition().orElse(-1)))
.collect(Collectors.toList());
}
Map<String, Map<TopicPartition, OffsetAndMetadata>> resetOffsets() {
List<String> groupIds = opts.options.has(opts.allGroupsOpt)
? listConsumerGroups()
: opts.options.valuesOf(opts.groupOpt);
Map<String, KafkaFuture<ConsumerGroupDescription>> consumerGroups = adminClient.describeConsumerGroups(
groupIds,
withTimeoutMs(new DescribeConsumerGroupsOptions())
).describedGroups();
Map<String, Map<TopicPartition, OffsetAndMetadata>> result = new HashMap<>();
consumerGroups.forEach((groupId, groupDescription) -> {
try {
String state = groupDescription.get().groupState().toString();
switch (state) {
case "Empty":
case "Dead":
result.put(groupId, resetOffsetsForInactiveGroup(groupId));
break;
default:
printError("Assignments can only be reset if the group '" + groupId + "' is inactive, but the current state is " + state + ".", Optional.empty());
result.put(groupId, Map.of());
}
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
} catch (ExecutionException ee) {
if (ee.getCause() instanceof GroupIdNotFoundException) {
result.put(groupId, resetOffsetsForInactiveGroup(groupId));
} else {
throw new RuntimeException(ee);
}
}
});
return result;
}
private Map<TopicPartition, OffsetAndMetadata> resetOffsetsForInactiveGroup(String groupId) {
try {
Collection<TopicPartition> partitionsToReset = getPartitionsToReset(groupId);
Map<TopicPartition, OffsetAndMetadata> preparedOffsets = prepareOffsetsToReset(groupId, partitionsToReset);
// Dry-run is the default behavior if --execute is not specified
boolean dryRun = opts.options.has(opts.dryRunOpt) || !opts.options.has(opts.executeOpt);
if (!dryRun) {
adminClient.alterConsumerGroupOffsets(
groupId,
preparedOffsets,
withTimeoutMs(new AlterConsumerGroupOffsetsOptions())
).all().get();
}
return preparedOffsets;
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
} catch (ExecutionException ee) {
Throwable cause = ee.getCause();
if (cause instanceof KafkaException) {
throw (KafkaException) cause;
} else {
throw new RuntimeException(cause);
}
}
}
Entry<Errors, Map<TopicPartition, Throwable>> deleteOffsets(String groupId, List<String> topics) {
Map<TopicPartition, Throwable> partitionLevelResult = new HashMap<>();
Set<String> topicWithPartitions = new HashSet<>();
Set<String> topicWithoutPartitions = new HashSet<>();
for (String topic : topics) {
if (topic.contains(":"))
topicWithPartitions.add(topic);
else
topicWithoutPartitions.add(topic);
}
List<TopicPartition> knownPartitions = topicWithPartitions.stream().flatMap(offsetsUtils::parseTopicsWithPartitions).toList();
// Get the partitions of topics that the user did not explicitly specify the partitions
DescribeTopicsResult describeTopicsResult = adminClient.describeTopics(
topicWithoutPartitions,
withTimeoutMs(new DescribeTopicsOptions()));
Iterator<TopicPartition> unknownPartitions = describeTopicsResult.topicNameValues().entrySet().stream().flatMap(e -> {
String topic = e.getKey();
try {
return e.getValue().get().partitions().stream().map(partition ->
new TopicPartition(topic, partition.partition()));
} catch (ExecutionException | InterruptedException err) {
partitionLevelResult.put(new TopicPartition(topic, -1), err);
return Stream.empty();
}
}).iterator();
Set<TopicPartition> partitions = new HashSet<>(knownPartitions);
unknownPartitions.forEachRemaining(partitions::add);
DeleteConsumerGroupOffsetsResult deleteResult = adminClient.deleteConsumerGroupOffsets(
groupId,
partitions,
withTimeoutMs(new DeleteConsumerGroupOffsetsOptions())
);
Errors topLevelException = Errors.NONE;
try {
deleteResult.all().get();
} catch (ExecutionException | InterruptedException e) {
topLevelException = Errors.forException(e.getCause());
}
partitions.forEach(partition -> {
try {
deleteResult.partitionResult(partition).get();
partitionLevelResult.put(partition, null);
} catch (ExecutionException | InterruptedException e) {
partitionLevelResult.put(partition, e);
}
});
return new SimpleImmutableEntry<>(topLevelException, partitionLevelResult);
}
void deleteOffsets() {
String groupId = opts.options.valueOf(opts.groupOpt);
List<String> topics = opts.options.valuesOf(opts.topicOpt);
Entry<Errors, Map<TopicPartition, Throwable>> res = deleteOffsets(groupId, topics);
Errors topLevelResult = res.getKey();
Map<TopicPartition, Throwable> partitionLevelResult = res.getValue();
switch (topLevelResult) {
case NONE:
System.out.println("Request succeeded for deleting offsets from group " + groupId + ".");
break;
case INVALID_GROUP_ID:
case GROUP_ID_NOT_FOUND:
case GROUP_AUTHORIZATION_FAILED:
case NON_EMPTY_GROUP:
printError(topLevelResult.message(), Optional.empty());
break;
case GROUP_SUBSCRIBED_TO_TOPIC:
case TOPIC_AUTHORIZATION_FAILED:
case UNKNOWN_TOPIC_OR_PARTITION:
printError("Encountered some partition-level error, see the follow-up details.", Optional.empty());
break;
default:
printError("Encountered some unknown error: " + topLevelResult, Optional.empty());
}
int maxTopicLen = 15;
for (TopicPartition tp : partitionLevelResult.keySet()) {
maxTopicLen = Math.max(maxTopicLen, tp.topic().length());
}
String format = "%n%" + (-maxTopicLen) + "s %-10s %-15s";
System.out.printf(format, "TOPIC", "PARTITION", "STATUS");
partitionLevelResult.entrySet().stream()
.sorted(Comparator.comparing(e -> e.getKey().topic() + e.getKey().partition()))
.forEach(e -> {
TopicPartition tp = e.getKey();
Throwable error = e.getValue();
System.out.printf(format,
tp.topic(),
tp.partition() >= 0 ? tp.partition() : MISSING_COLUMN_VALUE,
error != null ? "Error: " + error.getMessage() : "Successful"
);
});
System.out.println();
}
Map<String, ConsumerGroupDescription> describeConsumerGroups(Collection<String> groupIds) throws Exception {
Map<String, ConsumerGroupDescription> res = new HashMap<>();
Map<String, KafkaFuture<ConsumerGroupDescription>> stringKafkaFutureMap = adminClient.describeConsumerGroups(
groupIds,
withTimeoutMs(new DescribeConsumerGroupsOptions())
).describedGroups();
for (Entry<String, KafkaFuture<ConsumerGroupDescription>> e : stringKafkaFutureMap.entrySet()) {
res.put(e.getKey(), e.getValue().get());
}
return res;
}
/**
* Returns the state of the specified consumer group and partition assignment states
*/
Entry<Optional<GroupState>, Optional<Collection<PartitionAssignmentState>>> collectGroupOffsets(String groupId) throws Exception {
return collectGroupsOffsets(List.of(groupId)).getOrDefault(groupId, new SimpleImmutableEntry<>(Optional.empty(), Optional.empty()));
}
/**
* Returns states of the specified consumer groups and partition assignment states
*/
TreeMap<String, Entry<Optional<GroupState>, Optional<Collection<PartitionAssignmentState>>>> collectGroupsOffsets(Collection<String> groupIds) throws Exception {
Map<String, ConsumerGroupDescription> consumerGroups = describeConsumerGroups(groupIds);
TreeMap<String, Entry<Optional<GroupState>, Optional<Collection<PartitionAssignmentState>>>> groupOffsets = new TreeMap<>();
consumerGroups.forEach((groupId, consumerGroup) -> {
GroupState state = consumerGroup.groupState();
Map<TopicPartition, OffsetAndMetadata> committedOffsets = getCommittedOffsets(groupId);
List<TopicPartition> assignedTopicPartitions = new ArrayList<>();
Comparator<MemberDescription> comparator =
Comparator.<MemberDescription>comparingInt(m -> m.assignment().topicPartitions().size()).reversed();
List<PartitionAssignmentState> rowsWithConsumer = new ArrayList<>();
consumerGroup.members().stream().filter(m -> !m.assignment().topicPartitions().isEmpty())
.sorted(comparator)
.forEach(consumerSummary -> {
Set<TopicPartition> topicPartitions = consumerSummary.assignment().topicPartitions();
assignedTopicPartitions.addAll(topicPartitions);
rowsWithConsumer.addAll(collectConsumerAssignment(
groupId,
Optional.of(consumerGroup.coordinator()),
topicPartitions,
committedOffsets,
Optional.of(consumerSummary.consumerId()),
Optional.of(consumerSummary.host()),
Optional.of(consumerSummary.clientId()))
);
});
Map<TopicPartition, OffsetAndMetadata> unassignedPartitions = new HashMap<>();
committedOffsets.entrySet().stream().filter(e -> !assignedTopicPartitions.contains(e.getKey()))
.forEach(e -> unassignedPartitions.put(e.getKey(), e.getValue()));
Collection<PartitionAssignmentState> rowsWithoutConsumer = !unassignedPartitions.isEmpty()
? collectConsumerAssignment(
groupId,
Optional.of(consumerGroup.coordinator()),
unassignedPartitions.keySet(),
committedOffsets,
Optional.of(MISSING_COLUMN_VALUE),
Optional.of(MISSING_COLUMN_VALUE),
Optional.of(MISSING_COLUMN_VALUE))
: List.of();
rowsWithConsumer.addAll(rowsWithoutConsumer);
groupOffsets.put(groupId, new SimpleImmutableEntry<>(Optional.of(state), Optional.of(rowsWithConsumer)));
});
return groupOffsets;
}
Entry<Optional<GroupState>, Optional<Collection<MemberAssignmentState>>> collectGroupMembers(String groupId) throws Exception {
return collectGroupsMembers(Set.of(groupId)).get(groupId);
}
TreeMap<String, Entry<Optional<GroupState>, Optional<Collection<MemberAssignmentState>>>> collectGroupsMembers(Collection<String> groupIds) throws Exception {
Map<String, ConsumerGroupDescription> consumerGroups = describeConsumerGroups(groupIds);
TreeMap<String, Entry<Optional<GroupState>, Optional<Collection<MemberAssignmentState>>>> res = new TreeMap<>();
consumerGroups.forEach((groupId, consumerGroup) -> {
GroupState state = consumerGroup.groupState();
List<MemberAssignmentState> memberAssignmentStates = consumerGroup.members().stream().map(consumer ->
new MemberAssignmentState(
groupId,
consumer.consumerId(),
consumer.host(),
consumer.clientId(),
consumer.groupInstanceId().orElse(""),
consumer.assignment().topicPartitions().size(),
consumer.assignment().topicPartitions().stream().toList(),
consumer.targetAssignment().map(a -> a.topicPartitions().stream().toList()).orElse(List.of()),
consumer.memberEpoch(),
consumerGroup.targetAssignmentEpoch(),
consumer.upgraded()
)).collect(Collectors.toList());
res.put(groupId, new SimpleImmutableEntry<>(Optional.of(state), Optional.of(memberAssignmentStates)));
});
return res;
}
GroupInformation collectGroupState(String groupId) throws Exception {
return collectGroupsState(Set.of(groupId)).get(groupId);
}
TreeMap<String, GroupInformation> collectGroupsState(Collection<String> groupIds) throws Exception {
Map<String, ConsumerGroupDescription> consumerGroups = describeConsumerGroups(groupIds);
TreeMap<String, GroupInformation> res = new TreeMap<>();
consumerGroups.forEach((groupId, groupDescription) ->
res.put(groupId, new GroupInformation(
groupId,
groupDescription.coordinator(),
groupDescription.partitionAssignor(),
groupDescription.groupState(),
groupDescription.members().size(),
groupDescription.groupEpoch(),
groupDescription.targetAssignmentEpoch()
)));
return res;
}
@Override
public void close() {
adminClient.close();
}
// Visibility for testing
protected Admin createAdminClient(Map<String, String> configOverrides) throws IOException {
Properties props = opts.options.has(opts.commandConfigOpt) ? Utils.loadProps(opts.options.valueOf(opts.commandConfigOpt)) : new Properties();
props.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, opts.options.valueOf(opts.bootstrapServerOpt));
props.putAll(configOverrides);
return Admin.create(props);
}
private <T extends AbstractOptions<T>> T withTimeoutMs(T options) {
int t = opts.options.valueOf(opts.timeoutMsOpt).intValue();
return options.timeoutMs(t);
}
private Collection<TopicPartition> getPartitionsToReset(String groupId) throws ExecutionException, InterruptedException {
if (opts.options.has(opts.allTopicsOpt)) {
return getCommittedOffsets(groupId).keySet();
} else if (opts.options.has(opts.topicOpt)) {
List<String> topics = opts.options.valuesOf(opts.topicOpt);
return offsetsUtils.parseTopicPartitionsToReset(topics);
} else {
if (!opts.options.has(opts.resetFromFileOpt))
CommandLineUtils.printUsageAndExit(opts.parser, "One of the reset scopes should be defined: --all-topics, --topic.");
return List.of();
}
}
private Map<TopicPartition, OffsetAndMetadata> getCommittedOffsets(String groupId) {
try {
return adminClient.listConsumerGroupOffsets(
Map.of(groupId, new ListConsumerGroupOffsetsSpec()),
withTimeoutMs(new ListConsumerGroupOffsetsOptions())
).partitionsToOffsetAndMetadata(groupId).get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
}
private Map<TopicPartition, OffsetAndMetadata> prepareOffsetsToReset(String groupId, Collection<TopicPartition> partitionsToReset) {
// ensure all partitions are valid, otherwise throw a runtime exception
offsetsUtils.checkAllTopicPartitionsValid(partitionsToReset);
if (opts.options.has(opts.resetToOffsetOpt)) {
return offsetsUtils.resetToOffset(partitionsToReset);
} else if (opts.options.has(opts.resetToEarliestOpt)) {
return offsetsUtils.resetToEarliest(partitionsToReset);
} else if (opts.options.has(opts.resetToLatestOpt)) {
return offsetsUtils.resetToLatest(partitionsToReset);
} else if (opts.options.has(opts.resetShiftByOpt)) {
Map<TopicPartition, OffsetAndMetadata> currentCommittedOffsets = getCommittedOffsets(groupId);
return offsetsUtils.resetByShiftBy(partitionsToReset, currentCommittedOffsets);
} else if (opts.options.has(opts.resetToDatetimeOpt)) {
return offsetsUtils.resetToDateTime(partitionsToReset);
} else if (opts.options.has(opts.resetByDurationOpt)) {
return offsetsUtils.resetByDuration(partitionsToReset);
} else if (offsetsUtils.resetPlanFromFile().isPresent()) {
return offsetsUtils.resetFromFile(groupId);
} else if (opts.options.has(opts.resetToCurrentOpt)) {
Map<TopicPartition, OffsetAndMetadata> currentCommittedOffsets = getCommittedOffsets(groupId);
return offsetsUtils.resetToCurrent(partitionsToReset, currentCommittedOffsets);
}
CommandLineUtils.printUsageAndExit(opts.parser, String.format("Option '%s' requires one of the following scenarios: %s", opts.resetOffsetsOpt, opts.allResetOffsetScenarioOpts));
return null;
}
String exportOffsetsToCsv(Map<String, Map<TopicPartition, OffsetAndMetadata>> assignments) {
boolean isSingleGroupQuery = opts.options.valuesOf(opts.groupOpt).size() == 1;
ObjectWriter csvWriter = isSingleGroupQuery
? CsvUtils.writerFor(CsvUtils.CsvRecordNoGroup.class)
: CsvUtils.writerFor(CsvUtils.CsvRecordWithGroup.class);
return assignments.entrySet().stream().flatMap(e -> {
String groupId = e.getKey();
Map<TopicPartition, OffsetAndMetadata> partitionInfo = e.getValue();
return partitionInfo.entrySet().stream().map(e1 -> {
TopicPartition k = e1.getKey();
OffsetAndMetadata v = e1.getValue();
Object csvRecord = isSingleGroupQuery
? new CsvUtils.CsvRecordNoGroup(k.topic(), k.partition(), v.offset())
: new CsvUtils.CsvRecordWithGroup(groupId, k.topic(), k.partition(), v.offset());
try {
return csvWriter.writeValueAsString(csvRecord);
} catch (JsonProcessingException err) {
throw new RuntimeException(err);
}
});
}).collect(Collectors.joining());
}
Map<String, Throwable> deleteGroups() {
List<String> groupIds = opts.options.has(opts.allGroupsOpt)
? listConsumerGroups()
: opts.options.valuesOf(opts.groupOpt);
Map<String, KafkaFuture<Void>> groupsToDelete = adminClient.deleteConsumerGroups(
groupIds,
withTimeoutMs(new DeleteConsumerGroupsOptions())
).deletedGroups();
Map<String, Throwable> success = new HashMap<>();
Map<String, Throwable> failed = new HashMap<>();
groupsToDelete.forEach((g, f) -> {
try {
f.get();
success.put(g, null);
} catch (InterruptedException ie) {
failed.put(g, ie);
} catch (ExecutionException e) {
failed.put(g, e.getCause());
}
});
if (failed.isEmpty())
System.out.println("Deletion of requested consumer groups (" + success.keySet().stream().map(group -> "'" + group + "'").collect(Collectors.joining(", ")) + ") was successful.");
else {
printError("Deletion of some consumer groups failed:", Optional.empty());
failed.forEach((group, error) -> System.out.println("* Group '" + group + "' could not be deleted due to: " + error));
if (!success.isEmpty())
System.out.println("\nThese consumer groups were deleted successfully: " + success.keySet().stream().map(group -> "'" + group + "'").collect(Collectors.joining(", ")));
}
failed.putAll(success);
return failed;
}
}
}
|
ConsumerGroupService
|
java
|
junit-team__junit5
|
junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/DefensiveAllDefaultPossibilitiesBuilder.java
|
{
"start": 3497,
"end": 3960
}
|
class ____ extends AnnotatedBuilder {
DefensiveAnnotatedBuilder(RunnerBuilder suiteBuilder) {
super(suiteBuilder);
}
@Override
public @Nullable Runner buildRunner(Class<? extends Runner> runnerClass, Class<?> testClass) throws Exception {
// Referenced by name because it might not be available at runtime.
if ("org.junit.platform.runner.JUnitPlatform".equals(runnerClass.getName())) {
logger.warn(() -> "Ignoring test
|
DefensiveAnnotatedBuilder
|
java
|
elastic__elasticsearch
|
server/src/main/java/org/elasticsearch/index/fielddata/plain/LatLonPointIndexFieldData.java
|
{
"start": 1272,
"end": 3072
}
|
class ____ extends AbstractPointIndexFieldData<MultiGeoPointValues> implements IndexGeoPointFieldData {
public LatLonPointIndexFieldData(
String fieldName,
ValuesSourceType valuesSourceType,
ToScriptFieldFactory<MultiGeoPointValues> toScriptFieldFactory
) {
super(fieldName, valuesSourceType, toScriptFieldFactory);
}
@Override
public LeafPointFieldData<MultiGeoPointValues> load(LeafReaderContext context) {
LeafReader reader = context.reader();
FieldInfo info = reader.getFieldInfos().fieldInfo(fieldName);
if (info != null) {
checkCompatible(info);
}
return new LatLonPointDVLeafFieldData(reader, fieldName, toScriptFieldFactory);
}
@Override
public LeafPointFieldData<MultiGeoPointValues> loadDirect(LeafReaderContext context) {
return load(context);
}
/** helper: checks a fieldinfo and throws exception if its definitely not a LatLonDocValuesField */
static void checkCompatible(FieldInfo fieldInfo) {
// dv properties could be "unset", if you e.g. used only StoredField with this same name in the segment.
if (fieldInfo.getDocValuesType() != DocValuesType.NONE
&& fieldInfo.getDocValuesType() != LatLonDocValuesField.TYPE.docValuesType()) {
throw new IllegalArgumentException(
"field=\""
+ fieldInfo.name
+ "\" was indexed with docValuesType="
+ fieldInfo.getDocValuesType()
+ " but this type has docValuesType="
+ LatLonDocValuesField.TYPE.docValuesType()
+ ", is the field really a LatLonDocValuesField?"
);
}
}
public static
|
LatLonPointIndexFieldData
|
java
|
square__javapoet
|
src/test/java/com/squareup/javapoet/TypeSpecTest.java
|
{
"start": 53626,
"end": 54610
}
|
class ____ {\n"
+ " void inlineIndent() {\n"
+ " if (3 < 4) {\n"
+ " System.out.println(\"hello\");\n"
+ " }\n"
+ " }\n"
+ "}\n");
}
@Test public void defaultModifiersForInterfaceMembers() throws Exception {
TypeSpec taco = TypeSpec.interfaceBuilder("Taco")
.addField(FieldSpec.builder(String.class, "SHELL")
.addModifiers(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)
.initializer("$S", "crunchy corn")
.build())
.addMethod(MethodSpec.methodBuilder("fold")
.addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
.build())
.addType(TypeSpec.classBuilder("Topping")
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
.build())
.build();
assertThat(toString(taco)).isEqualTo(""
+ "package com.squareup.tacos;\n"
+ "\n"
+ "import java.lang.String;\n"
+ "\n"
+ "
|
Taco
|
java
|
elastic__elasticsearch
|
x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/MinLongGroupingAggregatorFunctionTests.java
|
{
"start": 804,
"end": 1916
}
|
class ____ extends GroupingAggregatorFunctionTestCase {
@Override
protected AggregatorFunctionSupplier aggregatorFunction() {
return new MinLongAggregatorFunctionSupplier();
}
@Override
protected String expectedDescriptionOfAggregator() {
return "min of longs";
}
@Override
protected SourceOperator simpleInput(BlockFactory blockFactory, int size) {
return new TupleLongLongBlockSourceOperator(
blockFactory,
LongStream.range(0, size).mapToObj(l -> Tuple.tuple(randomLongBetween(0, 4), randomLong()))
);
}
@Override
protected void assertSimpleGroup(List<Page> input, Block result, int position, Long group) {
OptionalLong min = input.stream().flatMapToLong(p -> allLongs(p, group)).min();
if (min.isEmpty()) {
assertThat(result.isNull(position), equalTo(true));
return;
}
assertThat(result.isNull(position), equalTo(false));
assertThat(((LongBlock) result).getLong(position), equalTo(min.getAsLong()));
}
}
|
MinLongGroupingAggregatorFunctionTests
|
java
|
apache__logging-log4j2
|
log4j-api-test/src/test/java/org/apache/logging/log4j/util/EnvironmentPropertySourceSecurityManagerIT.java
|
{
"start": 2277,
"end": 3559
}
|
class ____.apache.logging.log4j.util.PropertiesUtil
* at org.apache.logging.log4j.status.StatusLogger.<clinit>(StatusLogger.java:78)
* at org.apache.logging.log4j.core.AbstractLifeCycle.<clinit>(AbstractLifeCycle.java:38)
* at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
* at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
* at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
* at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
* at org.apache.logging.log4j.core.config.builder.impl.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:172)
* at org.apache.logging.log4j.core.config.builder.impl.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:161)
* at org.apache.logging.log4j.core.config.builder.impl.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:1)
* at org.apache.logging.log4j.util.EnvironmentPropertySourceSecurityManagerTest.test(EnvironmentPropertySourceSecurityManagerTest.java:55)
* </pre>
*/
@Test
public void test() {
PropertiesUtil.getProperties();
}
}
|
org
|
java
|
spring-projects__spring-framework
|
spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java
|
{
"start": 29560,
"end": 29645
}
|
interface ____<E extends MegaEvent> {
void receive(E event);
}
public
|
MegaReceiver
|
java
|
apache__logging-log4j2
|
log4j-core-test/src/test/java/org/apache/logging/log4j/core/pattern/MaxLengthConverterTest.java
|
{
"start": 1196,
"end": 2838
}
|
class ____ {
private static final MaxLengthConverter converter = MaxLengthConverter.newInstance(null, new String[] {"%m", "10"});
@Test
void testUnderMaxLength() {
final Message message = new SimpleMessage("0123456789");
final LogEvent event = Log4jLogEvent.newBuilder()
.setLoggerName("MyLogger")
.setLevel(Level.DEBUG)
.setMessage(message)
.build();
final StringBuilder sb = new StringBuilder();
converter.format(event, sb);
assertEquals("0123456789", sb.toString());
}
@Test
void testOverMaxLength() {
final Message message = new SimpleMessage("01234567890123456789");
final LogEvent event = Log4jLogEvent.newBuilder()
.setLoggerName("MyLogger")
.setLevel(Level.DEBUG)
.setMessage(message)
.build();
final StringBuilder sb = new StringBuilder();
converter.format(event, sb);
assertEquals("0123456789", sb.toString());
}
@Test
void testOverMaxLength21WithEllipsis() {
final Message message = new SimpleMessage("012345678901234567890123456789");
final LogEvent event = Log4jLogEvent.newBuilder()
.setLoggerName("MyLogger")
.setLevel(Level.DEBUG)
.setMessage(message)
.build();
final StringBuilder sb = new StringBuilder();
MaxLengthConverter.newInstance(null, new String[] {"%m", "21"}).format(event, sb);
assertEquals("012345678901234567890...", sb.toString());
}
}
|
MaxLengthConverterTest
|
java
|
quarkusio__quarkus
|
extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/runtime/telemetry/TracesForwardingWebSocketEndpoint.java
|
{
"start": 487,
"end": 1536
}
|
class ____ extends ForwardingWebSocketEndpoint {
private final WebSocketTracesInterceptor tracesInterceptor;
private final WebSocketEndpointContext endpointContext;
TracesForwardingWebSocketEndpoint(WebSocketEndpoint delegate, WebSocketTracesInterceptor tracesInterceptor,
WebSocketEndpointContext endpointContext) {
super(delegate);
this.tracesInterceptor = tracesInterceptor;
this.endpointContext = endpointContext;
}
@Override
public Future<Void> onClose() {
return delegate.onClose().map(new Function<Void, Void>() {
@Override
public Void apply(Void unused) {
tracesInterceptor.onConnectionClosed(endpointContext);
return null;
}
}).onFailure(new Handler<Throwable>() {
@Override
public void handle(Throwable throwable) {
tracesInterceptor.onConnectionClosingFailed(throwable, endpointContext);
}
});
}
}
|
TracesForwardingWebSocketEndpoint
|
java
|
spring-projects__spring-framework
|
spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactoryTests.java
|
{
"start": 971,
"end": 1536
}
|
class ____ {
private final LeakAwareDataBufferFactory bufferFactory = new LeakAwareDataBufferFactory();
@Test
@SuppressWarnings("deprecation")
void leak() {
DataBuffer dataBuffer = this.bufferFactory.allocateBuffer();
try {
assertThatExceptionOfType(AssertionError.class).isThrownBy(this.bufferFactory::checkForLeaks);
}
finally {
release(dataBuffer);
}
}
@Test
void noLeak() {
DataBuffer dataBuffer = this.bufferFactory.allocateBuffer(256);
release(dataBuffer);
this.bufferFactory.checkForLeaks();
}
}
|
LeakAwareDataBufferFactoryTests
|
java
|
apache__camel
|
components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/firehose/client/impl/KinesisFirehoseClientIAMProfileOptimizedImpl.java
|
{
"start": 1921,
"end": 4838
}
|
class ____ implements KinesisFirehoseInternalClient {
private static final Logger LOG = LoggerFactory.getLogger(KinesisFirehoseClientIAMProfileOptimizedImpl.class);
private KinesisFirehose2Configuration configuration;
/**
* Constructor that uses the config file.
*/
public KinesisFirehoseClientIAMProfileOptimizedImpl(KinesisFirehose2Configuration configuration) {
LOG.trace(
"Creating an AWS Kinesis Firehose client for an ec2 instance with IAM temporary credentials (normal for ec2s).");
this.configuration = configuration;
}
/**
* Getting the Kinesis client that is used.
*
* @return Amazon Kinesis Client.
*/
@Override
public FirehoseClient getKinesisFirehoseClient() {
FirehoseClient client = null;
FirehoseClientBuilder clientBuilder = FirehoseClient.builder();
ProxyConfiguration.Builder proxyConfig = null;
ApacheHttpClient.Builder httpClientBuilder = null;
if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
proxyConfig = ProxyConfiguration.builder();
URI proxyEndpoint = URI.create(configuration.getProxyProtocol() + "://" + configuration.getProxyHost() + ":"
+ configuration.getProxyPort());
proxyConfig.endpoint(proxyEndpoint);
httpClientBuilder = ApacheHttpClient.builder().proxyConfiguration(proxyConfig.build());
clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder);
}
if (configuration.getProfileCredentialsName() != null) {
clientBuilder = clientBuilder
.credentialsProvider(ProfileCredentialsProvider.create(configuration.getProfileCredentialsName()));
}
if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
clientBuilder = clientBuilder.region(Region.of(configuration.getRegion()));
}
if (configuration.isOverrideEndpoint()) {
clientBuilder.endpointOverride(URI.create(configuration.getUriEndpointOverride()));
}
if (configuration.isTrustAllCertificates()) {
if (httpClientBuilder == null) {
httpClientBuilder = ApacheHttpClient.builder();
}
SdkHttpClient ahc = httpClientBuilder.buildWithDefaults(AttributeMap
.builder()
.put(
SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES,
Boolean.TRUE)
.build());
// set created http client to use instead of builder
clientBuilder.httpClient(ahc);
clientBuilder.httpClientBuilder(null);
}
client = clientBuilder.build();
return client;
}
}
|
KinesisFirehoseClientIAMProfileOptimizedImpl
|
java
|
quarkusio__quarkus
|
devtools/cli/src/main/java/io/quarkus/cli/create/TargetLanguageGroup.java
|
{
"start": 504,
"end": 2539
}
|
class ____ extends ArrayList<String> {
VersionCandidates() {
super(JavaVersion.JAVA_VERSIONS_LTS.stream().map(String::valueOf).collect(Collectors.toList()));
}
}
@CommandLine.Option(names = {
"--java" }, description = "Target Java version.\n Valid values: ${COMPLETION-CANDIDATES}", completionCandidates = VersionCandidates.class, defaultValue = JavaVersion.DETECT_JAVA_RUNTIME_VERSION)
String javaVersion = JavaVersion.DETECT_JAVA_RUNTIME_VERSION;
@CommandLine.Option(names = { "--kotlin" }, description = "Use Kotlin")
boolean kotlin = false;
@CommandLine.Option(names = { "--scala" }, description = "Use Scala")
boolean scala = false;
public SourceType getSourceType(CommandSpec spec, BuildTool buildTool, Set<String> extensions, OutputOptionMixin output) {
if (kotlin && scala) {
throw new ParameterException(spec.commandLine(),
"Invalid source type. Projects can target either Kotlin (--kotlin) or Scala (--scala), not both.");
}
if (sourceType == null) {
if (buildTool == null) {
// Buildless/JBang only works with Java, atm
sourceType = SourceType.JAVA;
if (kotlin || scala) {
output.warn("JBang only supports Java. Using Java as the target language.");
}
} else if (kotlin) {
sourceType = SourceType.KOTLIN;
} else if (scala) {
sourceType = SourceType.SCALA;
} else {
sourceType = SourceType.resolve(extensions);
}
}
return sourceType;
}
public String getJavaVersion() {
return javaVersion;
}
@Override
public String toString() {
return "TargetLanguageGroup [java=" + javaVersion
+ ", kotlin=" + kotlin
+ ", scala=" + scala
+ ", sourceType=" + sourceType
+ "]";
}
}
|
VersionCandidates
|
java
|
elastic__elasticsearch
|
server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsRequestBuilder.java
|
{
"start": 670,
"end": 1173
}
|
class ____ extends NodesOperationRequestBuilder<
ClusterStatsRequest,
ClusterStatsResponse,
ClusterStatsRequestBuilder> {
public ClusterStatsRequestBuilder(ElasticsearchClient client) {
super(client, TransportClusterStatsAction.TYPE, new ClusterStatsRequest());
}
public ClusterStatsRequestBuilder(ElasticsearchClient client, boolean isCPS) {
super(client, TransportClusterStatsAction.TYPE, new ClusterStatsRequest(false, isCPS));
}
}
|
ClusterStatsRequestBuilder
|
java
|
apache__camel
|
core/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFluentProducerTemplateFactoryBean.java
|
{
"start": 1494,
"end": 3906
}
|
class ____ extends AbstractCamelFactoryBean<FluentProducerTemplate> {
@XmlTransient
private FluentProducerTemplate template;
@XmlAttribute
@Metadata(description = "Sets the default endpoint URI used by default for sending message exchanges")
private String defaultEndpoint;
@XmlAttribute
@Metadata(description = "Sets a custom maximum cache size to use in the backing cache pools.")
private Integer maximumCacheSize;
@Override
public FluentProducerTemplate getObject() throws Exception {
CamelContext context = getCamelContext();
if (defaultEndpoint != null) {
Endpoint endpoint = context.getEndpoint(defaultEndpoint);
if (endpoint == null) {
throw new IllegalArgumentException("No endpoint found for URI: " + defaultEndpoint);
} else {
template = new DefaultFluentProducerTemplate(context);
template.setDefaultEndpoint(endpoint);
}
} else {
template = new DefaultFluentProducerTemplate(context);
}
// set custom cache size if provided
if (maximumCacheSize != null) {
template.setMaximumCacheSize(maximumCacheSize);
}
// must start it so its ready to use
ServiceHelper.startService(template);
return template;
}
@Override
public Class<DefaultFluentProducerTemplate> getObjectType() {
return DefaultFluentProducerTemplate.class;
}
@Override
public void destroy() throws Exception {
ServiceHelper.stopService(template);
}
// Properties
// -------------------------------------------------------------------------
public String getDefaultEndpoint() {
return defaultEndpoint;
}
/**
* Sets the default endpoint URI used by default for sending message exchanges
*/
public void setDefaultEndpoint(String defaultEndpoint) {
this.defaultEndpoint = defaultEndpoint;
}
public Integer getMaximumCacheSize() {
return maximumCacheSize;
}
/**
* Sets a custom maximum cache size to use in the backing cache pools.
*
* @param maximumCacheSize the custom maximum cache size
*/
public void setMaximumCacheSize(Integer maximumCacheSize) {
this.maximumCacheSize = maximumCacheSize;
}
}
|
AbstractCamelFluentProducerTemplateFactoryBean
|
java
|
mapstruct__mapstruct
|
processor/src/test/java/org/mapstruct/ap/test/generics/genericsupertype/MapperBase.java
|
{
"start": 256,
"end": 342
}
|
class ____<S, T> {
public abstract VesselDto vesselToDto(Vessel vessel);
}
|
MapperBase
|
java
|
quarkusio__quarkus
|
extensions/micrometer/deployment/src/test/java/io/quarkus/micrometer/deployment/binder/HttpTagExplosionPreventionTest.java
|
{
"start": 545,
"end": 4106
}
|
class ____ {
@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.withConfigurationResource("test-logging.properties")
.overrideConfigKey("quarkus.micrometer.binder-enabled-default", "false")
.overrideConfigKey("quarkus.micrometer.binder.http-client.enabled", "true")
.overrideConfigKey("quarkus.micrometer.binder.http-server.enabled", "true")
.overrideConfigKey("quarkus.micrometer.binder.vertx.enabled", "true")
.overrideConfigKey("pingpong/mp-rest/url", "${test.url}")
.overrideConfigKey("quarkus.redis.devservices.enabled", "false")
.overrideConfigKey("quarkus.micrometer.binder.http-server.suppress4xx-errors", "true")
.withApplicationRoot((jar) -> jar
.addClasses(Util.class,
Resource.class));
@Inject
MeterRegistry registry;
@Test
public void test() throws Exception {
RestAssured.get("/api/hello").then().statusCode(200);
Util.waitForMeters(registry.find("http.server.requests").timers(), 1);
Assertions.assertEquals(1, registry.find("http.server.requests").tag("uri", "/api/hello").timers().size());
RestAssured.get("/api/hello/foo").then().statusCode(200);
Util.waitForMeters(registry.find("http.server.requests").timers(), 2);
Assertions.assertEquals(1, registry.find("http.server.requests").tag("uri", "/api/hello/{message}").timers().size());
RestAssured.delete("/api/hello").then().statusCode(405);
Util.waitForMeters(registry.find("http.server.requests").timers(), 3);
Assertions.assertEquals(1, registry.find("http.server.requests").tag("uri", "UNKNOWN").timers().size());
RestAssured.delete("/api/hello/foo").then().statusCode(405);
RestAssured.delete("/api/hello/bar").then().statusCode(405);
RestAssured.delete("/api/hello/baz").then().statusCode(405);
Util.waitForMeters(registry.find("http.server.requests").timers(), 6);
Assertions.assertEquals(4,
registry.find("http.server.requests").tag("uri", "UNKNOWN").timers().iterator().next().count());
for (int i = 0; i < 10; i++) {
RestAssured.get("/api/failure").then().statusCode(500);
RestAssured.get("/api/failure/bar" + i).then().statusCode(500);
}
Util.waitForMeters(registry.find("http.server.requests").timers(), 6 + 10);
Assertions.assertEquals(2, registry.find("http.server.requests").tag("uri", "UNKNOWN").timers().size()); // 2 different set of tags
Assertions.assertEquals(1, registry.find("http.server.requests").tag("uri", "/api/failure/{message}").timers().size());
RestAssured.get("/api/not-there").then().statusCode(404);
Util.waitForMeters(registry.find("http.server.requests").timers(), 17);
Assertions.assertEquals(1, registry.find("http.server.requests").tag("uri", "NOT_FOUND").timers().size());
RestAssured.get("/api/not-there/").then().statusCode(404);
Util.waitForMeters(registry.find("http.server.requests").timers(), 18);
// no other uri tags and count should be 2
Assertions.assertEquals(1, registry.find("http.server.requests").tag("uri", "NOT_FOUND").timers().size());
Assertions.assertEquals(2,
registry.find("http.server.requests").tag("uri", "NOT_FOUND").timers().iterator().next().count());
}
@Path("/")
@Singleton
public static
|
HttpTagExplosionPreventionTest
|
java
|
apache__camel
|
components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaSpringMinaEndpointUDPTest.java
|
{
"start": 1146,
"end": 1793
}
|
class ____ extends CamelSpringTestSupport {
private static final String LS = System.lineSeparator();
@Test
public void testMinaSpringEndpoint() throws Exception {
MockEndpoint result = getMockEndpoint("mock:result");
result.expectedMessageCount(1);
template.sendBody("myMinaEndpoint", "Hello World" + LS);
MockEndpoint.assertIsSatisfied(context);
}
@Override
protected ClassPathXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/component/mina/SpringMinaEndpointUDPTest-context.xml");
}
}
|
MinaSpringMinaEndpointUDPTest
|
java
|
junit-team__junit5
|
jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterTestExecutionCallbackTests.java
|
{
"start": 11028,
"end": 11350
}
|
class ____ {
@BeforeEach
void beforeEach() {
callSequence.add("beforeEachMethodOuter");
}
@Test
void testOuter() {
callSequence.add("testOuter");
}
@AfterEach
void afterEach() {
callSequence.add("afterEachMethodOuter");
}
@Nested
@ExtendWith(FizzTestExecutionCallbacks.class)
|
OuterTestCase
|
java
|
apache__dubbo
|
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
|
{
"start": 8969,
"end": 9479
}
|
interface ____.
* If it is a multiple-values, the content will be a comma-delimited String.
*
* @return non-null
* @see RegistryConstants#SUBSCRIBED_SERVICE_NAMES_KEY
* @since 2.7.8
*/
@Deprecated
@Parameter(key = SUBSCRIBED_SERVICE_NAMES_KEY)
public String getServices() {
return services;
}
/**
* It's an alias method for {@link #getServices()}, but the more convenient.
*
* @return the String {@link List} presenting the Dubbo
|
subscribed
|
java
|
quarkusio__quarkus
|
extensions/redis-client/runtime/src/test/java/io/quarkus/redis/generator/ClassGeneratorHelper.java
|
{
"start": 612,
"end": 3594
}
|
class ____ {
private ClassGeneratorHelper() {
// Avoid direct instantiation
}
public static Type getUniOfVoid() {
JavaParser parser = new JavaParser();
return parser.parseClassOrInterfaceType("Uni<Void>").getResult().get();
}
public static Type getUniOfResponse() {
JavaParser parser = new JavaParser();
return parser.parseClassOrInterfaceType("Uni<Response>").getResult().get();
}
public static void copyClassJavadocAndAppendContent(ClassOrInterfaceDeclaration api,
ClassOrInterfaceDeclaration blockingTxApi, String append) {
JavadocComment copy = api.getJavadocComment().orElseThrow().clone();
Javadoc javadoc = copy.parse();
JavadocDescription description = javadoc.getDescription();
if (append != null) {
String newJavadocDescription = javadoc.getDescription().toText() + "\n" + append + "\n";
description = JavadocDescription.parseText(newJavadocDescription);
}
Javadoc updatedJavadoc = new Javadoc(description);
updatedJavadoc.getBlockTags().addAll(javadoc.getBlockTags());
blockingTxApi.setJavadocComment(updatedJavadoc);
}
public static void copyImportsExceptUni(CompilationUnit unit, CompilationUnit cu) {
for (ImportDeclaration is : unit.getImports()) {
if (!is.toString().contains(Uni.class.getName())) {
cu.addImport(is);
}
}
}
public static void copyImports(CompilationUnit unit, CompilationUnit cu) {
cu.setImports(unit.getImports());
}
public static void setPackage(CompilationUnit unit, CompilationUnit cu) {
cu.setPackageDeclaration(unit.getPackageDeclaration().orElseThrow());
}
public static Type getBlockingType(Type type) {
ClassOrInterfaceType asClass = type.asClassOrInterfaceType();
Type param = asClass.getTypeArguments().orElseThrow().get(0);
if (param.asString().equals(Void.class.getSimpleName())) {
return new VoidType();
}
if (param.isClassOrInterfaceType()) {
if (param.asClassOrInterfaceType().isBoxedType()) {
return param.asClassOrInterfaceType().toUnboxedType();
}
}
return param;
}
public static boolean isReturningUniOfVoid(Type type) {
if (!type.isClassOrInterfaceType()) {
return false;
}
ClassOrInterfaceType r = type.asClassOrInterfaceType();
if (!r.getName().asString().equals(Uni.class.getSimpleName())) {
return false;
}
if (r.getTypeArguments().isEmpty()) {
return false;
}
if (r.getTypeArguments().get().size() != 1) {
return false;
}
Type param = r.getTypeArguments().get().get(0);
return param.asClassOrInterfaceType().getName().asString().equals(Void.class.getSimpleName());
}
}
|
ClassGeneratorHelper
|
java
|
google__error-prone
|
core/src/test/java/com/google/errorprone/bugpatterns/MissingFailTest.java
|
{
"start": 18066,
"end": 18154
}
|
class ____ {
void log() {}
;
void info() {}
;
}
private static
|
Logger
|
java
|
elastic__elasticsearch
|
server/src/test/java/org/elasticsearch/rest/RestControllerTests.java
|
{
"start": 64447,
"end": 65286
}
|
class ____ extends AbstractRestChannel {
private final RestStatus expectedStatus;
private final AtomicReference<RestResponse> responseReference = new AtomicReference<>();
public AssertingChannel(RestRequest request, boolean detailedErrorsEnabled, RestStatus expectedStatus) {
super(request, detailedErrorsEnabled);
this.expectedStatus = expectedStatus;
}
@Override
public void sendResponse(RestResponse response) {
assertEquals(expectedStatus, response.status());
responseReference.set(response);
}
RestResponse getRestResponse() {
return responseReference.get();
}
boolean getSendResponseCalled() {
return getRestResponse() != null;
}
}
private static
|
AssertingChannel
|
java
|
apache__flink
|
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/sink/TestSinkV2.java
|
{
"start": 15103,
"end": 15793
}
|
class ____<T> implements SimpleVersionedSerializer<Record<T>> {
@Override
public int getVersion() {
return 0;
}
@Override
public byte[] serialize(Record<T> record) throws IOException {
return InstantiationUtil.serializeObject(record);
}
@Override
public Record<T> deserialize(int version, byte[] serialized) throws IOException {
try {
return InstantiationUtil.deserializeObject(serialized, getClass().getClassLoader());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
}
/** Base
|
RecordSerializer
|
java
|
playframework__playframework
|
documentation/manual/working/javaGuide/advanced/routing/code/javaguide/binder/controllers/BinderApplication.java
|
{
"start": 333,
"end": 583
}
|
class ____ extends Controller {
// #path
public Result user(User user) {
return ok(user.name);
}
// #path
// #query
public Result age(AgeRange ageRange) {
return ok(String.valueOf(ageRange.from));
}
// #query
}
|
BinderApplication
|
java
|
elastic__elasticsearch
|
x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/SqlBaseLexer.java
|
{
"start": 404,
"end": 74164
}
|
class ____ extends Lexer {
static {
RuntimeMetaData.checkVersion("4.13.1", RuntimeMetaData.VERSION);
}
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache();
public static final int T__0 = 1, T__1 = 2, T__2 = 3, T__3 = 4, ALL = 5, ANALYZE = 6, ANALYZED = 7, AND = 8, ANY = 9, AS = 10, ASC = 11,
BETWEEN = 12, BY = 13, CASE = 14, CAST = 15, CATALOG = 16, CATALOGS = 17, COLUMNS = 18, CONVERT = 19, CURRENT_DATE = 20,
CURRENT_TIME = 21, CURRENT_TIMESTAMP = 22, DAY = 23, DAYS = 24, DEBUG = 25, DESC = 26, DESCRIBE = 27, DISTINCT = 28, ELSE = 29,
END = 30, ESCAPE = 31, EXECUTABLE = 32, EXISTS = 33, EXPLAIN = 34, EXTRACT = 35, FALSE = 36, FIRST = 37, FOR = 38, FORMAT = 39,
FROM = 40, FROZEN = 41, FULL = 42, FUNCTIONS = 43, GRAPHVIZ = 44, GROUP = 45, HAVING = 46, HOUR = 47, HOURS = 48, IN = 49, INCLUDE =
50, INNER = 51, INTERVAL = 52, IS = 53, JOIN = 54, LAST = 55, LEFT = 56, LIKE = 57, LIMIT = 58, MAPPED = 59, MATCH = 60,
MINUTE = 61, MINUTES = 62, MONTH = 63, MONTHS = 64, NATURAL = 65, NOT = 66, NULL = 67, NULLS = 68, ON = 69, OPTIMIZED = 70, OR = 71,
ORDER = 72, OUTER = 73, PARSED = 74, PHYSICAL = 75, PIVOT = 76, PLAN = 77, RIGHT = 78, RLIKE = 79, QUERY = 80, SCHEMAS = 81,
SECOND = 82, SECONDS = 83, SELECT = 84, SHOW = 85, SYS = 86, TABLE = 87, TABLES = 88, TEXT = 89, THEN = 90, TRUE = 91, TO = 92,
TOP = 93, TYPE = 94, TYPES = 95, USING = 96, VERIFY = 97, WHEN = 98, WHERE = 99, WITH = 100, YEAR = 101, YEARS = 102, ESCAPE_ESC =
103, FUNCTION_ESC = 104, LIMIT_ESC = 105, DATE_ESC = 106, TIME_ESC = 107, TIMESTAMP_ESC = 108, GUID_ESC = 109, ESC_START = 110,
ESC_END = 111, EQ = 112, NULLEQ = 113, NEQ = 114, LT = 115, LTE = 116, GT = 117, GTE = 118, PLUS = 119, MINUS = 120, ASTERISK = 121,
SLASH = 122, PERCENT = 123, CAST_OP = 124, DOT = 125, PARAM = 126, STRING = 127, INTEGER_VALUE = 128, DECIMAL_VALUE = 129,
IDENTIFIER = 130, DIGIT_IDENTIFIER = 131, TABLE_IDENTIFIER = 132, QUOTED_IDENTIFIER = 133, BACKQUOTED_IDENTIFIER = 134,
SIMPLE_COMMENT = 135, BRACKETED_COMMENT = 136, WS = 137, UNRECOGNIZED = 138;
public static String[] channelNames = { "DEFAULT_TOKEN_CHANNEL", "HIDDEN" };
public static String[] modeNames = { "DEFAULT_MODE" };
private static String[] makeRuleNames() {
return new String[] {
"T__0",
"T__1",
"T__2",
"T__3",
"ALL",
"ANALYZE",
"ANALYZED",
"AND",
"ANY",
"AS",
"ASC",
"BETWEEN",
"BY",
"CASE",
"CAST",
"CATALOG",
"CATALOGS",
"COLUMNS",
"CONVERT",
"CURRENT_DATE",
"CURRENT_TIME",
"CURRENT_TIMESTAMP",
"DAY",
"DAYS",
"DEBUG",
"DESC",
"DESCRIBE",
"DISTINCT",
"ELSE",
"END",
"ESCAPE",
"EXECUTABLE",
"EXISTS",
"EXPLAIN",
"EXTRACT",
"FALSE",
"FIRST",
"FOR",
"FORMAT",
"FROM",
"FROZEN",
"FULL",
"FUNCTIONS",
"GRAPHVIZ",
"GROUP",
"HAVING",
"HOUR",
"HOURS",
"IN",
"INCLUDE",
"INNER",
"INTERVAL",
"IS",
"JOIN",
"LAST",
"LEFT",
"LIKE",
"LIMIT",
"MAPPED",
"MATCH",
"MINUTE",
"MINUTES",
"MONTH",
"MONTHS",
"NATURAL",
"NOT",
"NULL",
"NULLS",
"ON",
"OPTIMIZED",
"OR",
"ORDER",
"OUTER",
"PARSED",
"PHYSICAL",
"PIVOT",
"PLAN",
"RIGHT",
"RLIKE",
"QUERY",
"SCHEMAS",
"SECOND",
"SECONDS",
"SELECT",
"SHOW",
"SYS",
"TABLE",
"TABLES",
"TEXT",
"THEN",
"TRUE",
"TO",
"TOP",
"TYPE",
"TYPES",
"USING",
"VERIFY",
"WHEN",
"WHERE",
"WITH",
"YEAR",
"YEARS",
"ESCAPE_ESC",
"FUNCTION_ESC",
"LIMIT_ESC",
"DATE_ESC",
"TIME_ESC",
"TIMESTAMP_ESC",
"GUID_ESC",
"ESC_START",
"ESC_END",
"EQ",
"NULLEQ",
"NEQ",
"LT",
"LTE",
"GT",
"GTE",
"PLUS",
"MINUS",
"ASTERISK",
"SLASH",
"PERCENT",
"CAST_OP",
"DOT",
"PARAM",
"STRING",
"INTEGER_VALUE",
"DECIMAL_VALUE",
"IDENTIFIER",
"DIGIT_IDENTIFIER",
"TABLE_IDENTIFIER",
"QUOTED_IDENTIFIER",
"BACKQUOTED_IDENTIFIER",
"EXPONENT",
"DIGIT",
"LETTER",
"SIMPLE_COMMENT",
"BRACKETED_COMMENT",
"WS",
"UNRECOGNIZED" };
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
null,
"'('",
"')'",
"','",
"':'",
"'ALL'",
"'ANALYZE'",
"'ANALYZED'",
"'AND'",
"'ANY'",
"'AS'",
"'ASC'",
"'BETWEEN'",
"'BY'",
"'CASE'",
"'CAST'",
"'CATALOG'",
"'CATALOGS'",
"'COLUMNS'",
"'CONVERT'",
"'CURRENT_DATE'",
"'CURRENT_TIME'",
"'CURRENT_TIMESTAMP'",
"'DAY'",
"'DAYS'",
"'DEBUG'",
"'DESC'",
"'DESCRIBE'",
"'DISTINCT'",
"'ELSE'",
"'END'",
"'ESCAPE'",
"'EXECUTABLE'",
"'EXISTS'",
"'EXPLAIN'",
"'EXTRACT'",
"'FALSE'",
"'FIRST'",
"'FOR'",
"'FORMAT'",
"'FROM'",
"'FROZEN'",
"'FULL'",
"'FUNCTIONS'",
"'GRAPHVIZ'",
"'GROUP'",
"'HAVING'",
"'HOUR'",
"'HOURS'",
"'IN'",
"'INCLUDE'",
"'INNER'",
"'INTERVAL'",
"'IS'",
"'JOIN'",
"'LAST'",
"'LEFT'",
"'LIKE'",
"'LIMIT'",
"'MAPPED'",
"'MATCH'",
"'MINUTE'",
"'MINUTES'",
"'MONTH'",
"'MONTHS'",
"'NATURAL'",
"'NOT'",
"'NULL'",
"'NULLS'",
"'ON'",
"'OPTIMIZED'",
"'OR'",
"'ORDER'",
"'OUTER'",
"'PARSED'",
"'PHYSICAL'",
"'PIVOT'",
"'PLAN'",
"'RIGHT'",
"'RLIKE'",
"'QUERY'",
"'SCHEMAS'",
"'SECOND'",
"'SECONDS'",
"'SELECT'",
"'SHOW'",
"'SYS'",
"'TABLE'",
"'TABLES'",
"'TEXT'",
"'THEN'",
"'TRUE'",
"'TO'",
"'TOP'",
"'TYPE'",
"'TYPES'",
"'USING'",
"'VERIFY'",
"'WHEN'",
"'WHERE'",
"'WITH'",
"'YEAR'",
"'YEARS'",
null,
null,
null,
null,
null,
null,
null,
null,
"'}'",
"'='",
"'<=>'",
null,
"'<'",
"'<='",
"'>'",
"'>='",
"'+'",
"'-'",
"'*'",
"'/'",
"'%'",
"'::'",
"'.'",
"'?'" };
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
null,
null,
null,
null,
null,
"ALL",
"ANALYZE",
"ANALYZED",
"AND",
"ANY",
"AS",
"ASC",
"BETWEEN",
"BY",
"CASE",
"CAST",
"CATALOG",
"CATALOGS",
"COLUMNS",
"CONVERT",
"CURRENT_DATE",
"CURRENT_TIME",
"CURRENT_TIMESTAMP",
"DAY",
"DAYS",
"DEBUG",
"DESC",
"DESCRIBE",
"DISTINCT",
"ELSE",
"END",
"ESCAPE",
"EXECUTABLE",
"EXISTS",
"EXPLAIN",
"EXTRACT",
"FALSE",
"FIRST",
"FOR",
"FORMAT",
"FROM",
"FROZEN",
"FULL",
"FUNCTIONS",
"GRAPHVIZ",
"GROUP",
"HAVING",
"HOUR",
"HOURS",
"IN",
"INCLUDE",
"INNER",
"INTERVAL",
"IS",
"JOIN",
"LAST",
"LEFT",
"LIKE",
"LIMIT",
"MAPPED",
"MATCH",
"MINUTE",
"MINUTES",
"MONTH",
"MONTHS",
"NATURAL",
"NOT",
"NULL",
"NULLS",
"ON",
"OPTIMIZED",
"OR",
"ORDER",
"OUTER",
"PARSED",
"PHYSICAL",
"PIVOT",
"PLAN",
"RIGHT",
"RLIKE",
"QUERY",
"SCHEMAS",
"SECOND",
"SECONDS",
"SELECT",
"SHOW",
"SYS",
"TABLE",
"TABLES",
"TEXT",
"THEN",
"TRUE",
"TO",
"TOP",
"TYPE",
"TYPES",
"USING",
"VERIFY",
"WHEN",
"WHERE",
"WITH",
"YEAR",
"YEARS",
"ESCAPE_ESC",
"FUNCTION_ESC",
"LIMIT_ESC",
"DATE_ESC",
"TIME_ESC",
"TIMESTAMP_ESC",
"GUID_ESC",
"ESC_START",
"ESC_END",
"EQ",
"NULLEQ",
"NEQ",
"LT",
"LTE",
"GT",
"GTE",
"PLUS",
"MINUS",
"ASTERISK",
"SLASH",
"PERCENT",
"CAST_OP",
"DOT",
"PARAM",
"STRING",
"INTEGER_VALUE",
"DECIMAL_VALUE",
"IDENTIFIER",
"DIGIT_IDENTIFIER",
"TABLE_IDENTIFIER",
"QUOTED_IDENTIFIER",
"BACKQUOTED_IDENTIFIER",
"SIMPLE_COMMENT",
"BRACKETED_COMMENT",
"WS",
"UNRECOGNIZED" };
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
public SqlBaseLexer(CharStream input) {
super(input);
_interp = new LexerATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache);
}
@Override
public String getGrammarFileName() {
return "SqlBase.g4";
}
@Override
public String[] getRuleNames() {
return ruleNames;
}
@Override
public String getSerializedATN() {
return _serializedATN;
}
@Override
public String[] getChannelNames() {
return channelNames;
}
@Override
public String[] getModeNames() {
return modeNames;
}
@Override
public ATN getATN() {
return _ATN;
}
public static final String _serializedATN = "\u0004\u0000\u008a\u0487\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002"
+ "\u0001\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002"
+ "\u0004\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002"
+ "\u0007\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002"
+ "\u000b\u0007\u000b\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e"
+ "\u0002\u000f\u0007\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011"
+ "\u0002\u0012\u0007\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014"
+ "\u0002\u0015\u0007\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017"
+ "\u0002\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a"
+ "\u0002\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d"
+ "\u0002\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!"
+ "\u0007!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0002%\u0007%\u0002"
+ "&\u0007&\u0002\'\u0007\'\u0002(\u0007(\u0002)\u0007)\u0002*\u0007*\u0002"
+ "+\u0007+\u0002,\u0007,\u0002-\u0007-\u0002.\u0007.\u0002/\u0007/\u0002"
+ "0\u00070\u00021\u00071\u00022\u00072\u00023\u00073\u00024\u00074\u0002"
+ "5\u00075\u00026\u00076\u00027\u00077\u00028\u00078\u00029\u00079\u0002"
+ ":\u0007:\u0002;\u0007;\u0002<\u0007<\u0002=\u0007=\u0002>\u0007>\u0002"
+ "?\u0007?\u0002@\u0007@\u0002A\u0007A\u0002B\u0007B\u0002C\u0007C\u0002"
+ "D\u0007D\u0002E\u0007E\u0002F\u0007F\u0002G\u0007G\u0002H\u0007H\u0002"
+ "I\u0007I\u0002J\u0007J\u0002K\u0007K\u0002L\u0007L\u0002M\u0007M\u0002"
+ "N\u0007N\u0002O\u0007O\u0002P\u0007P\u0002Q\u0007Q\u0002R\u0007R\u0002"
+ "S\u0007S\u0002T\u0007T\u0002U\u0007U\u0002V\u0007V\u0002W\u0007W\u0002"
+ "X\u0007X\u0002Y\u0007Y\u0002Z\u0007Z\u0002[\u0007[\u0002\\\u0007\\\u0002"
+ "]\u0007]\u0002^\u0007^\u0002_\u0007_\u0002`\u0007`\u0002a\u0007a\u0002"
+ "b\u0007b\u0002c\u0007c\u0002d\u0007d\u0002e\u0007e\u0002f\u0007f\u0002"
+ "g\u0007g\u0002h\u0007h\u0002i\u0007i\u0002j\u0007j\u0002k\u0007k\u0002"
+ "l\u0007l\u0002m\u0007m\u0002n\u0007n\u0002o\u0007o\u0002p\u0007p\u0002"
+ "q\u0007q\u0002r\u0007r\u0002s\u0007s\u0002t\u0007t\u0002u\u0007u\u0002"
+ "v\u0007v\u0002w\u0007w\u0002x\u0007x\u0002y\u0007y\u0002z\u0007z\u0002"
+ "{\u0007{\u0002|\u0007|\u0002}\u0007}\u0002~\u0007~\u0002\u007f\u0007\u007f"
+ "\u0002\u0080\u0007\u0080\u0002\u0081\u0007\u0081\u0002\u0082\u0007\u0082"
+ "\u0002\u0083\u0007\u0083\u0002\u0084\u0007\u0084\u0002\u0085\u0007\u0085"
+ "\u0002\u0086\u0007\u0086\u0002\u0087\u0007\u0087\u0002\u0088\u0007\u0088"
+ "\u0002\u0089\u0007\u0089\u0002\u008a\u0007\u008a\u0002\u008b\u0007\u008b"
+ "\u0002\u008c\u0007\u008c\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001"
+ "\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004"
+ "\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005"
+ "\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006"
+ "\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"
+ "\u0001\u0006\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\b\u0001"
+ "\b\u0001\b\u0001\b\u0001\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001\n\u0001"
+ "\n\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b"
+ "\u0001\u000b\u0001\u000b\u0001\f\u0001\f\u0001\f\u0001\r\u0001\r\u0001"
+ "\r\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001"
+ "\u000e\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001"
+ "\u000f\u0001\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0010\u0001"
+ "\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001"
+ "\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001"
+ "\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001"
+ "\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0013\u0001\u0013\u0001"
+ "\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001"
+ "\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0014\u0001"
+ "\u0014\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0014\u0001"
+ "\u0014\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0014\u0001"
+ "\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001"
+ "\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001"
+ "\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001"
+ "\u0016\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017\u0001"
+ "\u0017\u0001\u0017\u0001\u0017\u0001\u0018\u0001\u0018\u0001\u0018\u0001"
+ "\u0018\u0001\u0018\u0001\u0018\u0001\u0019\u0001\u0019\u0001\u0019\u0001"
+ "\u0019\u0001\u0019\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0001"
+ "\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001b\u0001"
+ "\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001"
+ "\u001b\u0001\u001b\u0001\u001c\u0001\u001c\u0001\u001c\u0001\u001c\u0001"
+ "\u001c\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001e\u0001"
+ "\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001"
+ "\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001"
+ "\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001 \u0001 \u0001"
+ " \u0001 \u0001 \u0001 \u0001 \u0001!\u0001!\u0001!\u0001!\u0001!\u0001"
+ "!\u0001!\u0001!\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001"
+ "\"\u0001\"\u0001#\u0001#\u0001#\u0001#\u0001#\u0001#\u0001$\u0001$\u0001"
+ "$\u0001$\u0001$\u0001$\u0001%\u0001%\u0001%\u0001%\u0001&\u0001&\u0001"
+ "&\u0001&\u0001&\u0001&\u0001&\u0001\'\u0001\'\u0001\'\u0001\'\u0001\'"
+ "\u0001(\u0001(\u0001(\u0001(\u0001(\u0001(\u0001(\u0001)\u0001)\u0001"
+ ")\u0001)\u0001)\u0001*\u0001*\u0001*\u0001*\u0001*\u0001*\u0001*\u0001"
+ "*\u0001*\u0001*\u0001+\u0001+\u0001+\u0001+\u0001+\u0001+\u0001+\u0001"
+ "+\u0001+\u0001,\u0001,\u0001,\u0001,\u0001,\u0001,\u0001-\u0001-\u0001"
+ "-\u0001-\u0001-\u0001-\u0001-\u0001.\u0001.\u0001.\u0001.\u0001.\u0001"
+ "/\u0001/\u0001/\u0001/\u0001/\u0001/\u00010\u00010\u00010\u00011\u0001"
+ "1\u00011\u00011\u00011\u00011\u00011\u00011\u00012\u00012\u00012\u0001"
+ "2\u00012\u00012\u00013\u00013\u00013\u00013\u00013\u00013\u00013\u0001"
+ "3\u00013\u00014\u00014\u00014\u00015\u00015\u00015\u00015\u00015\u0001"
+ "6\u00016\u00016\u00016\u00016\u00017\u00017\u00017\u00017\u00017\u0001"
+ "8\u00018\u00018\u00018\u00018\u00019\u00019\u00019\u00019\u00019\u0001"
+ "9\u0001:\u0001:\u0001:\u0001:\u0001:\u0001:\u0001:\u0001;\u0001;\u0001"
+ ";\u0001;\u0001;\u0001;\u0001<\u0001<\u0001<\u0001<\u0001<\u0001<\u0001"
+ "<\u0001=\u0001=\u0001=\u0001=\u0001=\u0001=\u0001=\u0001=\u0001>\u0001"
+ ">\u0001>\u0001>\u0001>\u0001>\u0001?\u0001?\u0001?\u0001?\u0001?\u0001"
+ "?\u0001?\u0001@\u0001@\u0001@\u0001@\u0001@\u0001@\u0001@\u0001@\u0001"
+ "A\u0001A\u0001A\u0001A\u0001B\u0001B\u0001B\u0001B\u0001B\u0001C\u0001"
+ "C\u0001C\u0001C\u0001C\u0001C\u0001D\u0001D\u0001D\u0001E\u0001E\u0001"
+ "E\u0001E\u0001E\u0001E\u0001E\u0001E\u0001E\u0001E\u0001F\u0001F\u0001"
+ "F\u0001G\u0001G\u0001G\u0001G\u0001G\u0001G\u0001H\u0001H\u0001H\u0001"
+ "H\u0001H\u0001H\u0001I\u0001I\u0001I\u0001I\u0001I\u0001I\u0001I\u0001"
+ "J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001J\u0001K\u0001"
+ "K\u0001K\u0001K\u0001K\u0001K\u0001L\u0001L\u0001L\u0001L\u0001L\u0001"
+ "M\u0001M\u0001M\u0001M\u0001M\u0001M\u0001N\u0001N\u0001N\u0001N\u0001"
+ "N\u0001N\u0001O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001P\u0001P\u0001"
+ "P\u0001P\u0001P\u0001P\u0001P\u0001P\u0001Q\u0001Q\u0001Q\u0001Q\u0001"
+ "Q\u0001Q\u0001Q\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001R\u0001"
+ "R\u0001S\u0001S\u0001S\u0001S\u0001S\u0001S\u0001S\u0001T\u0001T\u0001"
+ "T\u0001T\u0001T\u0001U\u0001U\u0001U\u0001U\u0001V\u0001V\u0001V\u0001"
+ "V\u0001V\u0001V\u0001W\u0001W\u0001W\u0001W\u0001W\u0001W\u0001W\u0001"
+ "X\u0001X\u0001X\u0001X\u0001X\u0001Y\u0001Y\u0001Y\u0001Y\u0001Y\u0001"
+ "Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001[\u0001[\u0001[\u0001\\\u0001\\\u0001"
+ "\\\u0001\\\u0001]\u0001]\u0001]\u0001]\u0001]\u0001^\u0001^\u0001^\u0001"
+ "^\u0001^\u0001^\u0001_\u0001_\u0001_\u0001_\u0001_\u0001_\u0001`\u0001"
+ "`\u0001`\u0001`\u0001`\u0001`\u0001`\u0001a\u0001a\u0001a\u0001a\u0001"
+ "a\u0001b\u0001b\u0001b\u0001b\u0001b\u0001b\u0001c\u0001c\u0001c\u0001"
+ "c\u0001c\u0001d\u0001d\u0001d\u0001d\u0001d\u0001e\u0001e\u0001e\u0001"
+ "e\u0001e\u0001e\u0001f\u0001f\u0001f\u0001f\u0001f\u0001f\u0001f\u0001"
+ "f\u0001g\u0001g\u0001g\u0001g\u0001h\u0001h\u0001h\u0001h\u0001h\u0001"
+ "h\u0001h\u0001i\u0001i\u0001i\u0001j\u0001j\u0001j\u0001k\u0001k\u0001"
+ "k\u0001k\u0001l\u0001l\u0001l\u0001l\u0001l\u0001l\u0001m\u0001m\u0005"
+ "m\u03b7\bm\nm\fm\u03ba\tm\u0001n\u0001n\u0001o\u0001o\u0001p\u0001p\u0001"
+ "p\u0001p\u0001q\u0001q\u0001q\u0001q\u0003q\u03c8\bq\u0001r\u0001r\u0001"
+ "s\u0001s\u0001s\u0001t\u0001t\u0001u\u0001u\u0001u\u0001v\u0001v\u0001"
+ "w\u0001w\u0001x\u0001x\u0001y\u0001y\u0001z\u0001z\u0001{\u0001{\u0001"
+ "{\u0001|\u0001|\u0001}\u0001}\u0001~\u0001~\u0001~\u0001~\u0005~\u03e9"
+ "\b~\n~\f~\u03ec\t~\u0001~\u0001~\u0001\u007f\u0004\u007f\u03f1\b\u007f"
+ "\u000b\u007f\f\u007f\u03f2\u0001\u0080\u0004\u0080\u03f6\b\u0080\u000b"
+ "\u0080\f\u0080\u03f7\u0001\u0080\u0001\u0080\u0005\u0080\u03fc\b\u0080"
+ "\n\u0080\f\u0080\u03ff\t\u0080\u0001\u0080\u0001\u0080\u0004\u0080\u0403"
+ "\b\u0080\u000b\u0080\f\u0080\u0404\u0001\u0080\u0004\u0080\u0408\b\u0080"
+ "\u000b\u0080\f\u0080\u0409\u0001\u0080\u0001\u0080\u0005\u0080\u040e\b"
+ "\u0080\n\u0080\f\u0080\u0411\t\u0080\u0003\u0080\u0413\b\u0080\u0001\u0080"
+ "\u0001\u0080\u0001\u0080\u0001\u0080\u0004\u0080\u0419\b\u0080\u000b\u0080"
+ "\f\u0080\u041a\u0001\u0080\u0001\u0080\u0003\u0080\u041f\b\u0080\u0001"
+ "\u0081\u0001\u0081\u0003\u0081\u0423\b\u0081\u0001\u0081\u0001\u0081\u0001"
+ "\u0081\u0005\u0081\u0428\b\u0081\n\u0081\f\u0081\u042b\t\u0081\u0001\u0082"
+ "\u0001\u0082\u0001\u0082\u0001\u0082\u0004\u0082\u0431\b\u0082\u000b\u0082"
+ "\f\u0082\u0432\u0001\u0083\u0001\u0083\u0001\u0083\u0004\u0083\u0438\b"
+ "\u0083\u000b\u0083\f\u0083\u0439\u0001\u0084\u0001\u0084\u0001\u0084\u0001"
+ "\u0084\u0005\u0084\u0440\b\u0084\n\u0084\f\u0084\u0443\t\u0084\u0001\u0084"
+ "\u0001\u0084\u0001\u0085\u0001\u0085\u0001\u0085\u0001\u0085\u0005\u0085"
+ "\u044b\b\u0085\n\u0085\f\u0085\u044e\t\u0085\u0001\u0085\u0001\u0085\u0001"
+ "\u0086\u0001\u0086\u0003\u0086\u0454\b\u0086\u0001\u0086\u0004\u0086\u0457"
+ "\b\u0086\u000b\u0086\f\u0086\u0458\u0001\u0087\u0001\u0087\u0001\u0088"
+ "\u0001\u0088\u0001\u0089\u0001\u0089\u0001\u0089\u0001\u0089\u0005\u0089"
+ "\u0463\b\u0089\n\u0089\f\u0089\u0466\t\u0089\u0001\u0089\u0003\u0089\u0469"
+ "\b\u0089\u0001\u0089\u0003\u0089\u046c\b\u0089\u0001\u0089\u0001\u0089"
+ "\u0001\u008a\u0001\u008a\u0001\u008a\u0001\u008a\u0001\u008a\u0005\u008a"
+ "\u0475\b\u008a\n\u008a\f\u008a\u0478\t\u008a\u0001\u008a\u0001\u008a\u0001"
+ "\u008a\u0001\u008a\u0001\u008a\u0001\u008b\u0004\u008b\u0480\b\u008b\u000b"
+ "\u008b\f\u008b\u0481\u0001\u008b\u0001\u008b\u0001\u008c\u0001\u008c\u0001"
+ "\u0476\u0000\u008d\u0001\u0001\u0003\u0002\u0005\u0003\u0007\u0004\t\u0005"
+ "\u000b\u0006\r\u0007\u000f\b\u0011\t\u0013\n\u0015\u000b\u0017\f\u0019"
+ "\r\u001b\u000e\u001d\u000f\u001f\u0010!\u0011#\u0012%\u0013\'\u0014)\u0015"
+ "+\u0016-\u0017/\u00181\u00193\u001a5\u001b7\u001c9\u001d;\u001e=\u001f"
+ "? A!C\"E#G$I%K&M\'O(Q)S*U+W,Y-[.]/_0a1c2e3g4i5k6m7o8q9s:u;w<y={>}?\u007f"
+ "@\u0081A\u0083B\u0085C\u0087D\u0089E\u008bF\u008dG\u008fH\u0091I\u0093"
+ "J\u0095K\u0097L\u0099M\u009bN\u009dO\u009fP\u00a1Q\u00a3R\u00a5S\u00a7"
+ "T\u00a9U\u00abV\u00adW\u00afX\u00b1Y\u00b3Z\u00b5[\u00b7\\\u00b9]\u00bb"
+ "^\u00bd_\u00bf`\u00c1a\u00c3b\u00c5c\u00c7d\u00c9e\u00cbf\u00cdg\u00cf"
+ "h\u00d1i\u00d3j\u00d5k\u00d7l\u00d9m\u00dbn\u00ddo\u00dfp\u00e1q\u00e3"
+ "r\u00e5s\u00e7t\u00e9u\u00ebv\u00edw\u00efx\u00f1y\u00f3z\u00f5{\u00f7"
+ "|\u00f9}\u00fb~\u00fd\u007f\u00ff\u0080\u0101\u0081\u0103\u0082\u0105"
+ "\u0083\u0107\u0084\u0109\u0085\u010b\u0086\u010d\u0000\u010f\u0000\u0111"
+ "\u0000\u0113\u0087\u0115\u0088\u0117\u0089\u0119\u008a\u0001\u0000\t\u0001"
+ "\u0000\'\'\u0002\u0000@@__\u0001\u0000\"\"\u0001\u0000``\u0002\u0000+"
+ "+--\u0001\u000009\u0001\u0000AZ\u0002\u0000\n\n\r\r\u0003\u0000\t\n\r"
+ "\r \u04a8\u0000\u0001\u0001\u0000\u0000\u0000\u0000\u0003\u0001\u0000"
+ "\u0000\u0000\u0000\u0005\u0001\u0000\u0000\u0000\u0000\u0007\u0001\u0000"
+ "\u0000\u0000\u0000\t\u0001\u0000\u0000\u0000\u0000\u000b\u0001\u0000\u0000"
+ "\u0000\u0000\r\u0001\u0000\u0000\u0000\u0000\u000f\u0001\u0000\u0000\u0000"
+ "\u0000\u0011\u0001\u0000\u0000\u0000\u0000\u0013\u0001\u0000\u0000\u0000"
+ "\u0000\u0015\u0001\u0000\u0000\u0000\u0000\u0017\u0001\u0000\u0000\u0000"
+ "\u0000\u0019\u0001\u0000\u0000\u0000\u0000\u001b\u0001\u0000\u0000\u0000"
+ "\u0000\u001d\u0001\u0000\u0000\u0000\u0000\u001f\u0001\u0000\u0000\u0000"
+ "\u0000!\u0001\u0000\u0000\u0000\u0000#\u0001\u0000\u0000\u0000\u0000%"
+ "\u0001\u0000\u0000\u0000\u0000\'\u0001\u0000\u0000\u0000\u0000)\u0001"
+ "\u0000\u0000\u0000\u0000+\u0001\u0000\u0000\u0000\u0000-\u0001\u0000\u0000"
+ "\u0000\u0000/\u0001\u0000\u0000\u0000\u00001\u0001\u0000\u0000\u0000\u0000"
+ "3\u0001\u0000\u0000\u0000\u00005\u0001\u0000\u0000\u0000\u00007\u0001"
+ "\u0000\u0000\u0000\u00009\u0001\u0000\u0000\u0000\u0000;\u0001\u0000\u0000"
+ "\u0000\u0000=\u0001\u0000\u0000\u0000\u0000?\u0001\u0000\u0000\u0000\u0000"
+ "A\u0001\u0000\u0000\u0000\u0000C\u0001\u0000\u0000\u0000\u0000E\u0001"
+ "\u0000\u0000\u0000\u0000G\u0001\u0000\u0000\u0000\u0000I\u0001\u0000\u0000"
+ "\u0000\u0000K\u0001\u0000\u0000\u0000\u0000M\u0001\u0000\u0000\u0000\u0000"
+ "O\u0001\u0000\u0000\u0000\u0000Q\u0001\u0000\u0000\u0000\u0000S\u0001"
+ "\u0000\u0000\u0000\u0000U\u0001\u0000\u0000\u0000\u0000W\u0001\u0000\u0000"
+ "\u0000\u0000Y\u0001\u0000\u0000\u0000\u0000[\u0001\u0000\u0000\u0000\u0000"
+ "]\u0001\u0000\u0000\u0000\u0000_\u0001\u0000\u0000\u0000\u0000a\u0001"
+ "\u0000\u0000\u0000\u0000c\u0001\u0000\u0000\u0000\u0000e\u0001\u0000\u0000"
+ "\u0000\u0000g\u0001\u0000\u0000\u0000\u0000i\u0001\u0000\u0000\u0000\u0000"
+ "k\u0001\u0000\u0000\u0000\u0000m\u0001\u0000\u0000\u0000\u0000o\u0001"
+ "\u0000\u0000\u0000\u0000q\u0001\u0000\u0000\u0000\u0000s\u0001\u0000\u0000"
+ "\u0000\u0000u\u0001\u0000\u0000\u0000\u0000w\u0001\u0000\u0000\u0000\u0000"
+ "y\u0001\u0000\u0000\u0000\u0000{\u0001\u0000\u0000\u0000\u0000}\u0001"
+ "\u0000\u0000\u0000\u0000\u007f\u0001\u0000\u0000\u0000\u0000\u0081\u0001"
+ "\u0000\u0000\u0000\u0000\u0083\u0001\u0000\u0000\u0000\u0000\u0085\u0001"
+ "\u0000\u0000\u0000\u0000\u0087\u0001\u0000\u0000\u0000\u0000\u0089\u0001"
+ "\u0000\u0000\u0000\u0000\u008b\u0001\u0000\u0000\u0000\u0000\u008d\u0001"
+ "\u0000\u0000\u0000\u0000\u008f\u0001\u0000\u0000\u0000\u0000\u0091\u0001"
+ "\u0000\u0000\u0000\u0000\u0093\u0001\u0000\u0000\u0000\u0000\u0095\u0001"
+ "\u0000\u0000\u0000\u0000\u0097\u0001\u0000\u0000\u0000\u0000\u0099\u0001"
+ "\u0000\u0000\u0000\u0000\u009b\u0001\u0000\u0000\u0000\u0000\u009d\u0001"
+ "\u0000\u0000\u0000\u0000\u009f\u0001\u0000\u0000\u0000\u0000\u00a1\u0001"
+ "\u0000\u0000\u0000\u0000\u00a3\u0001\u0000\u0000\u0000\u0000\u00a5\u0001"
+ "\u0000\u0000\u0000\u0000\u00a7\u0001\u0000\u0000\u0000\u0000\u00a9\u0001"
+ "\u0000\u0000\u0000\u0000\u00ab\u0001\u0000\u0000\u0000\u0000\u00ad\u0001"
+ "\u0000\u0000\u0000\u0000\u00af\u0001\u0000\u0000\u0000\u0000\u00b1\u0001"
+ "\u0000\u0000\u0000\u0000\u00b3\u0001\u0000\u0000\u0000\u0000\u00b5\u0001"
+ "\u0000\u0000\u0000\u0000\u00b7\u0001\u0000\u0000\u0000\u0000\u00b9\u0001"
+ "\u0000\u0000\u0000\u0000\u00bb\u0001\u0000\u0000\u0000\u0000\u00bd\u0001"
+ "\u0000\u0000\u0000\u0000\u00bf\u0001\u0000\u0000\u0000\u0000\u00c1\u0001"
+ "\u0000\u0000\u0000\u0000\u00c3\u0001\u0000\u0000\u0000\u0000\u00c5\u0001"
+ "\u0000\u0000\u0000\u0000\u00c7\u0001\u0000\u0000\u0000\u0000\u00c9\u0001"
+ "\u0000\u0000\u0000\u0000\u00cb\u0001\u0000\u0000\u0000\u0000\u00cd\u0001"
+ "\u0000\u0000\u0000\u0000\u00cf\u0001\u0000\u0000\u0000\u0000\u00d1\u0001"
+ "\u0000\u0000\u0000\u0000\u00d3\u0001\u0000\u0000\u0000\u0000\u00d5\u0001"
+ "\u0000\u0000\u0000\u0000\u00d7\u0001\u0000\u0000\u0000\u0000\u00d9\u0001"
+ "\u0000\u0000\u0000\u0000\u00db\u0001\u0000\u0000\u0000\u0000\u00dd\u0001"
+ "\u0000\u0000\u0000\u0000\u00df\u0001\u0000\u0000\u0000\u0000\u00e1\u0001"
+ "\u0000\u0000\u0000\u0000\u00e3\u0001\u0000\u0000\u0000\u0000\u00e5\u0001"
+ "\u0000\u0000\u0000\u0000\u00e7\u0001\u0000\u0000\u0000\u0000\u00e9\u0001"
+ "\u0000\u0000\u0000\u0000\u00eb\u0001\u0000\u0000\u0000\u0000\u00ed\u0001"
+ "\u0000\u0000\u0000\u0000\u00ef\u0001\u0000\u0000\u0000\u0000\u00f1\u0001"
+ "\u0000\u0000\u0000\u0000\u00f3\u0001\u0000\u0000\u0000\u0000\u00f5\u0001"
+ "\u0000\u0000\u0000\u0000\u00f7\u0001\u0000\u0000\u0000\u0000\u00f9\u0001"
+ "\u0000\u0000\u0000\u0000\u00fb\u0001\u0000\u0000\u0000\u0000\u00fd\u0001"
+ "\u0000\u0000\u0000\u0000\u00ff\u0001\u0000\u0000\u0000\u0000\u0101\u0001"
+ "\u0000\u0000\u0000\u0000\u0103\u0001\u0000\u0000\u0000\u0000\u0105\u0001"
+ "\u0000\u0000\u0000\u0000\u0107\u0001\u0000\u0000\u0000\u0000\u0109\u0001"
+ "\u0000\u0000\u0000\u0000\u010b\u0001\u0000\u0000\u0000\u0000\u0113\u0001"
+ "\u0000\u0000\u0000\u0000\u0115\u0001\u0000\u0000\u0000\u0000\u0117\u0001"
+ "\u0000\u0000\u0000\u0000\u0119\u0001\u0000\u0000\u0000\u0001\u011b\u0001"
+ "\u0000\u0000\u0000\u0003\u011d\u0001\u0000\u0000\u0000\u0005\u011f\u0001"
+ "\u0000\u0000\u0000\u0007\u0121\u0001\u0000\u0000\u0000\t\u0123\u0001\u0000"
+ "\u0000\u0000\u000b\u0127\u0001\u0000\u0000\u0000\r\u012f\u0001\u0000\u0000"
+ "\u0000\u000f\u0138\u0001\u0000\u0000\u0000\u0011\u013c\u0001\u0000\u0000"
+ "\u0000\u0013\u0140\u0001\u0000\u0000\u0000\u0015\u0143\u0001\u0000\u0000"
+ "\u0000\u0017\u0147\u0001\u0000\u0000\u0000\u0019\u014f\u0001\u0000\u0000"
+ "\u0000\u001b\u0152\u0001\u0000\u0000\u0000\u001d\u0157\u0001\u0000\u0000"
+ "\u0000\u001f\u015c\u0001\u0000\u0000\u0000!\u0164\u0001\u0000\u0000\u0000"
+ "#\u016d\u0001\u0000\u0000\u0000%\u0175\u0001\u0000\u0000\u0000\'\u017d"
+ "\u0001\u0000\u0000\u0000)\u018a\u0001\u0000\u0000\u0000+\u0197\u0001\u0000"
+ "\u0000\u0000-\u01a9\u0001\u0000\u0000\u0000/\u01ad\u0001\u0000\u0000\u0000"
+ "1\u01b2\u0001\u0000\u0000\u00003\u01b8\u0001\u0000\u0000\u00005\u01bd"
+ "\u0001\u0000\u0000\u00007\u01c6\u0001\u0000\u0000\u00009\u01cf\u0001\u0000"
+ "\u0000\u0000;\u01d4\u0001\u0000\u0000\u0000=\u01d8\u0001\u0000\u0000\u0000"
+ "?\u01df\u0001\u0000\u0000\u0000A\u01ea\u0001\u0000\u0000\u0000C\u01f1"
+ "\u0001\u0000\u0000\u0000E\u01f9\u0001\u0000\u0000\u0000G\u0201\u0001\u0000"
+ "\u0000\u0000I\u0207\u0001\u0000\u0000\u0000K\u020d\u0001\u0000\u0000\u0000"
+ "M\u0211\u0001\u0000\u0000\u0000O\u0218\u0001\u0000\u0000\u0000Q\u021d"
+ "\u0001\u0000\u0000\u0000S\u0224\u0001\u0000\u0000\u0000U\u0229\u0001\u0000"
+ "\u0000\u0000W\u0233\u0001\u0000\u0000\u0000Y\u023c\u0001\u0000\u0000\u0000"
+ "[\u0242\u0001\u0000\u0000\u0000]\u0249\u0001\u0000\u0000\u0000_\u024e"
+ "\u0001\u0000\u0000\u0000a\u0254\u0001\u0000\u0000\u0000c\u0257\u0001\u0000"
+ "\u0000\u0000e\u025f\u0001\u0000\u0000\u0000g\u0265\u0001\u0000\u0000\u0000"
+ "i\u026e\u0001\u0000\u0000\u0000k\u0271\u0001\u0000\u0000\u0000m\u0276"
+ "\u0001\u0000\u0000\u0000o\u027b\u0001\u0000\u0000\u0000q\u0280\u0001\u0000"
+ "\u0000\u0000s\u0285\u0001\u0000\u0000\u0000u\u028b\u0001\u0000\u0000\u0000"
+ "w\u0292\u0001\u0000\u0000\u0000y\u0298\u0001\u0000\u0000\u0000{\u029f"
+ "\u0001\u0000\u0000\u0000}\u02a7\u0001\u0000\u0000\u0000\u007f\u02ad\u0001"
+ "\u0000\u0000\u0000\u0081\u02b4\u0001\u0000\u0000\u0000\u0083\u02bc\u0001"
+ "\u0000\u0000\u0000\u0085\u02c0\u0001\u0000\u0000\u0000\u0087\u02c5\u0001"
+ "\u0000\u0000\u0000\u0089\u02cb\u0001\u0000\u0000\u0000\u008b\u02ce\u0001"
+ "\u0000\u0000\u0000\u008d\u02d8\u0001\u0000\u0000\u0000\u008f\u02db\u0001"
+ "\u0000\u0000\u0000\u0091\u02e1\u0001\u0000\u0000\u0000\u0093\u02e7\u0001"
+ "\u0000\u0000\u0000\u0095\u02ee\u0001\u0000\u0000\u0000\u0097\u02f7\u0001"
+ "\u0000\u0000\u0000\u0099\u02fd\u0001\u0000\u0000\u0000\u009b\u0302\u0001"
+ "\u0000\u0000\u0000\u009d\u0308\u0001\u0000\u0000\u0000\u009f\u030e\u0001"
+ "\u0000\u0000\u0000\u00a1\u0314\u0001\u0000\u0000\u0000\u00a3\u031c\u0001"
+ "\u0000\u0000\u0000\u00a5\u0323\u0001\u0000\u0000\u0000\u00a7\u032b\u0001"
+ "\u0000\u0000\u0000\u00a9\u0332\u0001\u0000\u0000\u0000\u00ab\u0337\u0001"
+ "\u0000\u0000\u0000\u00ad\u033b\u0001\u0000\u0000\u0000\u00af\u0341\u0001"
+ "\u0000\u0000\u0000\u00b1\u0348\u0001\u0000\u0000\u0000\u00b3\u034d\u0001"
+ "\u0000\u0000\u0000\u00b5\u0352\u0001\u0000\u0000\u0000\u00b7\u0357\u0001"
+ "\u0000\u0000\u0000\u00b9\u035a\u0001\u0000\u0000\u0000\u00bb\u035e\u0001"
+ "\u0000\u0000\u0000\u00bd\u0363\u0001\u0000\u0000\u0000\u00bf\u0369\u0001"
+ "\u0000\u0000\u0000\u00c1\u036f\u0001\u0000\u0000\u0000\u00c3\u0376\u0001"
+ "\u0000\u0000\u0000\u00c5\u037b\u0001\u0000\u0000\u0000\u00c7\u0381\u0001"
+ "\u0000\u0000\u0000\u00c9\u0386\u0001\u0000\u0000\u0000\u00cb\u038b\u0001"
+ "\u0000\u0000\u0000\u00cd\u0391\u0001\u0000\u0000\u0000\u00cf\u0399\u0001"
+ "\u0000\u0000\u0000\u00d1\u039d\u0001\u0000\u0000\u0000\u00d3\u03a4\u0001"
+ "\u0000\u0000\u0000\u00d5\u03a7\u0001\u0000\u0000\u0000\u00d7\u03aa\u0001"
+ "\u0000\u0000\u0000\u00d9\u03ae\u0001\u0000\u0000\u0000\u00db\u03b4\u0001"
+ "\u0000\u0000\u0000\u00dd\u03bb\u0001\u0000\u0000\u0000\u00df\u03bd\u0001"
+ "\u0000\u0000\u0000\u00e1\u03bf\u0001\u0000\u0000\u0000\u00e3\u03c7\u0001"
+ "\u0000\u0000\u0000\u00e5\u03c9\u0001\u0000\u0000\u0000\u00e7\u03cb\u0001"
+ "\u0000\u0000\u0000\u00e9\u03ce\u0001\u0000\u0000\u0000\u00eb\u03d0\u0001"
+ "\u0000\u0000\u0000\u00ed\u03d3\u0001\u0000\u0000\u0000\u00ef\u03d5\u0001"
+ "\u0000\u0000\u0000\u00f1\u03d7\u0001\u0000\u0000\u0000\u00f3\u03d9\u0001"
+ "\u0000\u0000\u0000\u00f5\u03db\u0001\u0000\u0000\u0000\u00f7\u03dd\u0001"
+ "\u0000\u0000\u0000\u00f9\u03e0\u0001\u0000\u0000\u0000\u00fb\u03e2\u0001"
+ "\u0000\u0000\u0000\u00fd\u03e4\u0001\u0000\u0000\u0000\u00ff\u03f0\u0001"
+ "\u0000\u0000\u0000\u0101\u041e\u0001\u0000\u0000\u0000\u0103\u0422\u0001"
+ "\u0000\u0000\u0000\u0105\u042c\u0001\u0000\u0000\u0000\u0107\u0437\u0001"
+ "\u0000\u0000\u0000\u0109\u043b\u0001\u0000\u0000\u0000\u010b\u0446\u0001"
+ "\u0000\u0000\u0000\u010d\u0451\u0001\u0000\u0000\u0000\u010f\u045a\u0001"
+ "\u0000\u0000\u0000\u0111\u045c\u0001\u0000\u0000\u0000\u0113\u045e\u0001"
+ "\u0000\u0000\u0000\u0115\u046f\u0001\u0000\u0000\u0000\u0117\u047f\u0001"
+ "\u0000\u0000\u0000\u0119\u0485\u0001\u0000\u0000\u0000\u011b\u011c\u0005"
+ "(\u0000\u0000\u011c\u0002\u0001\u0000\u0000\u0000\u011d\u011e\u0005)\u0000"
+ "\u0000\u011e\u0004\u0001\u0000\u0000\u0000\u011f\u0120\u0005,\u0000\u0000"
+ "\u0120\u0006\u0001\u0000\u0000\u0000\u0121\u0122\u0005:\u0000\u0000\u0122"
+ "\b\u0001\u0000\u0000\u0000\u0123\u0124\u0005A\u0000\u0000\u0124\u0125"
+ "\u0005L\u0000\u0000\u0125\u0126\u0005L\u0000\u0000\u0126\n\u0001\u0000"
+ "\u0000\u0000\u0127\u0128\u0005A\u0000\u0000\u0128\u0129\u0005N\u0000\u0000"
+ "\u0129\u012a\u0005A\u0000\u0000\u012a\u012b\u0005L\u0000\u0000\u012b\u012c"
+ "\u0005Y\u0000\u0000\u012c\u012d\u0005Z\u0000\u0000\u012d\u012e\u0005E"
+ "\u0000\u0000\u012e\f\u0001\u0000\u0000\u0000\u012f\u0130\u0005A\u0000"
+ "\u0000\u0130\u0131\u0005N\u0000\u0000\u0131\u0132\u0005A\u0000\u0000\u0132"
+ "\u0133\u0005L\u0000\u0000\u0133\u0134\u0005Y\u0000\u0000\u0134\u0135\u0005"
+ "Z\u0000\u0000\u0135\u0136\u0005E\u0000\u0000\u0136\u0137\u0005D\u0000"
+ "\u0000\u0137\u000e\u0001\u0000\u0000\u0000\u0138\u0139\u0005A\u0000\u0000"
+ "\u0139\u013a\u0005N\u0000\u0000\u013a\u013b\u0005D\u0000\u0000\u013b\u0010"
+ "\u0001\u0000\u0000\u0000\u013c\u013d\u0005A\u0000\u0000\u013d\u013e\u0005"
+ "N\u0000\u0000\u013e\u013f\u0005Y\u0000\u0000\u013f\u0012\u0001\u0000\u0000"
+ "\u0000\u0140\u0141\u0005A\u0000\u0000\u0141\u0142\u0005S\u0000\u0000\u0142"
+ "\u0014\u0001\u0000\u0000\u0000\u0143\u0144\u0005A\u0000\u0000\u0144\u0145"
+ "\u0005S\u0000\u0000\u0145\u0146\u0005C\u0000\u0000\u0146\u0016\u0001\u0000"
+ "\u0000\u0000\u0147\u0148\u0005B\u0000\u0000\u0148\u0149\u0005E\u0000\u0000"
+ "\u0149\u014a\u0005T\u0000\u0000\u014a\u014b\u0005W\u0000\u0000\u014b\u014c"
+ "\u0005E\u0000\u0000\u014c\u014d\u0005E\u0000\u0000\u014d\u014e\u0005N"
+ "\u0000\u0000\u014e\u0018\u0001\u0000\u0000\u0000\u014f\u0150\u0005B\u0000"
+ "\u0000\u0150\u0151\u0005Y\u0000\u0000\u0151\u001a\u0001\u0000\u0000\u0000"
+ "\u0152\u0153\u0005C\u0000\u0000\u0153\u0154\u0005A\u0000\u0000\u0154\u0155"
+ "\u0005S\u0000\u0000\u0155\u0156\u0005E\u0000\u0000\u0156\u001c\u0001\u0000"
+ "\u0000\u0000\u0157\u0158\u0005C\u0000\u0000\u0158\u0159\u0005A\u0000\u0000"
+ "\u0159\u015a\u0005S\u0000\u0000\u015a\u015b\u0005T\u0000\u0000\u015b\u001e"
+ "\u0001\u0000\u0000\u0000\u015c\u015d\u0005C\u0000\u0000\u015d\u015e\u0005"
+ "A\u0000\u0000\u015e\u015f\u0005T\u0000\u0000\u015f\u0160\u0005A\u0000"
+ "\u0000\u0160\u0161\u0005L\u0000\u0000\u0161\u0162\u0005O\u0000\u0000\u0162"
+ "\u0163\u0005G\u0000\u0000\u0163 \u0001\u0000\u0000\u0000\u0164\u0165\u0005"
+ "C\u0000\u0000\u0165\u0166\u0005A\u0000\u0000\u0166\u0167\u0005T\u0000"
+ "\u0000\u0167\u0168\u0005A\u0000\u0000\u0168\u0169\u0005L\u0000\u0000\u0169"
+ "\u016a\u0005O\u0000\u0000\u016a\u016b\u0005G\u0000\u0000\u016b\u016c\u0005"
+ "S\u0000\u0000\u016c\"\u0001\u0000\u0000\u0000\u016d\u016e\u0005C\u0000"
+ "\u0000\u016e\u016f\u0005O\u0000\u0000\u016f\u0170\u0005L\u0000\u0000\u0170"
+ "\u0171\u0005U\u0000\u0000\u0171\u0172\u0005M\u0000\u0000\u0172\u0173\u0005"
+ "N\u0000\u0000\u0173\u0174\u0005S\u0000\u0000\u0174$\u0001\u0000\u0000"
+ "\u0000\u0175\u0176\u0005C\u0000\u0000\u0176\u0177\u0005O\u0000\u0000\u0177"
+ "\u0178\u0005N\u0000\u0000\u0178\u0179\u0005V\u0000\u0000\u0179\u017a\u0005"
+ "E\u0000\u0000\u017a\u017b\u0005R\u0000\u0000\u017b\u017c\u0005T\u0000"
+ "\u0000\u017c&\u0001\u0000\u0000\u0000\u017d\u017e\u0005C\u0000\u0000\u017e"
+ "\u017f\u0005U\u0000\u0000\u017f\u0180\u0005R\u0000\u0000\u0180\u0181\u0005"
+ "R\u0000\u0000\u0181\u0182\u0005E\u0000\u0000\u0182\u0183\u0005N\u0000"
+ "\u0000\u0183\u0184\u0005T\u0000\u0000\u0184\u0185\u0005_\u0000\u0000\u0185"
+ "\u0186\u0005D\u0000\u0000\u0186\u0187\u0005A\u0000\u0000\u0187\u0188\u0005"
+ "T\u0000\u0000\u0188\u0189\u0005E\u0000\u0000\u0189(\u0001\u0000\u0000"
+ "\u0000\u018a\u018b\u0005C\u0000\u0000\u018b\u018c\u0005U\u0000\u0000\u018c"
+ "\u018d\u0005R\u0000\u0000\u018d\u018e\u0005R\u0000\u0000\u018e\u018f\u0005"
+ "E\u0000\u0000\u018f\u0190\u0005N\u0000\u0000\u0190\u0191\u0005T\u0000"
+ "\u0000\u0191\u0192\u0005_\u0000\u0000\u0192\u0193\u0005T\u0000\u0000\u0193"
+ "\u0194\u0005I\u0000\u0000\u0194\u0195\u0005M\u0000\u0000\u0195\u0196\u0005"
+ "E\u0000\u0000\u0196*\u0001\u0000\u0000\u0000\u0197\u0198\u0005C\u0000"
+ "\u0000\u0198\u0199\u0005U\u0000\u0000\u0199\u019a\u0005R\u0000\u0000\u019a"
+ "\u019b\u0005R\u0000\u0000\u019b\u019c\u0005E\u0000\u0000\u019c\u019d\u0005"
+ "N\u0000\u0000\u019d\u019e\u0005T\u0000\u0000\u019e\u019f\u0005_\u0000"
+ "\u0000\u019f\u01a0\u0005T\u0000\u0000\u01a0\u01a1\u0005I\u0000\u0000\u01a1"
+ "\u01a2\u0005M\u0000\u0000\u01a2\u01a3\u0005E\u0000\u0000\u01a3\u01a4\u0005"
+ "S\u0000\u0000\u01a4\u01a5\u0005T\u0000\u0000\u01a5\u01a6\u0005A\u0000"
+ "\u0000\u01a6\u01a7\u0005M\u0000\u0000\u01a7\u01a8\u0005P\u0000\u0000\u01a8"
+ ",\u0001\u0000\u0000\u0000\u01a9\u01aa\u0005D\u0000\u0000\u01aa\u01ab\u0005"
+ "A\u0000\u0000\u01ab\u01ac\u0005Y\u0000\u0000\u01ac.\u0001\u0000\u0000"
+ "\u0000\u01ad\u01ae\u0005D\u0000\u0000\u01ae\u01af\u0005A\u0000\u0000\u01af"
+ "\u01b0\u0005Y\u0000\u0000\u01b0\u01b1\u0005S\u0000\u0000\u01b10\u0001"
+ "\u0000\u0000\u0000\u01b2\u01b3\u0005D\u0000\u0000\u01b3\u01b4\u0005E\u0000"
+ "\u0000\u01b4\u01b5\u0005B\u0000\u0000\u01b5\u01b6\u0005U\u0000\u0000\u01b6"
+ "\u01b7\u0005G\u0000\u0000\u01b72\u0001\u0000\u0000\u0000\u01b8\u01b9\u0005"
+ "D\u0000\u0000\u01b9\u01ba\u0005E\u0000\u0000\u01ba\u01bb\u0005S\u0000"
+ "\u0000\u01bb\u01bc\u0005C\u0000\u0000\u01bc4\u0001\u0000\u0000\u0000\u01bd"
+ "\u01be\u0005D\u0000\u0000\u01be\u01bf\u0005E\u0000\u0000\u01bf\u01c0\u0005"
+ "S\u0000\u0000\u01c0\u01c1\u0005C\u0000\u0000\u01c1\u01c2\u0005R\u0000"
+ "\u0000\u01c2\u01c3\u0005I\u0000\u0000\u01c3\u01c4\u0005B\u0000\u0000\u01c4"
+ "\u01c5\u0005E\u0000\u0000\u01c56\u0001\u0000\u0000\u0000\u01c6\u01c7\u0005"
+ "D\u0000\u0000\u01c7\u01c8\u0005I\u0000\u0000\u01c8\u01c9\u0005S\u0000"
+ "\u0000\u01c9\u01ca\u0005T\u0000\u0000\u01ca\u01cb\u0005I\u0000\u0000\u01cb"
+ "\u01cc\u0005N\u0000\u0000\u01cc\u01cd\u0005C\u0000\u0000\u01cd\u01ce\u0005"
+ "T\u0000\u0000\u01ce8\u0001\u0000\u0000\u0000\u01cf\u01d0\u0005E\u0000"
+ "\u0000\u01d0\u01d1\u0005L\u0000\u0000\u01d1\u01d2\u0005S\u0000\u0000\u01d2"
+ "\u01d3\u0005E\u0000\u0000\u01d3:\u0001\u0000\u0000\u0000\u01d4\u01d5\u0005"
+ "E\u0000\u0000\u01d5\u01d6\u0005N\u0000\u0000\u01d6\u01d7\u0005D\u0000"
+ "\u0000\u01d7<\u0001\u0000\u0000\u0000\u01d8\u01d9\u0005E\u0000\u0000\u01d9"
+ "\u01da\u0005S\u0000\u0000\u01da\u01db\u0005C\u0000\u0000\u01db\u01dc\u0005"
+ "A\u0000\u0000\u01dc\u01dd\u0005P\u0000\u0000\u01dd\u01de\u0005E\u0000"
+ "\u0000\u01de>\u0001\u0000\u0000\u0000\u01df\u01e0\u0005E\u0000\u0000\u01e0"
+ "\u01e1\u0005X\u0000\u0000\u01e1\u01e2\u0005E\u0000\u0000\u01e2\u01e3\u0005"
+ "C\u0000\u0000\u01e3\u01e4\u0005U\u0000\u0000\u01e4\u01e5\u0005T\u0000"
+ "\u0000\u01e5\u01e6\u0005A\u0000\u0000\u01e6\u01e7\u0005B\u0000\u0000\u01e7"
+ "\u01e8\u0005L\u0000\u0000\u01e8\u01e9\u0005E\u0000\u0000\u01e9@\u0001"
+ "\u0000\u0000\u0000\u01ea\u01eb\u0005E\u0000\u0000\u01eb\u01ec\u0005X\u0000"
+ "\u0000\u01ec\u01ed\u0005I\u0000\u0000\u01ed\u01ee\u0005S\u0000\u0000\u01ee"
+ "\u01ef\u0005T\u0000\u0000\u01ef\u01f0\u0005S\u0000\u0000\u01f0B\u0001"
+ "\u0000\u0000\u0000\u01f1\u01f2\u0005E\u0000\u0000\u01f2\u01f3\u0005X\u0000"
+ "\u0000\u01f3\u01f4\u0005P\u0000\u0000\u01f4\u01f5\u0005L\u0000\u0000\u01f5"
+ "\u01f6\u0005A\u0000\u0000\u01f6\u01f7\u0005I\u0000\u0000\u01f7\u01f8\u0005"
+ "N\u0000\u0000\u01f8D\u0001\u0000\u0000\u0000\u01f9\u01fa\u0005E\u0000"
+ "\u0000\u01fa\u01fb\u0005X\u0000\u0000\u01fb\u01fc\u0005T\u0000\u0000\u01fc"
+ "\u01fd\u0005R\u0000\u0000\u01fd\u01fe\u0005A\u0000\u0000\u01fe\u01ff\u0005"
+ "C\u0000\u0000\u01ff\u0200\u0005T\u0000\u0000\u0200F\u0001\u0000\u0000"
+ "\u0000\u0201\u0202\u0005F\u0000\u0000\u0202\u0203\u0005A\u0000\u0000\u0203"
+ "\u0204\u0005L\u0000\u0000\u0204\u0205\u0005S\u0000\u0000\u0205\u0206\u0005"
+ "E\u0000\u0000\u0206H\u0001\u0000\u0000\u0000\u0207\u0208\u0005F\u0000"
+ "\u0000\u0208\u0209\u0005I\u0000\u0000\u0209\u020a\u0005R\u0000\u0000\u020a"
+ "\u020b\u0005S\u0000\u0000\u020b\u020c\u0005T\u0000\u0000\u020cJ\u0001"
+ "\u0000\u0000\u0000\u020d\u020e\u0005F\u0000\u0000\u020e\u020f\u0005O\u0000"
+ "\u0000\u020f\u0210\u0005R\u0000\u0000\u0210L\u0001\u0000\u0000\u0000\u0211"
+ "\u0212\u0005F\u0000\u0000\u0212\u0213\u0005O\u0000\u0000\u0213\u0214\u0005"
+ "R\u0000\u0000\u0214\u0215\u0005M\u0000\u0000\u0215\u0216\u0005A\u0000"
+ "\u0000\u0216\u0217\u0005T\u0000\u0000\u0217N\u0001\u0000\u0000\u0000\u0218"
+ "\u0219\u0005F\u0000\u0000\u0219\u021a\u0005R\u0000\u0000\u021a\u021b\u0005"
+ "O\u0000\u0000\u021b\u021c\u0005M\u0000\u0000\u021cP\u0001\u0000\u0000"
+ "\u0000\u021d\u021e\u0005F\u0000\u0000\u021e\u021f\u0005R\u0000\u0000\u021f"
+ "\u0220\u0005O\u0000\u0000\u0220\u0221\u0005Z\u0000\u0000\u0221\u0222\u0005"
+ "E\u0000\u0000\u0222\u0223\u0005N\u0000\u0000\u0223R\u0001\u0000\u0000"
+ "\u0000\u0224\u0225\u0005F\u0000\u0000\u0225\u0226\u0005U\u0000\u0000\u0226"
+ "\u0227\u0005L\u0000\u0000\u0227\u0228\u0005L\u0000\u0000\u0228T\u0001"
+ "\u0000\u0000\u0000\u0229\u022a\u0005F\u0000\u0000\u022a\u022b\u0005U\u0000"
+ "\u0000\u022b\u022c\u0005N\u0000\u0000\u022c\u022d\u0005C\u0000\u0000\u022d"
+ "\u022e\u0005T\u0000\u0000\u022e\u022f\u0005I\u0000\u0000\u022f\u0230\u0005"
+ "O\u0000\u0000\u0230\u0231\u0005N\u0000\u0000\u0231\u0232\u0005S\u0000"
+ "\u0000\u0232V\u0001\u0000\u0000\u0000\u0233\u0234\u0005G\u0000\u0000\u0234"
+ "\u0235\u0005R\u0000\u0000\u0235\u0236\u0005A\u0000\u0000\u0236\u0237\u0005"
+ "P\u0000\u0000\u0237\u0238\u0005H\u0000\u0000\u0238\u0239\u0005V\u0000"
+ "\u0000\u0239\u023a\u0005I\u0000\u0000\u023a\u023b\u0005Z\u0000\u0000\u023b"
+ "X\u0001\u0000\u0000\u0000\u023c\u023d\u0005G\u0000\u0000\u023d\u023e\u0005"
+ "R\u0000\u0000\u023e\u023f\u0005O\u0000\u0000\u023f\u0240\u0005U\u0000"
+ "\u0000\u0240\u0241\u0005P\u0000\u0000\u0241Z\u0001\u0000\u0000\u0000\u0242"
+ "\u0243\u0005H\u0000\u0000\u0243\u0244\u0005A\u0000\u0000\u0244\u0245\u0005"
+ "V\u0000\u0000\u0245\u0246\u0005I\u0000\u0000\u0246\u0247\u0005N\u0000"
+ "\u0000\u0247\u0248\u0005G\u0000\u0000\u0248\\\u0001\u0000\u0000\u0000"
+ "\u0249\u024a\u0005H\u0000\u0000\u024a\u024b\u0005O\u0000\u0000\u024b\u024c"
+ "\u0005U\u0000\u0000\u024c\u024d\u0005R\u0000\u0000\u024d^\u0001\u0000"
+ "\u0000\u0000\u024e\u024f\u0005H\u0000\u0000\u024f\u0250\u0005O\u0000\u0000"
+ "\u0250\u0251\u0005U\u0000\u0000\u0251\u0252\u0005R\u0000\u0000\u0252\u0253"
+ "\u0005S\u0000\u0000\u0253`\u0001\u0000\u0000\u0000\u0254\u0255\u0005I"
+ "\u0000\u0000\u0255\u0256\u0005N\u0000\u0000\u0256b\u0001\u0000\u0000\u0000"
+ "\u0257\u0258\u0005I\u0000\u0000\u0258\u0259\u0005N\u0000\u0000\u0259\u025a"
+ "\u0005C\u0000\u0000\u025a\u025b\u0005L\u0000\u0000\u025b\u025c\u0005U"
+ "\u0000\u0000\u025c\u025d\u0005D\u0000\u0000\u025d\u025e\u0005E\u0000\u0000"
+ "\u025ed\u0001\u0000\u0000\u0000\u025f\u0260\u0005I\u0000\u0000\u0260\u0261"
+ "\u0005N\u0000\u0000\u0261\u0262\u0005N\u0000\u0000\u0262\u0263\u0005E"
+ "\u0000\u0000\u0263\u0264\u0005R\u0000\u0000\u0264f\u0001\u0000\u0000\u0000"
+ "\u0265\u0266\u0005I\u0000\u0000\u0266\u0267\u0005N\u0000\u0000\u0267\u0268"
+ "\u0005T\u0000\u0000\u0268\u0269\u0005E\u0000\u0000\u0269\u026a\u0005R"
+ "\u0000\u0000\u026a\u026b\u0005V\u0000\u0000\u026b\u026c\u0005A\u0000\u0000"
+ "\u026c\u026d\u0005L\u0000\u0000\u026dh\u0001\u0000\u0000\u0000\u026e\u026f"
+ "\u0005I\u0000\u0000\u026f\u0270\u0005S\u0000\u0000\u0270j\u0001\u0000"
+ "\u0000\u0000\u0271\u0272\u0005J\u0000\u0000\u0272\u0273\u0005O\u0000\u0000"
+ "\u0273\u0274\u0005I\u0000\u0000\u0274\u0275\u0005N\u0000\u0000\u0275l"
+ "\u0001\u0000\u0000\u0000\u0276\u0277\u0005L\u0000\u0000\u0277\u0278\u0005"
+ "A\u0000\u0000\u0278\u0279\u0005S\u0000\u0000\u0279\u027a\u0005T\u0000"
+ "\u0000\u027an\u0001\u0000\u0000\u0000\u027b\u027c\u0005L\u0000\u0000\u027c"
+ "\u027d\u0005E\u0000\u0000\u027d\u027e\u0005F\u0000\u0000\u027e\u027f\u0005"
+ "T\u0000\u0000\u027fp\u0001\u0000\u0000\u0000\u0280\u0281\u0005L\u0000"
+ "\u0000\u0281\u0282\u0005I\u0000\u0000\u0282\u0283\u0005K\u0000\u0000\u0283"
+ "\u0284\u0005E\u0000\u0000\u0284r\u0001\u0000\u0000\u0000\u0285\u0286\u0005"
+ "L\u0000\u0000\u0286\u0287\u0005I\u0000\u0000\u0287\u0288\u0005M\u0000"
+ "\u0000\u0288\u0289\u0005I\u0000\u0000\u0289\u028a\u0005T\u0000\u0000\u028a"
+ "t\u0001\u0000\u0000\u0000\u028b\u028c\u0005M\u0000\u0000\u028c\u028d\u0005"
+ "A\u0000\u0000\u028d\u028e\u0005P\u0000\u0000\u028e\u028f\u0005P\u0000"
+ "\u0000\u028f\u0290\u0005E\u0000\u0000\u0290\u0291\u0005D\u0000\u0000\u0291"
+ "v\u0001\u0000\u0000\u0000\u0292\u0293\u0005M\u0000\u0000\u0293\u0294\u0005"
+ "A\u0000\u0000\u0294\u0295\u0005T\u0000\u0000\u0295\u0296\u0005C\u0000"
+ "\u0000\u0296\u0297\u0005H\u0000\u0000\u0297x\u0001\u0000\u0000\u0000\u0298"
+ "\u0299\u0005M\u0000\u0000\u0299\u029a\u0005I\u0000\u0000\u029a\u029b\u0005"
+ "N\u0000\u0000\u029b\u029c\u0005U\u0000\u0000\u029c\u029d\u0005T\u0000"
+ "\u0000\u029d\u029e\u0005E\u0000\u0000\u029ez\u0001\u0000\u0000\u0000\u029f"
+ "\u02a0\u0005M\u0000\u0000\u02a0\u02a1\u0005I\u0000\u0000\u02a1\u02a2\u0005"
+ "N\u0000\u0000\u02a2\u02a3\u0005U\u0000\u0000\u02a3\u02a4\u0005T\u0000"
+ "\u0000\u02a4\u02a5\u0005E\u0000\u0000\u02a5\u02a6\u0005S\u0000\u0000\u02a6"
+ "|\u0001\u0000\u0000\u0000\u02a7\u02a8\u0005M\u0000\u0000\u02a8\u02a9\u0005"
+ "O\u0000\u0000\u02a9\u02aa\u0005N\u0000\u0000\u02aa\u02ab\u0005T\u0000"
+ "\u0000\u02ab\u02ac\u0005H\u0000\u0000\u02ac~\u0001\u0000\u0000\u0000\u02ad"
+ "\u02ae\u0005M\u0000\u0000\u02ae\u02af\u0005O\u0000\u0000\u02af\u02b0\u0005"
+ "N\u0000\u0000\u02b0\u02b1\u0005T\u0000\u0000\u02b1\u02b2\u0005H\u0000"
+ "\u0000\u02b2\u02b3\u0005S\u0000\u0000\u02b3\u0080\u0001\u0000\u0000\u0000"
+ "\u02b4\u02b5\u0005N\u0000\u0000\u02b5\u02b6\u0005A\u0000\u0000\u02b6\u02b7"
+ "\u0005T\u0000\u0000\u02b7\u02b8\u0005U\u0000\u0000\u02b8\u02b9\u0005R"
+ "\u0000\u0000\u02b9\u02ba\u0005A\u0000\u0000\u02ba\u02bb\u0005L\u0000\u0000"
+ "\u02bb\u0082\u0001\u0000\u0000\u0000\u02bc\u02bd\u0005N\u0000\u0000\u02bd"
+ "\u02be\u0005O\u0000\u0000\u02be\u02bf\u0005T\u0000\u0000\u02bf\u0084\u0001"
+ "\u0000\u0000\u0000\u02c0\u02c1\u0005N\u0000\u0000\u02c1\u02c2\u0005U\u0000"
+ "\u0000\u02c2\u02c3\u0005L\u0000\u0000\u02c3\u02c4\u0005L\u0000\u0000\u02c4"
+ "\u0086\u0001\u0000\u0000\u0000\u02c5\u02c6\u0005N\u0000\u0000\u02c6\u02c7"
+ "\u0005U\u0000\u0000\u02c7\u02c8\u0005L\u0000\u0000\u02c8\u02c9\u0005L"
+ "\u0000\u0000\u02c9\u02ca\u0005S\u0000\u0000\u02ca\u0088\u0001\u0000\u0000"
+ "\u0000\u02cb\u02cc\u0005O\u0000\u0000\u02cc\u02cd\u0005N\u0000\u0000\u02cd"
+ "\u008a\u0001\u0000\u0000\u0000\u02ce\u02cf\u0005O\u0000\u0000\u02cf\u02d0"
+ "\u0005P\u0000\u0000\u02d0\u02d1\u0005T\u0000\u0000\u02d1\u02d2\u0005I"
+ "\u0000\u0000\u02d2\u02d3\u0005M\u0000\u0000\u02d3\u02d4\u0005I\u0000\u0000"
+ "\u02d4\u02d5\u0005Z\u0000\u0000\u02d5\u02d6\u0005E\u0000\u0000\u02d6\u02d7"
+ "\u0005D\u0000\u0000\u02d7\u008c\u0001\u0000\u0000\u0000\u02d8\u02d9\u0005"
+ "O\u0000\u0000\u02d9\u02da\u0005R\u0000\u0000\u02da\u008e\u0001\u0000\u0000"
+ "\u0000\u02db\u02dc\u0005O\u0000\u0000\u02dc\u02dd\u0005R\u0000\u0000\u02dd"
+ "\u02de\u0005D\u0000\u0000\u02de\u02df\u0005E\u0000\u0000\u02df\u02e0\u0005"
+ "R\u0000\u0000\u02e0\u0090\u0001\u0000\u0000\u0000\u02e1\u02e2\u0005O\u0000"
+ "\u0000\u02e2\u02e3\u0005U\u0000\u0000\u02e3\u02e4\u0005T\u0000\u0000\u02e4"
+ "\u02e5\u0005E\u0000\u0000\u02e5\u02e6\u0005R\u0000\u0000\u02e6\u0092\u0001"
+ "\u0000\u0000\u0000\u02e7\u02e8\u0005P\u0000\u0000\u02e8\u02e9\u0005A\u0000"
+ "\u0000\u02e9\u02ea\u0005R\u0000\u0000\u02ea\u02eb\u0005S\u0000\u0000\u02eb"
+ "\u02ec\u0005E\u0000\u0000\u02ec\u02ed\u0005D\u0000\u0000\u02ed\u0094\u0001"
+ "\u0000\u0000\u0000\u02ee\u02ef\u0005P\u0000\u0000\u02ef\u02f0\u0005H\u0000"
+ "\u0000\u02f0\u02f1\u0005Y\u0000\u0000\u02f1\u02f2\u0005S\u0000\u0000\u02f2"
+ "\u02f3\u0005I\u0000\u0000\u02f3\u02f4\u0005C\u0000\u0000\u02f4\u02f5\u0005"
+ "A\u0000\u0000\u02f5\u02f6\u0005L\u0000\u0000\u02f6\u0096\u0001\u0000\u0000"
+ "\u0000\u02f7\u02f8\u0005P\u0000\u0000\u02f8\u02f9\u0005I\u0000\u0000\u02f9"
+ "\u02fa\u0005V\u0000\u0000\u02fa\u02fb\u0005O\u0000\u0000\u02fb\u02fc\u0005"
+ "T\u0000\u0000\u02fc\u0098\u0001\u0000\u0000\u0000\u02fd\u02fe\u0005P\u0000"
+ "\u0000\u02fe\u02ff\u0005L\u0000\u0000\u02ff\u0300\u0005A\u0000\u0000\u0300"
+ "\u0301\u0005N\u0000\u0000\u0301\u009a\u0001\u0000\u0000\u0000\u0302\u0303"
+ "\u0005R\u0000\u0000\u0303\u0304\u0005I\u0000\u0000\u0304\u0305\u0005G"
+ "\u0000\u0000\u0305\u0306\u0005H\u0000\u0000\u0306\u0307\u0005T\u0000\u0000"
+ "\u0307\u009c\u0001\u0000\u0000\u0000\u0308\u0309\u0005R\u0000\u0000\u0309"
+ "\u030a\u0005L\u0000\u0000\u030a\u030b\u0005I\u0000\u0000\u030b\u030c\u0005"
+ "K\u0000\u0000\u030c\u030d\u0005E\u0000\u0000\u030d\u009e\u0001\u0000\u0000"
+ "\u0000\u030e\u030f\u0005Q\u0000\u0000\u030f\u0310\u0005U\u0000\u0000\u0310"
+ "\u0311\u0005E\u0000\u0000\u0311\u0312\u0005R\u0000\u0000\u0312\u0313\u0005"
+ "Y\u0000\u0000\u0313\u00a0\u0001\u0000\u0000\u0000\u0314\u0315\u0005S\u0000"
+ "\u0000\u0315\u0316\u0005C\u0000\u0000\u0316\u0317\u0005H\u0000\u0000\u0317"
+ "\u0318\u0005E\u0000\u0000\u0318\u0319\u0005M\u0000\u0000\u0319\u031a\u0005"
+ "A\u0000\u0000\u031a\u031b\u0005S\u0000\u0000\u031b\u00a2\u0001\u0000\u0000"
+ "\u0000\u031c\u031d\u0005S\u0000\u0000\u031d\u031e\u0005E\u0000\u0000\u031e"
+ "\u031f\u0005C\u0000\u0000\u031f\u0320\u0005O\u0000\u0000\u0320\u0321\u0005"
+ "N\u0000\u0000\u0321\u0322\u0005D\u0000\u0000\u0322\u00a4\u0001\u0000\u0000"
+ "\u0000\u0323\u0324\u0005S\u0000\u0000\u0324\u0325\u0005E\u0000\u0000\u0325"
+ "\u0326\u0005C\u0000\u0000\u0326\u0327\u0005O\u0000\u0000\u0327\u0328\u0005"
+ "N\u0000\u0000\u0328\u0329\u0005D\u0000\u0000\u0329\u032a\u0005S\u0000"
+ "\u0000\u032a\u00a6\u0001\u0000\u0000\u0000\u032b\u032c\u0005S\u0000\u0000"
+ "\u032c\u032d\u0005E\u0000\u0000\u032d\u032e\u0005L\u0000\u0000\u032e\u032f"
+ "\u0005E\u0000\u0000\u032f\u0330\u0005C\u0000\u0000\u0330\u0331\u0005T"
+ "\u0000\u0000\u0331\u00a8\u0001\u0000\u0000\u0000\u0332\u0333\u0005S\u0000"
+ "\u0000\u0333\u0334\u0005H\u0000\u0000\u0334\u0335\u0005O\u0000\u0000\u0335"
+ "\u0336\u0005W\u0000\u0000\u0336\u00aa\u0001\u0000\u0000\u0000\u0337\u0338"
+ "\u0005S\u0000\u0000\u0338\u0339\u0005Y\u0000\u0000\u0339\u033a\u0005S"
+ "\u0000\u0000\u033a\u00ac\u0001\u0000\u0000\u0000\u033b\u033c\u0005T\u0000"
+ "\u0000\u033c\u033d\u0005A\u0000\u0000\u033d\u033e\u0005B\u0000\u0000\u033e"
+ "\u033f\u0005L\u0000\u0000\u033f\u0340\u0005E\u0000\u0000\u0340\u00ae\u0001"
+ "\u0000\u0000\u0000\u0341\u0342\u0005T\u0000\u0000\u0342\u0343\u0005A\u0000"
+ "\u0000\u0343\u0344\u0005B\u0000\u0000\u0344\u0345\u0005L\u0000\u0000\u0345"
+ "\u0346\u0005E\u0000\u0000\u0346\u0347\u0005S\u0000\u0000\u0347\u00b0\u0001"
+ "\u0000\u0000\u0000\u0348\u0349\u0005T\u0000\u0000\u0349\u034a\u0005E\u0000"
+ "\u0000\u034a\u034b\u0005X\u0000\u0000\u034b\u034c\u0005T\u0000\u0000\u034c"
+ "\u00b2\u0001\u0000\u0000\u0000\u034d\u034e\u0005T\u0000\u0000\u034e\u034f"
+ "\u0005H\u0000\u0000\u034f\u0350\u0005E\u0000\u0000\u0350\u0351\u0005N"
+ "\u0000\u0000\u0351\u00b4\u0001\u0000\u0000\u0000\u0352\u0353\u0005T\u0000"
+ "\u0000\u0353\u0354\u0005R\u0000\u0000\u0354\u0355\u0005U\u0000\u0000\u0355"
+ "\u0356\u0005E\u0000\u0000\u0356\u00b6\u0001\u0000\u0000\u0000\u0357\u0358"
+ "\u0005T\u0000\u0000\u0358\u0359\u0005O\u0000\u0000\u0359\u00b8\u0001\u0000"
+ "\u0000\u0000\u035a\u035b\u0005T\u0000\u0000\u035b\u035c\u0005O\u0000\u0000"
+ "\u035c\u035d\u0005P\u0000\u0000\u035d\u00ba\u0001\u0000\u0000\u0000\u035e"
+ "\u035f\u0005T\u0000\u0000\u035f\u0360\u0005Y\u0000\u0000\u0360\u0361\u0005"
+ "P\u0000\u0000\u0361\u0362\u0005E\u0000\u0000\u0362\u00bc\u0001\u0000\u0000"
+ "\u0000\u0363\u0364\u0005T\u0000\u0000\u0364\u0365\u0005Y\u0000\u0000\u0365"
+ "\u0366\u0005P\u0000\u0000\u0366\u0367\u0005E\u0000\u0000\u0367\u0368\u0005"
+ "S\u0000\u0000\u0368\u00be\u0001\u0000\u0000\u0000\u0369\u036a\u0005U\u0000"
+ "\u0000\u036a\u036b\u0005S\u0000\u0000\u036b\u036c\u0005I\u0000\u0000\u036c"
+ "\u036d\u0005N\u0000\u0000\u036d\u036e\u0005G\u0000\u0000\u036e\u00c0\u0001"
+ "\u0000\u0000\u0000\u036f\u0370\u0005V\u0000\u0000\u0370\u0371\u0005E\u0000"
+ "\u0000\u0371\u0372\u0005R\u0000\u0000\u0372\u0373\u0005I\u0000\u0000\u0373"
+ "\u0374\u0005F\u0000\u0000\u0374\u0375\u0005Y\u0000\u0000\u0375\u00c2\u0001"
+ "\u0000\u0000\u0000\u0376\u0377\u0005W\u0000\u0000\u0377\u0378\u0005H\u0000"
+ "\u0000\u0378\u0379\u0005E\u0000\u0000\u0379\u037a\u0005N\u0000\u0000\u037a"
+ "\u00c4\u0001\u0000\u0000\u0000\u037b\u037c\u0005W\u0000\u0000\u037c\u037d"
+ "\u0005H\u0000\u0000\u037d\u037e\u0005E\u0000\u0000\u037e\u037f\u0005R"
+ "\u0000\u0000\u037f\u0380\u0005E\u0000\u0000\u0380\u00c6\u0001\u0000\u0000"
+ "\u0000\u0381\u0382\u0005W\u0000\u0000\u0382\u0383\u0005I\u0000\u0000\u0383"
+ "\u0384\u0005T\u0000\u0000\u0384\u0385\u0005H\u0000\u0000\u0385\u00c8\u0001"
+ "\u0000\u0000\u0000\u0386\u0387\u0005Y\u0000\u0000\u0387\u0388\u0005E\u0000"
+ "\u0000\u0388\u0389\u0005A\u0000\u0000\u0389\u038a\u0005R\u0000\u0000\u038a"
+ "\u00ca\u0001\u0000\u0000\u0000\u038b\u038c\u0005Y\u0000\u0000\u038c\u038d"
+ "\u0005E\u0000\u0000\u038d\u038e\u0005A\u0000\u0000\u038e\u038f\u0005R"
+ "\u0000\u0000\u038f\u0390\u0005S\u0000\u0000\u0390\u00cc\u0001\u0000\u0000"
+ "\u0000\u0391\u0392\u0003\u00dbm\u0000\u0392\u0393\u0005E\u0000\u0000\u0393"
+ "\u0394\u0005S\u0000\u0000\u0394\u0395\u0005C\u0000\u0000\u0395\u0396\u0005"
+ "A\u0000\u0000\u0396\u0397\u0005P\u0000\u0000\u0397\u0398\u0005E\u0000"
+ "\u0000\u0398\u00ce\u0001\u0000\u0000\u0000\u0399\u039a\u0003\u00dbm\u0000"
+ "\u039a\u039b\u0005F\u0000\u0000\u039b\u039c\u0005N\u0000\u0000\u039c\u00d0"
+ "\u0001\u0000\u0000\u0000\u039d\u039e\u0003\u00dbm\u0000\u039e\u039f\u0005"
+ "L\u0000\u0000\u039f\u03a0\u0005I\u0000\u0000\u03a0\u03a1\u0005M\u0000"
+ "\u0000\u03a1\u03a2\u0005I\u0000\u0000\u03a2\u03a3\u0005T\u0000\u0000\u03a3"
+ "\u00d2\u0001\u0000\u0000\u0000\u03a4\u03a5\u0003\u00dbm\u0000\u03a5\u03a6"
+ "\u0005D\u0000\u0000\u03a6\u00d4\u0001\u0000\u0000\u0000\u03a7\u03a8\u0003"
+ "\u00dbm\u0000\u03a8\u03a9\u0005T\u0000\u0000\u03a9\u00d6\u0001\u0000\u0000"
+ "\u0000\u03aa\u03ab\u0003\u00dbm\u0000\u03ab\u03ac\u0005T\u0000\u0000\u03ac"
+ "\u03ad\u0005S\u0000\u0000\u03ad\u00d8\u0001\u0000\u0000\u0000\u03ae\u03af"
+ "\u0003\u00dbm\u0000\u03af\u03b0\u0005G\u0000\u0000\u03b0\u03b1\u0005U"
+ "\u0000\u0000\u03b1\u03b2\u0005I\u0000\u0000\u03b2\u03b3\u0005D\u0000\u0000"
+ "\u03b3\u00da\u0001\u0000\u0000\u0000\u03b4\u03b8\u0005{\u0000\u0000\u03b5"
+ "\u03b7\u0003\u0117\u008b\u0000\u03b6\u03b5\u0001\u0000\u0000\u0000\u03b7"
+ "\u03ba\u0001\u0000\u0000\u0000\u03b8\u03b6\u0001\u0000\u0000\u0000\u03b8"
+ "\u03b9\u0001\u0000\u0000\u0000\u03b9\u00dc\u0001\u0000\u0000\u0000\u03ba"
+ "\u03b8\u0001\u0000\u0000\u0000\u03bb\u03bc\u0005}\u0000\u0000\u03bc\u00de"
+ "\u0001\u0000\u0000\u0000\u03bd\u03be\u0005=\u0000\u0000\u03be\u00e0\u0001"
+ "\u0000\u0000\u0000\u03bf\u03c0\u0005<\u0000\u0000\u03c0\u03c1\u0005=\u0000"
+ "\u0000\u03c1\u03c2\u0005>\u0000\u0000\u03c2\u00e2\u0001\u0000\u0000\u0000"
+ "\u03c3\u03c4\u0005<\u0000\u0000\u03c4\u03c8\u0005>\u0000\u0000\u03c5\u03c6"
+ "\u0005!\u0000\u0000\u03c6\u03c8\u0005=\u0000\u0000\u03c7\u03c3\u0001\u0000"
+ "\u0000\u0000\u03c7\u03c5\u0001\u0000\u0000\u0000\u03c8\u00e4\u0001\u0000"
+ "\u0000\u0000\u03c9\u03ca\u0005<\u0000\u0000\u03ca\u00e6\u0001\u0000\u0000"
+ "\u0000\u03cb\u03cc\u0005<\u0000\u0000\u03cc\u03cd\u0005=\u0000\u0000\u03cd"
+ "\u00e8\u0001\u0000\u0000\u0000\u03ce\u03cf\u0005>\u0000\u0000\u03cf\u00ea"
+ "\u0001\u0000\u0000\u0000\u03d0\u03d1\u0005>\u0000\u0000\u03d1\u03d2\u0005"
+ "=\u0000\u0000\u03d2\u00ec\u0001\u0000\u0000\u0000\u03d3\u03d4\u0005+\u0000"
+ "\u0000\u03d4\u00ee\u0001\u0000\u0000\u0000\u03d5\u03d6\u0005-\u0000\u0000"
+ "\u03d6\u00f0\u0001\u0000\u0000\u0000\u03d7\u03d8\u0005*\u0000\u0000\u03d8"
+ "\u00f2\u0001\u0000\u0000\u0000\u03d9\u03da\u0005/\u0000\u0000\u03da\u00f4"
+ "\u0001\u0000\u0000\u0000\u03db\u03dc\u0005%\u0000\u0000\u03dc\u00f6\u0001"
+ "\u0000\u0000\u0000\u03dd\u03de\u0005:\u0000\u0000\u03de\u03df\u0005:\u0000"
+ "\u0000\u03df\u00f8\u0001\u0000\u0000\u0000\u03e0\u03e1\u0005.\u0000\u0000"
+ "\u03e1\u00fa\u0001\u0000\u0000\u0000\u03e2\u03e3\u0005?\u0000\u0000\u03e3"
+ "\u00fc\u0001\u0000\u0000\u0000\u03e4\u03ea\u0005\'\u0000\u0000\u03e5\u03e9"
+ "\b\u0000\u0000\u0000\u03e6\u03e7\u0005\'\u0000\u0000\u03e7\u03e9\u0005"
+ "\'\u0000\u0000\u03e8\u03e5\u0001\u0000\u0000\u0000\u03e8\u03e6\u0001\u0000"
+ "\u0000\u0000\u03e9\u03ec\u0001\u0000\u0000\u0000\u03ea\u03e8\u0001\u0000"
+ "\u0000\u0000\u03ea\u03eb\u0001\u0000\u0000\u0000\u03eb\u03ed\u0001\u0000"
+ "\u0000\u0000\u03ec\u03ea\u0001\u0000\u0000\u0000\u03ed\u03ee\u0005\'\u0000"
+ "\u0000\u03ee\u00fe\u0001\u0000\u0000\u0000\u03ef\u03f1\u0003\u010f\u0087"
+ "\u0000\u03f0\u03ef\u0001\u0000\u0000\u0000\u03f1\u03f2\u0001\u0000\u0000"
+ "\u0000\u03f2\u03f0\u0001\u0000\u0000\u0000\u03f2\u03f3\u0001\u0000\u0000"
+ "\u0000\u03f3\u0100\u0001\u0000\u0000\u0000\u03f4\u03f6\u0003\u010f\u0087"
+ "\u0000\u03f5\u03f4\u0001\u0000\u0000\u0000\u03f6\u03f7\u0001\u0000\u0000"
+ "\u0000\u03f7\u03f5\u0001\u0000\u0000\u0000\u03f7\u03f8\u0001\u0000\u0000"
+ "\u0000\u03f8\u03f9\u0001\u0000\u0000\u0000\u03f9\u03fd\u0003\u00f9|\u0000"
+ "\u03fa\u03fc\u0003\u010f\u0087\u0000\u03fb\u03fa\u0001\u0000\u0000\u0000"
+ "\u03fc\u03ff\u0001\u0000\u0000\u0000\u03fd\u03fb\u0001\u0000\u0000\u0000"
+ "\u03fd\u03fe\u0001\u0000\u0000\u0000\u03fe\u041f\u0001\u0000\u0000\u0000"
+ "\u03ff\u03fd\u0001\u0000\u0000\u0000\u0400\u0402\u0003\u00f9|\u0000\u0401"
+ "\u0403\u0003\u010f\u0087\u0000\u0402\u0401\u0001\u0000\u0000\u0000\u0403"
+ "\u0404\u0001\u0000\u0000\u0000\u0404\u0402\u0001\u0000\u0000\u0000\u0404"
+ "\u0405\u0001\u0000\u0000\u0000\u0405\u041f\u0001\u0000\u0000\u0000\u0406"
+ "\u0408\u0003\u010f\u0087\u0000\u0407\u0406\u0001\u0000\u0000\u0000\u0408"
+ "\u0409\u0001\u0000\u0000\u0000\u0409\u0407\u0001\u0000\u0000\u0000\u0409"
+ "\u040a\u0001\u0000\u0000\u0000\u040a\u0412\u0001\u0000\u0000\u0000\u040b"
+ "\u040f\u0003\u00f9|\u0000\u040c\u040e\u0003\u010f\u0087\u0000\u040d\u040c"
+ "\u0001\u0000\u0000\u0000\u040e\u0411\u0001\u0000\u0000\u0000\u040f\u040d"
+ "\u0001\u0000\u0000\u0000\u040f\u0410\u0001\u0000\u0000\u0000\u0410\u0413"
+ "\u0001\u0000\u0000\u0000\u0411\u040f\u0001\u0000\u0000\u0000\u0412\u040b"
+ "\u0001\u0000\u0000\u0000\u0412\u0413\u0001\u0000\u0000\u0000\u0413\u0414"
+ "\u0001\u0000\u0000\u0000\u0414\u0415\u0003\u010d\u0086\u0000\u0415\u041f"
+ "\u0001\u0000\u0000\u0000\u0416\u0418\u0003\u00f9|\u0000\u0417\u0419\u0003"
+ "\u010f\u0087\u0000\u0418\u0417\u0001\u0000\u0000\u0000\u0419\u041a\u0001"
+ "\u0000\u0000\u0000\u041a\u0418\u0001\u0000\u0000\u0000\u041a\u041b\u0001"
+ "\u0000\u0000\u0000\u041b\u041c\u0001\u0000\u0000\u0000\u041c\u041d\u0003"
+ "\u010d\u0086\u0000\u041d\u041f\u0001\u0000\u0000\u0000\u041e\u03f5\u0001"
+ "\u0000\u0000\u0000\u041e\u0400\u0001\u0000\u0000\u0000\u041e\u0407\u0001"
+ "\u0000\u0000\u0000\u041e\u0416\u0001\u0000\u0000\u0000\u041f\u0102\u0001"
+ "\u0000\u0000\u0000\u0420\u0423\u0003\u0111\u0088\u0000\u0421\u0423\u0005"
+ "_\u0000\u0000\u0422\u0420\u0001\u0000\u0000\u0000\u0422\u0421\u0001\u0000"
+ "\u0000\u0000\u0423\u0429\u0001\u0000\u0000\u0000\u0424\u0428\u0003\u0111"
+ "\u0088\u0000\u0425\u0428\u0003\u010f\u0087\u0000\u0426\u0428\u0007\u0001"
+ "\u0000\u0000\u0427\u0424\u0001\u0000\u0000\u0000\u0427\u0425\u0001\u0000"
+ "\u0000\u0000\u0427\u0426\u0001\u0000\u0000\u0000\u0428\u042b\u0001\u0000"
+ "\u0000\u0000\u0429\u0427\u0001\u0000\u0000\u0000\u0429\u042a\u0001\u0000"
+ "\u0000\u0000\u042a\u0104\u0001\u0000\u0000\u0000\u042b\u0429\u0001\u0000"
+ "\u0000\u0000\u042c\u0430\u0003\u010f\u0087\u0000\u042d\u0431\u0003\u0111"
+ "\u0088\u0000\u042e\u0431\u0003\u010f\u0087\u0000\u042f\u0431\u0007\u0001"
+ "\u0000\u0000\u0430\u042d\u0001\u0000\u0000\u0000\u0430\u042e\u0001\u0000"
+ "\u0000\u0000\u0430\u042f\u0001\u0000\u0000\u0000\u0431\u0432\u0001\u0000"
+ "\u0000\u0000\u0432\u0430\u0001\u0000\u0000\u0000\u0432\u0433\u0001\u0000"
+ "\u0000\u0000\u0433\u0106\u0001\u0000\u0000\u0000\u0434\u0438\u0003\u0111"
+ "\u0088\u0000\u0435\u0438\u0003\u010f\u0087\u0000\u0436\u0438\u0005_\u0000"
+ "\u0000\u0437\u0434\u0001\u0000\u0000\u0000\u0437\u0435\u0001\u0000\u0000"
+ "\u0000\u0437\u0436\u0001\u0000\u0000\u0000\u0438\u0439\u0001\u0000\u0000"
+ "\u0000\u0439\u0437\u0001\u0000\u0000\u0000\u0439\u043a\u0001\u0000\u0000"
+ "\u0000\u043a\u0108\u0001\u0000\u0000\u0000\u043b\u0441\u0005\"\u0000\u0000"
+ "\u043c\u0440\b\u0002\u0000\u0000\u043d\u043e\u0005\"\u0000\u0000\u043e"
+ "\u0440\u0005\"\u0000\u0000\u043f\u043c\u0001\u0000\u0000\u0000\u043f\u043d"
+ "\u0001\u0000\u0000\u0000\u0440\u0443\u0001\u0000\u0000\u0000\u0441\u043f"
+ "\u0001\u0000\u0000\u0000\u0441\u0442\u0001\u0000\u0000\u0000\u0442\u0444"
+ "\u0001\u0000\u0000\u0000\u0443\u0441\u0001\u0000\u0000\u0000\u0444\u0445"
+ "\u0005\"\u0000\u0000\u0445\u010a\u0001\u0000\u0000\u0000\u0446\u044c\u0005"
+ "`\u0000\u0000\u0447\u044b\b\u0003\u0000\u0000\u0448\u0449\u0005`\u0000"
+ "\u0000\u0449\u044b\u0005`\u0000\u0000\u044a\u0447\u0001\u0000\u0000\u0000"
+ "\u044a\u0448\u0001\u0000\u0000\u0000\u044b\u044e\u0001\u0000\u0000\u0000"
+ "\u044c\u044a\u0001\u0000\u0000\u0000\u044c\u044d\u0001\u0000\u0000\u0000"
+ "\u044d\u044f\u0001\u0000\u0000\u0000\u044e\u044c\u0001\u0000\u0000\u0000"
+ "\u044f\u0450\u0005`\u0000\u0000\u0450\u010c\u0001\u0000\u0000\u0000\u0451"
+ "\u0453\u0005E\u0000\u0000\u0452\u0454\u0007\u0004\u0000\u0000\u0453\u0452"
+ "\u0001\u0000\u0000\u0000\u0453\u0454\u0001\u0000\u0000\u0000\u0454\u0456"
+ "\u0001\u0000\u0000\u0000\u0455\u0457\u0003\u010f\u0087\u0000\u0456\u0455"
+ "\u0001\u0000\u0000\u0000\u0457\u0458\u0001\u0000\u0000\u0000\u0458\u0456"
+ "\u0001\u0000\u0000\u0000\u0458\u0459\u0001\u0000\u0000\u0000\u0459\u010e"
+ "\u0001\u0000\u0000\u0000\u045a\u045b\u0007\u0005\u0000\u0000\u045b\u0110"
+ "\u0001\u0000\u0000\u0000\u045c\u045d\u0007\u0006\u0000\u0000\u045d\u0112"
+ "\u0001\u0000\u0000\u0000\u045e\u045f\u0005-\u0000\u0000\u045f\u0460\u0005"
+ "-\u0000\u0000\u0460\u0464\u0001\u0000\u0000\u0000\u0461\u0463\b\u0007"
+ "\u0000\u0000\u0462\u0461\u0001\u0000\u0000\u0000\u0463\u0466\u0001\u0000"
+ "\u0000\u0000\u0464\u0462\u0001\u0000\u0000\u0000\u0464\u0465\u0001\u0000"
+ "\u0000\u0000\u0465\u0468\u0001\u0000\u0000\u0000\u0466\u0464\u0001\u0000"
+ "\u0000\u0000\u0467\u0469\u0005\r\u0000\u0000\u0468\u0467\u0001\u0000\u0000"
+ "\u0000\u0468\u0469\u0001\u0000\u0000\u0000\u0469\u046b\u0001\u0000\u0000"
+ "\u0000\u046a\u046c\u0005\n\u0000\u0000\u046b\u046a\u0001\u0000\u0000\u0000"
+ "\u046b\u046c\u0001\u0000\u0000\u0000\u046c\u046d\u0001\u0000\u0000\u0000"
+ "\u046d\u046e\u0006\u0089\u0000\u0000\u046e\u0114\u0001\u0000\u0000\u0000"
+ "\u046f\u0470\u0005/\u0000\u0000\u0470\u0471\u0005*\u0000\u0000\u0471\u0476"
+ "\u0001\u0000\u0000\u0000\u0472\u0475\u0003\u0115\u008a\u0000\u0473\u0475"
+ "\t\u0000\u0000\u0000\u0474\u0472\u0001\u0000\u0000\u0000\u0474\u0473\u0001"
+ "\u0000\u0000\u0000\u0475\u0478\u0001\u0000\u0000\u0000\u0476\u0477\u0001"
+ "\u0000\u0000\u0000\u0476\u0474\u0001\u0000\u0000\u0000\u0477\u0479\u0001"
+ "\u0000\u0000\u0000\u0478\u0476\u0001\u0000\u0000\u0000\u0479\u047a\u0005"
+ "*\u0000\u0000\u047a\u047b\u0005/\u0000\u0000\u047b\u047c\u0001\u0000\u0000"
+ "\u0000\u047c\u047d\u0006\u008a\u0000\u0000\u047d\u0116\u0001\u0000\u0000"
+ "\u0000\u047e\u0480\u0007\b\u0000\u0000\u047f\u047e\u0001\u0000\u0000\u0000"
+ "\u0480\u0481\u0001\u0000\u0000\u0000\u0481\u047f\u0001\u0000\u0000\u0000"
+ "\u0481\u0482\u0001\u0000\u0000\u0000\u0482\u0483\u0001\u0000\u0000\u0000"
+ "\u0483\u0484\u0006\u008b\u0000\u0000\u0484\u0118\u0001\u0000\u0000\u0000"
+ "\u0485\u0486\t\u0000\u0000\u0000\u0486\u011a\u0001\u0000\u0000\u0000!"
+ "\u0000\u03b8\u03c7\u03e8\u03ea\u03f2\u03f7\u03fd\u0404\u0409\u040f\u0412"
+ "\u041a\u041e\u0422\u0427\u0429\u0430\u0432\u0437\u0439\u043f\u0441\u044a"
+ "\u044c\u0453\u0458\u0464\u0468\u046b\u0474\u0476\u0481\u0001\u0000\u0001"
+ "\u0000";
public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}
|
SqlBaseLexer
|
java
|
apache__flink
|
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/JobInitializationMetrics.java
|
{
"start": 898,
"end": 2740
}
|
class ____ {
public static final long UNSET = -1;
private final long checkpointId;
private final long stateSize;
private final InitializationStatus status;
private final long initializationStartTs;
private final long initializationEndTs;
private final Map<String, SumMaxDuration> durationMetrics;
public JobInitializationMetrics(
long checkpointId,
long stateSize,
InitializationStatus status,
long initializationStartTs,
long initializationEndTs,
Map<String, SumMaxDuration> durationMetrics) {
this.checkpointId = checkpointId;
this.stateSize = stateSize;
this.status = status;
this.initializationStartTs = initializationStartTs;
this.initializationEndTs = initializationEndTs;
this.durationMetrics = durationMetrics;
}
public long getCheckpointId() {
return checkpointId;
}
public long getStateSize() {
return stateSize;
}
public InitializationStatus getStatus() {
return status;
}
public long getStartTs() {
return initializationStartTs;
}
public long getEndTs() {
return initializationEndTs;
}
public Map<String, SumMaxDuration> getDurationMetrics() {
return durationMetrics;
}
@Override
public String toString() {
return this.getClass().getSimpleName()
+ "{"
+ "checkpointId="
+ checkpointId
+ ", stateSize="
+ stateSize
+ ", status="
+ status
+ ", initializationStartTs="
+ initializationStartTs
+ ", "
+ durationMetrics
+ "}";
}
static
|
JobInitializationMetrics
|
java
|
alibaba__fastjson
|
src/test/java/com/alibaba/json/bvt/bug/Bug_for_lenolix_4.java
|
{
"start": 269,
"end": 1359
}
|
class ____ extends TestCase {
public void test_for_objectKey() throws Exception {
Map<Map<String, String>, String> map = new HashMap<Map<String, String>, String>();
Map<String, String> submap = new HashMap<String, String>();
submap.put("subkey", "subvalue");
map.put(submap, "value");
String jsonString = JSON.toJSONString(map, SerializerFeature.WriteClassName);
System.out.println(jsonString);
Object object = JSON.parse(jsonString);
JSON.parseObject(jsonString);
System.out.println(object.toString());
}
public void test_for_arrayKey() throws Exception {
Map<List<String>, String> map = new HashMap<List<String>, String>();
List<String> key = new ArrayList<String>();
key.add("subkey");
map.put(key, "value");
String jsonString = JSON.toJSONString(map, SerializerFeature.WriteClassName);
System.out.println(jsonString);
Object object = JSON.parse(jsonString);
System.out.println(object.toString());
}
}
|
Bug_for_lenolix_4
|
java
|
apache__camel
|
dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsBedrockAgentComponentBuilderFactory.java
|
{
"start": 1901,
"end": 19431
}
|
interface ____ extends ComponentBuilder<BedrockAgentComponent> {
/**
* Component configuration.
*
* The option is a:
* <code>org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration</code> type.
*
* Group: common
*
* @param configuration the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder configuration(org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration configuration) {
doSetProperty("configuration", configuration);
return this;
}
/**
* Define the Data source Id we are going to use.
*
* The option is a: <code>java.lang.String</code> type.
*
* Group: common
*
* @param dataSourceId the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder dataSourceId(java.lang.String dataSourceId) {
doSetProperty("dataSourceId", dataSourceId);
return this;
}
/**
* Define the Knowledge Base Id we are going to use.
*
* The option is a: <code>java.lang.String</code> type.
*
* Group: common
*
* @param knowledgeBaseId the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder knowledgeBaseId(java.lang.String knowledgeBaseId) {
doSetProperty("knowledgeBaseId", knowledgeBaseId);
return this;
}
/**
* Define the model Id we are going to use.
*
* The option is a: <code>java.lang.String</code> type.
*
* Group: common
*
* @param modelId the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder modelId(java.lang.String modelId) {
doSetProperty("modelId", modelId);
return this;
}
/**
* The operation to perform.
*
* The option is a:
* <code>org.apache.camel.component.aws2.bedrock.agent.BedrockAgentOperations</code> type.
*
* Group: common
*
* @param operation the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder operation(org.apache.camel.component.aws2.bedrock.agent.BedrockAgentOperations operation) {
doSetProperty("operation", operation);
return this;
}
/**
* Set the need for overriding the endpoint. This option needs to be
* used in combination with the uriEndpointOverride option.
*
* The option is a: <code>boolean</code> type.
*
* Default: false
* Group: common
*
* @param overrideEndpoint the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder overrideEndpoint(boolean overrideEndpoint) {
doSetProperty("overrideEndpoint", overrideEndpoint);
return this;
}
/**
* If we want to use a POJO request as body or not.
*
* The option is a: <code>boolean</code> type.
*
* Default: false
* Group: common
*
* @param pojoRequest the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder pojoRequest(boolean pojoRequest) {
doSetProperty("pojoRequest", pojoRequest);
return this;
}
/**
* If using a profile credentials provider, this parameter will set the
* profile name.
*
* The option is a: <code>java.lang.String</code> type.
*
* Default: false
* Group: common
*
* @param profileCredentialsName the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder profileCredentialsName(java.lang.String profileCredentialsName) {
doSetProperty("profileCredentialsName", profileCredentialsName);
return this;
}
/**
* The region in which Bedrock Agent client needs to work. When using
* this parameter, the configuration will expect the lowercase name of
* the region (for example, ap-east-1) You'll need to use the name
* Region.EU_WEST_1.id().
*
* The option is a: <code>java.lang.String</code> type.
*
* Group: common
*
* @param region the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder region(java.lang.String region) {
doSetProperty("region", region);
return this;
}
/**
* Set the overriding uri endpoint. This option needs to be used in
* combination with overrideEndpoint option.
*
* The option is a: <code>java.lang.String</code> type.
*
* Group: common
*
* @param uriEndpointOverride the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder uriEndpointOverride(java.lang.String uriEndpointOverride) {
doSetProperty("uriEndpointOverride", uriEndpointOverride);
return this;
}
/**
* Set whether the Bedrock Agent client should expect to load
* credentials through a default credentials provider or to expect
* static credentials to be passed in.
*
* The option is a: <code>boolean</code> type.
*
* Default: false
* Group: common
*
* @param useDefaultCredentialsProvider the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder useDefaultCredentialsProvider(boolean useDefaultCredentialsProvider) {
doSetProperty("useDefaultCredentialsProvider", useDefaultCredentialsProvider);
return this;
}
/**
* Set whether the Bedrock Agent client should expect to load
* credentials through a profile credentials provider.
*
* The option is a: <code>boolean</code> type.
*
* Default: false
* Group: common
*
* @param useProfileCredentialsProvider the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder useProfileCredentialsProvider(boolean useProfileCredentialsProvider) {
doSetProperty("useProfileCredentialsProvider", useProfileCredentialsProvider);
return this;
}
/**
* Allows for bridging the consumer to the Camel routing Error Handler,
* which mean any exceptions (if possible) occurred while the Camel
* consumer is trying to pickup incoming messages, or the likes, will
* now be processed as a message and handled by the routing Error
* Handler. Important: This is only possible if the 3rd party component
* allows Camel to be alerted if an exception was thrown. Some
* components handle this internally only, and therefore
* bridgeErrorHandler is not possible. In other situations we may
* improve the Camel component to hook into the 3rd party component and
* make this possible for future releases. By default the consumer will
* use the org.apache.camel.spi.ExceptionHandler to deal with
* exceptions, that will be logged at WARN or ERROR level and ignored.
*
* The option is a: <code>boolean</code> type.
*
* Default: false
* Group: consumer
*
* @param bridgeErrorHandler the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder bridgeErrorHandler(boolean bridgeErrorHandler) {
doSetProperty("bridgeErrorHandler", bridgeErrorHandler);
return this;
}
/**
* Define the Ingestion Job Id we want to track.
*
* The option is a: <code>java.lang.String</code> type.
*
* Group: consumer
*
* @param ingestionJobId the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder ingestionJobId(java.lang.String ingestionJobId) {
doSetProperty("ingestionJobId", ingestionJobId);
return this;
}
/**
* Whether the producer should be started lazy (on the first message).
* By starting lazy you can use this to allow CamelContext and routes to
* startup in situations where a producer may otherwise fail during
* starting and cause the route to fail being started. By deferring this
* startup to be lazy then the startup failure can be handled during
* routing messages via Camel's routing error handlers. Beware that when
* the first message is processed then creating and starting the
* producer may take a little time and prolong the total processing time
* of the processing.
*
* The option is a: <code>boolean</code> type.
*
* Default: false
* Group: producer
*
* @param lazyStartProducer the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder lazyStartProducer(boolean lazyStartProducer) {
doSetProperty("lazyStartProducer", lazyStartProducer);
return this;
}
/**
* Whether autowiring is enabled. This is used for automatic autowiring
* options (the option must be marked as autowired) by looking up in the
* registry to find if there is a single instance of matching type,
* which then gets configured on the component. This can be used for
* automatic configuring JDBC data sources, JMS connection factories,
* AWS Clients, etc.
*
* The option is a: <code>boolean</code> type.
*
* Default: true
* Group: advanced
*
* @param autowiredEnabled the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder autowiredEnabled(boolean autowiredEnabled) {
doSetProperty("autowiredEnabled", autowiredEnabled);
return this;
}
/**
* To use an existing configured AWS Bedrock Agent client.
*
* The option is a:
* <code>software.amazon.awssdk.services.bedrockagent.BedrockAgentClient</code> type.
*
* Group: advanced
*
* @param bedrockAgentClient the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder bedrockAgentClient(software.amazon.awssdk.services.bedrockagent.BedrockAgentClient bedrockAgentClient) {
doSetProperty("bedrockAgentClient", bedrockAgentClient);
return this;
}
/**
* Used for enabling or disabling all consumer based health checks from
* this component.
*
* The option is a: <code>boolean</code> type.
*
* Default: true
* Group: health
*
* @param healthCheckConsumerEnabled the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder healthCheckConsumerEnabled(boolean healthCheckConsumerEnabled) {
doSetProperty("healthCheckConsumerEnabled", healthCheckConsumerEnabled);
return this;
}
/**
* Used for enabling or disabling all producer based health checks from
* this component. Notice: Camel has by default disabled all producer
* based health-checks. You can turn on producer checks globally by
* setting camel.health.producersEnabled=true.
*
* The option is a: <code>boolean</code> type.
*
* Default: true
* Group: health
*
* @param healthCheckProducerEnabled the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder healthCheckProducerEnabled(boolean healthCheckProducerEnabled) {
doSetProperty("healthCheckProducerEnabled", healthCheckProducerEnabled);
return this;
}
/**
* To define a proxy host when instantiating the Bedrock Agent client.
*
* The option is a: <code>java.lang.String</code> type.
*
* Group: proxy
*
* @param proxyHost the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder proxyHost(java.lang.String proxyHost) {
doSetProperty("proxyHost", proxyHost);
return this;
}
/**
* To define a proxy port when instantiating the Bedrock Agent client.
*
* The option is a: <code>java.lang.Integer</code> type.
*
* Group: proxy
*
* @param proxyPort the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder proxyPort(java.lang.Integer proxyPort) {
doSetProperty("proxyPort", proxyPort);
return this;
}
/**
* To define a proxy protocol when instantiating the Bedrock Agent
* client.
*
* The option is a:
* <code>software.amazon.awssdk.core.Protocol</code> type.
*
* Default: HTTPS
* Group: proxy
*
* @param proxyProtocol the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder proxyProtocol(software.amazon.awssdk.core.Protocol proxyProtocol) {
doSetProperty("proxyProtocol", proxyProtocol);
return this;
}
/**
* Amazon AWS Access Key.
*
* The option is a: <code>java.lang.String</code> type.
*
* Group: security
*
* @param accessKey the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder accessKey(java.lang.String accessKey) {
doSetProperty("accessKey", accessKey);
return this;
}
/**
* Amazon AWS Secret Key.
*
* The option is a: <code>java.lang.String</code> type.
*
* Group: security
*
* @param secretKey the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder secretKey(java.lang.String secretKey) {
doSetProperty("secretKey", secretKey);
return this;
}
/**
* Amazon AWS Session Token used when the user needs to assume an IAM
* role.
*
* The option is a: <code>java.lang.String</code> type.
*
* Group: security
*
* @param sessionToken the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder sessionToken(java.lang.String sessionToken) {
doSetProperty("sessionToken", sessionToken);
return this;
}
/**
* If we want to trust all certificates in case of overriding the
* endpoint.
*
* The option is a: <code>boolean</code> type.
*
* Default: false
* Group: security
*
* @param trustAllCertificates the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder trustAllCertificates(boolean trustAllCertificates) {
doSetProperty("trustAllCertificates", trustAllCertificates);
return this;
}
/**
* Set whether the Bedrock Agent client should expect to use Session
* Credentials. This is useful in a situation in which the user needs to
* assume an IAM role for doing operations in Bedrock.
*
* The option is a: <code>boolean</code> type.
*
* Default: false
* Group: security
*
* @param useSessionCredentials the value to set
* @return the dsl builder
*/
default AwsBedrockAgentComponentBuilder useSessionCredentials(boolean useSessionCredentials) {
doSetProperty("useSessionCredentials", useSessionCredentials);
return this;
}
}
|
AwsBedrockAgentComponentBuilder
|
java
|
spring-projects__spring-framework
|
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/TransportType.java
|
{
"start": 996,
"end": 2603
}
|
enum ____ {
WEBSOCKET("websocket", HttpMethod.GET, "origin"),
XHR("xhr", HttpMethod.POST, "cors", "jsessionid", "no_cache"),
XHR_SEND("xhr_send", HttpMethod.POST, "cors", "jsessionid", "no_cache"),
XHR_STREAMING("xhr_streaming", HttpMethod.POST, "cors", "jsessionid", "no_cache"),
EVENT_SOURCE("eventsource", HttpMethod.GET, "origin", "jsessionid", "no_cache"),
HTML_FILE("htmlfile", HttpMethod.GET, "cors", "jsessionid", "no_cache");
private static final Map<String, TransportType> TRANSPORT_TYPES =
Arrays.stream(values()).collect(Collectors.toUnmodifiableMap(type -> type.value, type -> type));
public static @Nullable TransportType fromValue(String value) {
return TRANSPORT_TYPES.get(value);
}
private final String value;
private final HttpMethod httpMethod;
private final List<String> headerHints;
TransportType(String value, HttpMethod httpMethod, String... headerHints) {
this.value = value;
this.httpMethod = httpMethod;
this.headerHints = Arrays.asList(headerHints);
}
public String value() {
return this.value;
}
public HttpMethod getHttpMethod() {
return this.httpMethod;
}
public boolean sendsNoCacheInstruction() {
return this.headerHints.contains("no_cache");
}
public boolean sendsSessionCookie() {
return this.headerHints.contains("jsessionid");
}
public boolean supportsCors() {
return this.headerHints.contains("cors");
}
public boolean supportsOrigin() {
return this.headerHints.contains("cors") || this.headerHints.contains("origin");
}
@Override
public String toString() {
return this.value;
}
}
|
TransportType
|
java
|
apache__spark
|
sql/core/src/test/java/test/org/apache/spark/sql/JavaDataFrameWriterV2Suite.java
|
{
"start": 1513,
"end": 4099
}
|
class ____ {
private static StructType schema = new StructType().add("s", "string");
private SparkSession spark = null;
public Dataset<Row> df() {
return spark.read().schema(schema).text();
}
@BeforeEach
public void createTestTable() {
this.spark = new TestSparkSession();
spark.conf().set("spark.sql.catalog.testcat", InMemoryTableCatalog.class.getName());
spark.sql("CREATE TABLE testcat.t (s string) USING foo");
}
@AfterEach
public void dropTestTable() {
spark.sql("DROP TABLE testcat.t");
spark.stop();
}
@Test
public void testAppendAPI() throws NoSuchTableException {
df().writeTo("testcat.t").append();
df().writeTo("testcat.t").option("property", "value").append();
}
@Test
public void testOverwritePartitionsAPI() throws NoSuchTableException {
df().writeTo("testcat.t").overwritePartitions();
df().writeTo("testcat.t").option("property", "value").overwritePartitions();
}
@Test
public void testOverwriteAPI() throws NoSuchTableException {
df().writeTo("testcat.t").overwrite(lit(true));
df().writeTo("testcat.t").option("property", "value").overwrite(lit(true));
}
@Test
public void testCreateAPI() throws TableAlreadyExistsException {
df().writeTo("testcat.t2").create();
spark.sql("DROP TABLE testcat.t2");
df().writeTo("testcat.t2").option("property", "value").create();
spark.sql("DROP TABLE testcat.t2");
df().writeTo("testcat.t2").tableProperty("property", "value").create();
spark.sql("DROP TABLE testcat.t2");
df().writeTo("testcat.t2").using("v2format").create();
spark.sql("DROP TABLE testcat.t2");
df().writeTo("testcat.t2").partitionedBy(col("s")).create();
spark.sql("DROP TABLE testcat.t2");
}
@Test
public void testReplaceAPI() throws CannotReplaceMissingTableException {
df().writeTo("testcat.t").replace();
df().writeTo("testcat.t").option("property", "value").replace();
df().writeTo("testcat.t").tableProperty("property", "value").replace();
df().writeTo("testcat.t").using("v2format").replace();
df().writeTo("testcat.t").partitionedBy(col("s")).replace();
}
@Test
public void testCreateOrReplaceAPI() {
df().writeTo("testcat.t").createOrReplace();
df().writeTo("testcat.t").option("property", "value").createOrReplace();
df().writeTo("testcat.t").tableProperty("property", "value").createOrReplace();
df().writeTo("testcat.t").using("v2format").createOrReplace();
df().writeTo("testcat.t").partitionedBy(col("s")).createOrReplace();
}
}
|
JavaDataFrameWriterV2Suite
|
java
|
google__auto
|
common/src/main/java/com/google/auto/common/MoreStreams.java
|
{
"start": 1194,
"end": 1465
}
|
class ____ useful when those APIs were not part of the Android flavor of Guava, since the
* Android flavor somehow finds its way onto the processor classpath. Now that the APIs are part of
* the Android flavor of Guava, there is no need for this class.
*/
public final
|
was
|
java
|
spring-projects__spring-framework
|
spring-test/src/test/java/org/springframework/test/context/support/BootstrapTestUtilsMergedConfigTests.java
|
{
"start": 22606,
"end": 22698
}
|
class ____ extends SubEmptyConfigTestCase {
@Configuration
static
|
SubSubEmptyConfigTestCase
|
java
|
spring-projects__spring-security
|
web/src/main/java/org/springframework/security/web/server/jackson/DefaultCsrfServerTokenMixin.java
|
{
"start": 867,
"end": 1151
}
|
class ____ serialize/deserialize
* {@link org.springframework.security.web.server.csrf.DefaultCsrfToken} serialization
* support.
*
* @author Sebastien Deleuze
* @author Boris Finkelshteyn
* @since 7.0
* @see WebServerJacksonModule
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
|
to
|
java
|
FasterXML__jackson-databind
|
src/test/java/tools/jackson/databind/deser/creators/BeanDeserializerFactory4920Test.java
|
{
"start": 2925,
"end": 2967
}
|
interface ____ {
}
static final
|
Value
|
java
|
apache__camel
|
components/camel-grpc/src/test/java/org/apache/camel/component/grpc/GrpcConsumerConcurrentTest.java
|
{
"start": 7244,
"end": 7974
}
|
class ____ implements StreamObserver<PongResponse> {
private PongResponse pongResponse;
private final CountDownLatch latch;
public PongResponseStreamObserver(CountDownLatch latch) {
this.latch = latch;
}
public PongResponse getPongResponse() {
return pongResponse;
}
@Override
public void onNext(PongResponse value) {
pongResponse = value;
}
@Override
public void onError(Throwable t) {
LOG.info("Exception", t);
latch.countDown();
}
@Override
public void onCompleted() {
latch.countDown();
}
}
static
|
PongResponseStreamObserver
|
java
|
alibaba__fastjson
|
src/test/java/com/alibaba/json/bvt/serializer/fieldbase/FieldBaseTest1.java
|
{
"start": 1036,
"end": 1104
}
|
class ____ extends AbstractModel {
private int id;
}
}
|
Model
|
java
|
google__guava
|
guava/src/com/google/common/collect/IndexedImmutableSet.java
|
{
"start": 998,
"end": 2661
}
|
class ____<E> extends ImmutableSet.CachingAsList<E> {
abstract E get(int index);
@Override
public UnmodifiableIterator<E> iterator() {
return asList().iterator();
}
@Override
public Spliterator<E> spliterator() {
return CollectSpliterators.indexed(size(), SPLITERATOR_CHARACTERISTICS, this::get);
}
@Override
public void forEach(Consumer<? super E> consumer) {
checkNotNull(consumer);
int n = size();
for (int i = 0; i < n; i++) {
consumer.accept(get(i));
}
}
@Override
@GwtIncompatible
int copyIntoArray(@Nullable Object[] dst, int offset) {
return asList().copyIntoArray(dst, offset);
}
@Override
ImmutableList<E> createAsList() {
return new ImmutableAsList<E>() {
@Override
public E get(int index) {
return IndexedImmutableSet.this.get(index);
}
@Override
boolean isPartialView() {
return IndexedImmutableSet.this.isPartialView();
}
@Override
public int size() {
return IndexedImmutableSet.this.size();
}
@Override
ImmutableCollection<E> delegateCollection() {
return IndexedImmutableSet.this;
}
// redeclare to help optimizers with b/310253115
@SuppressWarnings("RedundantOverride")
@Override
@J2ktIncompatible
@GwtIncompatible
Object writeReplace() {
return super.writeReplace();
}
};
}
// redeclare to help optimizers with b/310253115
@SuppressWarnings("RedundantOverride")
@Override
@J2ktIncompatible
@GwtIncompatible
Object writeReplace() {
return super.writeReplace();
}
}
|
IndexedImmutableSet
|
java
|
hibernate__hibernate-orm
|
hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistry.java
|
{
"start": 361,
"end": 440
}
|
interface ____ extends ServiceRegistryImplementor {
}
|
SessionFactoryServiceRegistry
|
java
|
grpc__grpc-java
|
android-interop-testing/src/main/java/io/grpc/android/integrationtest/TestCallable.java
|
{
"start": 1024,
"end": 4822
}
|
class ____ implements Callable<String> {
private final ManagedChannel channel;
private final String testCase;
private static final String LOG_TAG = "GrpcInteropTask";
static final String SUCCESS_MESSAGE = "Success!";
public TestCallable(ManagedChannel channel, String testCase) {
this.channel = channel;
this.testCase = testCase;
}
@Override
public String call() {
Tester tester = new Tester(channel);
tester.setUp();
try {
runTest(tester, testCase);
return SUCCESS_MESSAGE;
} catch (Throwable t) {
// Print the stack trace to logcat.
t.printStackTrace();
// Then print to the error message.
StringWriter sw = new StringWriter();
t.printStackTrace(new PrintWriter(sw));
return "Failed... : " + t.getMessage() + "\n" + sw;
} finally {
try {
tester.tearDown();
} catch (RuntimeException ex) {
throw ex;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
}
private void runTest(Tester tester, String testCase) throws Exception {
Log.i(LOG_TAG, "Running test case: " + testCase);
if ("empty_unary".equals(testCase)) {
tester.emptyUnary();
} else if ("large_unary".equals(testCase)) {
try {
tester.largeUnary();
} catch (AssumptionViolatedException e) {
// This test case requires more memory than most Android devices have available
Log.w(LOG_TAG, "Skipping " + testCase + " due to assumption violation", e);
}
} else if ("client_streaming".equals(testCase)) {
tester.clientStreaming();
} else if ("server_streaming".equals(testCase)) {
tester.serverStreaming();
} else if ("ping_pong".equals(testCase)) {
tester.pingPong();
} else if ("empty_stream".equals(testCase)) {
tester.emptyStream();
} else if ("cancel_after_begin".equals(testCase)) {
tester.cancelAfterBegin();
} else if ("cancel_after_first_response".equals(testCase)) {
tester.cancelAfterFirstResponse();
} else if ("full_duplex_call_should_succeed".equals(testCase)) {
tester.fullDuplexCallShouldSucceed();
} else if ("half_duplex_call_should_succeed".equals(testCase)) {
tester.halfDuplexCallShouldSucceed();
} else if ("server_streaming_should_be_flow_controlled".equals(testCase)) {
tester.serverStreamingShouldBeFlowControlled();
} else if ("very_large_request".equals(testCase)) {
try {
tester.veryLargeRequest();
} catch (AssumptionViolatedException e) {
// This test case requires more memory than most Android devices have available
Log.w(LOG_TAG, "Skipping " + testCase + " due to assumption violation", e);
}
} else if ("very_large_response".equals(testCase)) {
try {
tester.veryLargeResponse();
} catch (AssumptionViolatedException e) {
// This test case requires more memory than most Android devices have available
Log.w(LOG_TAG, "Skipping " + testCase + " due to assumption violation", e);
}
} else if ("deadline_not_exceeded".equals(testCase)) {
tester.deadlineNotExceeded();
} else if ("deadline_exceeded".equals(testCase)) {
tester.deadlineExceeded();
} else if ("deadline_exceeded_server_streaming".equals(testCase)) {
tester.deadlineExceededServerStreaming();
} else if ("unimplemented_method".equals(testCase)) {
tester.unimplementedMethod();
} else if ("timeout_on_sleeping_server".equals(testCase)) {
tester.timeoutOnSleepingServer();
} else if ("graceful_shutdown".equals(testCase)) {
tester.gracefulShutdown();
} else {
throw new IllegalArgumentException("Unimplemented/Unknown test case: " + testCase);
}
}
private static
|
TestCallable
|
java
|
apache__flink
|
flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/ModelProviderFactory.java
|
{
"start": 3422,
"end": 3640
}
|
class ____ is in particular useful for discovering further (nested) factories.
*/
ClassLoader getClassLoader();
/** Whether the model is temporary. */
boolean isTemporary();
}
}
|
loader
|
java
|
apache__flink
|
flink-runtime/src/main/java/org/apache/flink/runtime/rest/HttpMethodWrapper.java
|
{
"start": 1040,
"end": 1436
}
|
enum ____ {
GET(HttpMethod.GET),
POST(HttpMethod.POST),
DELETE(HttpMethod.DELETE),
PATCH(HttpMethod.PATCH),
PUT(HttpMethod.PUT);
private HttpMethod nettyHttpMethod;
HttpMethodWrapper(HttpMethod nettyHttpMethod) {
this.nettyHttpMethod = nettyHttpMethod;
}
public HttpMethod getNettyHttpMethod() {
return nettyHttpMethod;
}
}
|
HttpMethodWrapper
|
java
|
quarkusio__quarkus
|
extensions/observability-devservices/deployment/src/main/java/io/quarkus/observability/deployment/devui/ObservabilityDevServicesConfigBuildItem.java
|
{
"start": 209,
"end": 522
}
|
class ____ extends MultiBuildItem {
private final Map<String, String> config;
public ObservabilityDevServicesConfigBuildItem(Map<String, String> config) {
this.config = config;
}
public Map<String, String> getConfig() {
return config;
}
}
|
ObservabilityDevServicesConfigBuildItem
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.