Eights-LI
4 years ago
29 changed files with 636 additions and 211 deletions
@ -0,0 +1,93 @@
|
||||
/* |
||||
* 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.dolphinscheduler.common.task; |
||||
|
||||
import org.apache.dolphinscheduler.common.task.datax.DataxParameters; |
||||
|
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
public class DataxParametersTest { |
||||
|
||||
/** |
||||
* jvm parameters |
||||
*/ |
||||
public static final String JVM_EVN = " --jvm=\"-Xms%sG -Xmx%sG\" "; |
||||
|
||||
@Test |
||||
public void testLoadJvmEnv() { |
||||
|
||||
DataxParameters dataxParameters = new DataxParameters(); |
||||
dataxParameters.setXms(0); |
||||
dataxParameters.setXmx(-100); |
||||
|
||||
String actual = loadJvmEnvTest(dataxParameters); |
||||
|
||||
String except = " --jvm=\"-Xms1G -Xmx1G\" "; |
||||
Assert.assertEquals(except,actual); |
||||
|
||||
dataxParameters.setXms(13); |
||||
dataxParameters.setXmx(14); |
||||
actual = loadJvmEnvTest(dataxParameters); |
||||
except = " --jvm=\"-Xms13G -Xmx14G\" "; |
||||
Assert.assertEquals(except,actual); |
||||
|
||||
} |
||||
|
||||
@Test |
||||
public void testToString() { |
||||
|
||||
DataxParameters dataxParameters = new DataxParameters(); |
||||
dataxParameters.setCustomConfig(0); |
||||
dataxParameters.setXms(0); |
||||
dataxParameters.setXmx(-100); |
||||
dataxParameters.setDataSource(1); |
||||
dataxParameters.setDataTarget(1); |
||||
dataxParameters.setDsType("MYSQL"); |
||||
dataxParameters.setDtType("MYSQL"); |
||||
dataxParameters.setJobSpeedByte(1); |
||||
dataxParameters.setJobSpeedRecord(1); |
||||
dataxParameters.setJson("json"); |
||||
|
||||
String expected = "DataxParameters" |
||||
+ "{" |
||||
+ "customConfig=0, " |
||||
+ "json='json', " |
||||
+ "dsType='MYSQL', " |
||||
+ "dataSource=1, " |
||||
+ "dtType='MYSQL', " |
||||
+ "dataTarget=1, " |
||||
+ "sql='null', " |
||||
+ "targetTable='null', " |
||||
+ "preStatements=null, " |
||||
+ "postStatements=null, " |
||||
+ "jobSpeedByte=1, " |
||||
+ "jobSpeedRecord=1, " |
||||
+ "xms=0, " |
||||
+ "xmx=-100" |
||||
+ "}"; |
||||
|
||||
Assert.assertEquals(expected,dataxParameters.toString()); |
||||
} |
||||
|
||||
public String loadJvmEnvTest(DataxParameters dataXParameters) { |
||||
int xms = dataXParameters.getXms() < 1 ? 1 : dataXParameters.getXms(); |
||||
int xmx = dataXParameters.getXmx() < 1 ? 1 : dataXParameters.getXmx(); |
||||
return String.format(JVM_EVN, xms, xmx); |
||||
} |
||||
} |
@ -0,0 +1,24 @@
|
||||
/* |
||||
* 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. |
||||
*/ |
||||
<template> |
||||
<router-view></router-view> |
||||
</template> |
||||
<script> |
||||
export default { |
||||
name: 'projects-conditions-index' |
||||
} |
||||
</script> |
@ -0,0 +1,137 @@
|
||||
/* |
||||
* 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. |
||||
*/ |
||||
<template> |
||||
<m-conditions> |
||||
<template slot="search-group"> |
||||
<div class="list"> |
||||
<x-button type="ghost" size="small" @click="_ckQuery" icon="ans-icon-search"></x-button> |
||||
</div> |
||||
<div class="list"> |
||||
<x-datepicker |
||||
ref="datepicker" |
||||
@on-change="_onChangeStartStop" |
||||
type="daterange" |
||||
format="YYYY-MM-DD HH:mm:ss" |
||||
placement="bottom-end" |
||||
:value="[searchParams.startDate,searchParams.endDate]" |
||||
:panelNum="2"> |
||||
<x-input slot="input" readonly slot-scope="{value}" :value="value" style="width: 310px;" size="small" :placeholder="$t('Select date range')"> |
||||
<em slot="suffix" |
||||
@click.stop="_dateEmpty()" |
||||
class="ans-icon-fail-solid" |
||||
v-show="value" |
||||
style="font-size: 13px;cursor: pointer;margin-top: 1px;"> |
||||
</em> |
||||
</x-input> |
||||
</x-datepicker> |
||||
</div> |
||||
<div class="list"> |
||||
<x-select style="width: 140px;" @on-change="_onChangeState" :value="searchParams.stateType" > |
||||
<x-input slot="trigger" readonly :value="selectedModel ? selectedModel.label : ''" slot-scope="{ selectedModel }" style="width: 140px;" size="small" :placeholder="$t('State')" suffix-icon="ans-icon-arrow-down"> |
||||
</x-input> |
||||
<x-option |
||||
v-for="city in stateTypeList" |
||||
:key="city.label" |
||||
:value="city.code" |
||||
:label="city.label"> |
||||
</x-option> |
||||
</x-select> |
||||
</div> |
||||
<div class="list"> |
||||
<x-input v-model.trim="searchParams.host" @on-enterkey="_ckQuery" style="width: 140px;" size="small" :placeholder="$t('host')"></x-input> |
||||
</div> |
||||
<div class="list"> |
||||
<x-input v-model.trim="searchParams.executorName" @on-enterkey="_ckQuery" style="width: 140px;" size="small" :placeholder="$t('Executor')"></x-input> |
||||
</div> |
||||
<div class="list"> |
||||
<x-input v-model.trim="searchParams.processInstanceName" @on-enterkey="_ckQuery" style="width: 160px;" size="small" :placeholder="$t('Process Instance')"></x-input> |
||||
</div> |
||||
<div class="list"> |
||||
<x-input v-model.trim="searchParams.searchVal" @on-enterkey="_ckQuery" style="width: 160px;" size="small" :placeholder="$t('name')"></x-input> |
||||
</div> |
||||
</template> |
||||
</m-conditions> |
||||
</template> |
||||
<script> |
||||
import _ from 'lodash' |
||||
import { stateType } from './common' |
||||
import mConditions from '@/module/components/conditions/conditions' |
||||
export default { |
||||
name: 'task-instance-conditions', |
||||
data () { |
||||
return { |
||||
// state(list) |
||||
stateTypeList: stateType, |
||||
searchParams: { |
||||
// state |
||||
stateType: '', |
||||
// start date |
||||
startDate: '', |
||||
// end date |
||||
endDate: '', |
||||
// search value |
||||
searchVal: '', |
||||
// host |
||||
host: '', |
||||
// executor name |
||||
executorName: '', |
||||
processInstanceName: '' |
||||
} |
||||
} |
||||
}, |
||||
props: {}, |
||||
methods: { |
||||
_ckQuery () { |
||||
this.$emit('on-query', this.searchParams) |
||||
}, |
||||
/** |
||||
* change times |
||||
*/ |
||||
_onChangeStartStop (val) { |
||||
this.searchParams.startDate = val[0] |
||||
this.searchParams.endDate = val[1] |
||||
}, |
||||
/** |
||||
* change state |
||||
*/ |
||||
_onChangeState (val) { |
||||
this.searchParams.stateType = val.value |
||||
}, |
||||
/** |
||||
* empty date |
||||
*/ |
||||
_dateEmpty () { |
||||
this.searchParams.startDate = '' |
||||
this.searchParams.endDate = '' |
||||
this.$refs.datepicker.empty() |
||||
} |
||||
}, |
||||
watch: { |
||||
}, |
||||
created () { |
||||
// Routing parameter merging |
||||
if (!_.isEmpty(this.$route.query)) { |
||||
this.searchParams = _.assign(this.searchParams, this.$route.query) |
||||
} |
||||
}, |
||||
mounted () { |
||||
}, |
||||
computed: { |
||||
}, |
||||
components: { mConditions } |
||||
} |
||||
</script> |
Loading…
Reference in new issue