-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support percent display show when dataX execution
- Loading branch information
1 parent
d228180
commit e401f09
Showing
11 changed files
with
337 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
tis-assemble/src/main/java/com/qlangtech/tis/order/center/impl/DefaultFlush2Local.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* 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> | ||
* http: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.order.center.impl; | ||
|
||
import com.qlangtech.tis.extension.impl.XmlFile; | ||
import com.qlangtech.tis.fullbuild.phasestatus.IFlush2Local; | ||
import com.qlangtech.tis.fullbuild.phasestatus.impl.BasicPhaseStatus; | ||
|
||
import java.io.File; | ||
import java.util.Collections; | ||
|
||
/** | ||
* @author: 百岁([email protected]) | ||
* @create: 2024-04-15 18:38 | ||
**/ | ||
public class DefaultFlush2Local implements IFlush2Local { | ||
private final XmlFile xmlFile; | ||
|
||
public DefaultFlush2Local(File localFile) { | ||
this.xmlFile = new XmlFile(localFile); | ||
} | ||
|
||
@Override | ||
public void write(BasicPhaseStatus status) throws Exception { | ||
xmlFile.write(status, Collections.emptySet()); | ||
} | ||
|
||
@Override | ||
public BasicPhaseStatus loadPhase() throws Exception { | ||
return (BasicPhaseStatus) xmlFile.read(); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...assemble/src/main/java/com/qlangtech/tis/order/center/impl/DefaultFlush2LocalFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* 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> | ||
* http: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.order.center.impl; | ||
|
||
import com.qlangtech.tis.fullbuild.phasestatus.IFlush2Local; | ||
import com.qlangtech.tis.fullbuild.phasestatus.IFlush2LocalFactory; | ||
|
||
import java.io.File; | ||
|
||
/** | ||
* @author: 百岁([email protected]) | ||
* @create: 2024-04-15 18:52 | ||
**/ | ||
public class DefaultFlush2LocalFactory implements IFlush2LocalFactory { | ||
@Override | ||
public IFlush2Local create(File localFile) { | ||
return new DefaultFlush2Local(localFile); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...n/resources/META-INF/services/com.qlangtech.tis.fullbuild.phasestatus.IFlush2LocalFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## | ||
# 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: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. | ||
# | ||
|
||
com.qlangtech.tis.order.center.impl.DefaultFlush2LocalFactory |
78 changes: 78 additions & 0 deletions
78
...mble/src/test/java/com/qlangtech/tis/fullbuild/phasestatus/TestPhaseStatusCollection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/** | ||
* 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> | ||
* http: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.fullbuild.phasestatus; | ||
|
||
import com.qlangtech.tis.assemble.FullbuildPhase; | ||
import com.qlangtech.tis.common.utils.Assert; | ||
import com.qlangtech.tis.exec.ExecutePhaseRange; | ||
import com.qlangtech.tis.fullbuild.phasestatus.impl.BasicPhaseStatus; | ||
import com.qlangtech.tis.fullbuild.phasestatus.impl.DumpPhaseStatus; | ||
import com.qlangtech.tis.fullbuild.phasestatus.impl.DumpPhaseStatus.TableDumpStatus; | ||
import junit.framework.TestCase; | ||
|
||
/** | ||
* @author: 百岁([email protected]) | ||
* @create: 2024-04-16 09:58 | ||
**/ | ||
public class TestPhaseStatusCollection extends TestCase { | ||
public void testISComplete() { | ||
Integer taskId = 999; | ||
|
||
PhaseStatusCollection statusCollection = new PhaseStatusCollection(taskId | ||
, new ExecutePhaseRange(FullbuildPhase.FullDump, FullbuildPhase.FullDump)); | ||
|
||
MockFlush2Local flush2Local = new MockFlush2Local(); | ||
|
||
DumpPhaseStatus dumpPhase = new DumpPhaseStatus(taskId, flush2Local); | ||
TableDumpStatus user = dumpPhase.getTable("user"); | ||
user.setAllRows(999); | ||
user.setReadRows(998); | ||
user.setWaiting(false); | ||
user.setFaild(false); | ||
user.setComplete(false); | ||
statusCollection.setDumpPhase(dumpPhase); | ||
Assert.assertFalse("shall be doing", statusCollection.isComplete()); | ||
|
||
for (int i = 0; i < 100; i++) { | ||
statusCollection.flushStatus2Local(); | ||
} | ||
|
||
user.setReadRows(999); | ||
user.setComplete(true); | ||
statusCollection.isComplete(); | ||
Assert.assertTrue("shall have done", statusCollection.isComplete()); | ||
Assert.assertEquals(2, flush2Local.writeCount); | ||
|
||
|
||
} | ||
|
||
private static class MockFlush2Local implements IFlush2Local { | ||
private int writeCount; | ||
|
||
@Override | ||
public void write(BasicPhaseStatus status) throws Exception { | ||
this.writeCount++; | ||
} | ||
|
||
@Override | ||
public BasicPhaseStatus loadPhase() throws Exception { | ||
throw new UnsupportedOperationException(); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
tis-manage-pojo/src/main/java/com/qlangtech/tis/fullbuild/phasestatus/IFlush2Local.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* 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: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. | ||
*/ | ||
|
||
package com.qlangtech.tis.fullbuild.phasestatus; | ||
|
||
import com.qlangtech.tis.fullbuild.phasestatus.impl.BasicPhaseStatus; | ||
|
||
/** | ||
* @author: 百岁([email protected]) | ||
* @create: 2024-04-15 18:49 | ||
**/ | ||
public interface IFlush2Local { | ||
|
||
|
||
public void write(BasicPhaseStatus status) throws Exception; | ||
|
||
public BasicPhaseStatus loadPhase() throws Exception; | ||
} |
42 changes: 42 additions & 0 deletions
42
...anage-pojo/src/main/java/com/qlangtech/tis/fullbuild/phasestatus/IFlush2LocalFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* 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> | ||
* http: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.fullbuild.phasestatus; | ||
|
||
import java.io.File; | ||
import java.util.Optional; | ||
import java.util.ServiceLoader; | ||
|
||
/** | ||
* @author: 百岁([email protected]) | ||
* @create: 2024-04-15 18:49 | ||
**/ | ||
public interface IFlush2LocalFactory { | ||
|
||
public static Optional<IFlush2Local> createNew(ClassLoader cl, File localFile) { | ||
ServiceLoader<IFlush2LocalFactory> svcLoader = ServiceLoader.load(IFlush2LocalFactory.class, cl); | ||
for (IFlush2LocalFactory factory : svcLoader) { | ||
return Optional.of(factory.create(localFile)); | ||
} | ||
// throw new IllegalStateException("can not find any svc loader for :" + IFlush2LocalFactory.class); | ||
return Optional.empty(); | ||
} | ||
|
||
|
||
IFlush2Local create(File localFile); | ||
} |
Oops, something went wrong.