ServiceUtils test added
This commit is contained in:
parent
52012ff8c3
commit
747df3d414
@ -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 yaooqinn.kyuubi.service
|
||||
|
||||
import org.apache.spark.SparkFunSuite
|
||||
|
||||
class ServiceUtilsSuite extends SparkFunSuite {
|
||||
|
||||
test("test index or domain match") {
|
||||
assert(ServiceUtils.indexOfDomainMatch(null) === -1)
|
||||
val user1 = "Kent"
|
||||
assert(ServiceUtils.indexOfDomainMatch(user1) === -1)
|
||||
val user2 = "Kent/xxx"
|
||||
assert(ServiceUtils.indexOfDomainMatch(user2) === 4)
|
||||
val user3 = "Kent/////xxx"
|
||||
assert(ServiceUtils.indexOfDomainMatch(user3) === 4)
|
||||
val user4 = "Kent/@/@//xxx"
|
||||
assert(ServiceUtils.indexOfDomainMatch(user4) === 4)
|
||||
val user5 = "Kent/xxx@xxx"
|
||||
assert(ServiceUtils.indexOfDomainMatch(user5) === 4)
|
||||
val user6 = "Kent@xxx@xxx"
|
||||
assert(ServiceUtils.indexOfDomainMatch(user6) === 4)
|
||||
val user7 = "Kent/xxx/xxx"
|
||||
assert(ServiceUtils.indexOfDomainMatch(user7) === 4)
|
||||
val user8 = "Kent*xxx/xxx"
|
||||
assert(ServiceUtils.indexOfDomainMatch(user8) === 8)
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,20 +1,18 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
* * 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.
|
||||
* 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 yaooqinn.kyuubi.utils
|
||||
@ -124,7 +122,7 @@ class ReflectUtilsSuite extends SparkFunSuite {
|
||||
test("test reflect module") {
|
||||
val rule1 =
|
||||
ReflectUtils.reflectModule(className = "yaooqinn.kyuubi.TestRule", silent = true)
|
||||
assert(rule1.get.isInstanceOf[Rule[LogicalPlan]])
|
||||
assert(rule1.get.isInstanceOf[Rule[_]])
|
||||
val rule2 =
|
||||
ReflectUtils.reflectModule(className = "yaooqinn.kyuubi.TestRule2", silent = true)
|
||||
assert(rule2.isEmpty)
|
||||
|
||||
4
pom.xml
4
pom.xml
@ -41,8 +41,8 @@
|
||||
<developer>
|
||||
<id>yaooqinn</id>
|
||||
<name>Kent Yao</name>
|
||||
<email>hzyaoqin@corp.netease.com</email>
|
||||
<organization>yaooqinn</organization>
|
||||
<email>yaooqinn@hotmail.com</email>
|
||||
<organization>NetEase</organization>
|
||||
<url>https://github.com/yaooqinn</url>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user