Skip to content

Commit

Permalink
Fixes JAXB error
Browse files Browse the repository at this point in the history
  • Loading branch information
linghengqian committed Nov 12, 2023
1 parent b64db8e commit c8e5545
Show file tree
Hide file tree
Showing 10 changed files with 219 additions and 360 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.shardingsphere.infra.nativetest.jdbc.features;

import org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
import org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue;
import org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm;

import java.util.Collection;

@SuppressWarnings("unused")
public final class ClassBasedInlineShardingAlgorithmFixture implements StandardShardingAlgorithm<Integer> {

@Override
public String doSharding(final Collection<String> availableTargetNames, final PreciseShardingValue<Integer> shardingValue) {
String resultDatabaseName = "ds_" + shardingValue.getValue() % 2;
for (String each : availableTargetNames) {
if (each.equals(resultDatabaseName)) {
return each;
}
}
return null;
}

@Override
public Collection<String> doSharding(final Collection<String> availableTargetNames, final RangeShardingValue<Integer> shardingValue) {
throw new RuntimeException("This algorithm class does not support range queries.");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"resources":{
"includes":[{
"pattern":"\\Qsql/H2.xml\\E"
}, {
"pattern":"\\Qsql/MySQL.xml\\E"
}]},
"bundles":[]
}
34 changes: 0 additions & 34 deletions infra/nativetest/src/test/resources/logback.xml

This file was deleted.

8 changes: 6 additions & 2 deletions infra/nativetest/src/test/resources/yaml/sharding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,14 @@ rules:
shardingColumn: user_id
shardingAlgorithmName: inline
shardingAlgorithms:
# GroovyShell related classes are not available on GraalVM CE 23.0.2 For JDK 17.0.9,
# This CLASS_BASE algorithm class is designed to emulate INLINE's `ds_${user_id % 2}`.
# See https://github.com/oracle/graal/issues/5522 .
inline:
type: INLINE
type: CLASS_BASED
props:
algorithm-expression: ds_${user_id % 2}
strategy: STANDARD
algorithmClassName: org.apache.shardingsphere.infra.nativetest.jdbc.features.ClassBasedInlineShardingAlgorithmFixture
keyGenerators:
snowflake:
type: SNOWFLAKE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"name":"sun.management.VMManagementImpl",
"fields":[{"name":"compTimeMonitoringSupport"}, {"name":"currentThreadCpuTimeSupport"}, {"name":"objectMonitorUsageSupport"}, {"name":"otherThreadCpuTimeSupport"}, {"name":"remoteDiagnosticCommandsSupport"}, {"name":"synchronizerUsageSupport"}, {"name":"threadAllocatedMemorySupport"}, {"name":"threadContentionMonitoringSupport"}]
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
{
"interfaces":["java.sql.Connection"]
}
]
]
Loading

0 comments on commit c8e5545

Please sign in to comment.