Skip to content

Commit

Permalink
delegate getLaunchToken to child class
Browse files Browse the repository at this point in the history
  • Loading branch information
baisui1981 committed Apr 6, 2024
1 parent 4d6bf04 commit 28d3e35
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 23 deletions.
18 changes: 18 additions & 0 deletions tis-console/src/test/java/com/qlangtech/tis/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,30 @@

package com.qlangtech.tis;

import java.net.URL;
import java.util.Enumeration;

/**
* @author: 百岁([email protected]
* @create: 2024-03-06 10:41
**/
public class Test {
public static void main(String[] args) throws Exception {
System.out.println(Class.forName("com.qlangtech.tis.log.WaittingProcessCollectorAppender"));

Enumeration<URL> res = Thread.currentThread().getContextClassLoader().getResources("/org/apache/flink/calcite/shaded/org/codehaus/commons/compiler/CompileException.class");
while (res.hasMoreElements()) {
System.out.println(res.nextElement());
}
res = Thread.currentThread().getContextClassLoader().getResources("/org/codehaus/commons/compiler/CompileException.class");
while (res.hasMoreElements()) {
System.out.println(res.nextElement());
}

res = Thread.currentThread().getContextClassLoader().getResources("org/apache/flink/table/planner/calcite/FlinkRelOptClusterFactory.class");
while (res.hasMoreElements()) {
System.out.println(res.nextElement());
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ public static IncrStreamFactory getFactory(String indexName) {
return k8sConfig;
}

public ServerLaunchToken getLaunchToken(TargetResName indexName) {
return ServerLaunchToken.createFlinkClusterToken().token(this.getClusterType(), indexName);
// return incrLaunchToken;
}

public abstract ServerLaunchToken getLaunchToken(TargetResName indexName);
// {
// return ServerLaunchToken.createFlinkClusterToken().token(this.getClusterType(), indexName);
// // return incrLaunchToken;
// }

@Override
public boolean hasCreated(TargetResName collection) {
Expand Down
45 changes: 26 additions & 19 deletions tis-plugin/src/test/java/com/qlangtech/tis/TestTIS.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
/**
* 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
*
* https://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.
* 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
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 com.qlangtech.tis;

import com.google.common.collect.Lists;
import com.qlangtech.tis.common.utils.Assert;
import com.qlangtech.tis.extension.UberClassLoader;
import com.qlangtech.tis.manage.common.CenterResource;
import com.qlangtech.tis.manage.common.Config;
import com.qlangtech.tis.manage.common.HttpUtils;
import com.qlangtech.tis.util.PluginMeta;
import junit.framework.TestCase;
import org.apache.commons.lang3.StringUtils;

import java.io.File;
import java.net.URL;
import java.util.List;
import java.util.Set;

Expand All @@ -42,11 +42,18 @@ public class TestTIS extends TestCase {
public void setUp() throws Exception {
CenterResource.setNotFetchFromCenterRepository();
HttpUtils.addMockGlobalParametersConfig();
Config.setDataDir("./");
TIS.clean();
// Config.setDataDir("./");
// TIS.clean();
}

public void testLoadClass() throws Exception {

// String clazz = "org.apache.flink.calcite.shaded.org.codehaus.commons.compiler.CompileException";
String clazz ="org.apache.flink.table.planner.calcite.FlinkRelOptClusterFactory";

URL aClass = TIS.get().getPluginManager().uberClassLoader.getResource(StringUtils.replace(clazz, ".", "/") + ".class");
System.out.println(aClass);
}

public void testReadPluginInfo() throws Exception {
final String collectionRelativePath = Config.KEY_TIS_PLUGIN_CONFIG + "/" + collection;
Expand Down

0 comments on commit 28d3e35

Please sign in to comment.