forked from apache/eventmesh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISSUE apache#858] Add test code for this module [eventmesh-security-…
…plugin] (apache#2502) * add test case * fix build error * fix build error * refactor test code * remove zookeeper log * refactor test path * add apache license header Co-authored-by: jonyangx <[email protected]>
- Loading branch information
Showing
18 changed files
with
687 additions
and
58 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
...ventmesh-security-acl/src/test/java/org/apache/eventmesh/acl/impl/AclServiceImplTest.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,100 @@ | ||
/* | ||
* 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.eventmesh.acl.impl; | ||
|
||
import org.apache.eventmesh.api.acl.AclService; | ||
import org.apache.eventmesh.api.exception.AclException; | ||
|
||
import java.util.Properties; | ||
|
||
import org.junit.Assert; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
public class AclServiceImplTest { | ||
|
||
private static AclService service; | ||
|
||
@BeforeClass | ||
public static void beforeClass() { | ||
service = new AclServiceImpl(); | ||
} | ||
|
||
@Test | ||
public void testInit() { | ||
try { | ||
service.init(); | ||
} catch (AclException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testStart() { | ||
try { | ||
service.start(); | ||
} catch (AclException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testShutdown() { | ||
try { | ||
service.shutdown(); | ||
} catch (AclException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testDoAclCheckInConnect() { | ||
try { | ||
service.doAclCheckInConnect(new Properties()); | ||
} catch (AclException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testDoAclCheckInHeartbeat() { | ||
try { | ||
service.doAclCheckInHeartbeat(new Properties()); | ||
} catch (AclException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testDoAclCheckInSend() { | ||
try { | ||
service.doAclCheckInSend(new Properties()); | ||
} catch (AclException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testDoAclCheckInReceive() { | ||
try { | ||
service.doAclCheckInReceive(new Properties()); | ||
} catch (AclException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
} |
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
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
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
138 changes: 138 additions & 0 deletions
138
...gin/eventmesh-security-api/src/test/java/org/apache/eventmesh/api/acl/AclServiceTest.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,138 @@ | ||
/* | ||
* 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.eventmesh.api.acl; | ||
|
||
import org.apache.eventmesh.api.exception.AclException; | ||
|
||
import java.util.Properties; | ||
|
||
import org.junit.Assert; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
public class AclServiceTest { | ||
|
||
private static class DemoAclService implements AclService { | ||
|
||
@Override | ||
public void init() throws AclException { | ||
|
||
} | ||
|
||
@Override | ||
public void start() throws AclException { | ||
|
||
} | ||
|
||
@Override | ||
public void shutdown() throws AclException { | ||
|
||
} | ||
|
||
@Override | ||
public void doAclCheckInConnect(Properties aclProperties) throws AclException { | ||
|
||
} | ||
|
||
@Override | ||
public void doAclCheckInHeartbeat(Properties aclProperties) throws AclException { | ||
|
||
} | ||
|
||
@Override | ||
public void doAclCheckInSend(Properties aclProperties) throws AclException { | ||
|
||
} | ||
|
||
@Override | ||
public void doAclCheckInReceive(Properties aclProperties) throws AclException { | ||
|
||
} | ||
} | ||
|
||
private static AclService service; | ||
|
||
@BeforeClass | ||
public static void beforeClass() { | ||
service = new DemoAclService(); | ||
} | ||
|
||
@Test | ||
public void testInit() { | ||
try { | ||
service.init(); | ||
} catch (AclException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testStart() { | ||
try { | ||
service.start(); | ||
} catch (AclException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testShutdown() { | ||
try { | ||
service.shutdown(); | ||
} catch (AclException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testDoAclCheckInConnect() { | ||
try { | ||
service.doAclCheckInConnect(new Properties()); | ||
} catch (AclException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testDoAclCheckInHeartbeat() { | ||
try { | ||
service.doAclCheckInHeartbeat(new Properties()); | ||
} catch (AclException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testDoAclCheckInSend() { | ||
try { | ||
service.doAclCheckInSend(new Properties()); | ||
} catch (AclException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testDoAclCheckInReceive() { | ||
try { | ||
service.doAclCheckInReceive(new Properties()); | ||
} catch (AclException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
} |
96 changes: 96 additions & 0 deletions
96
...n/eventmesh-security-api/src/test/java/org/apache/eventmesh/api/auth/AuthServiceTest.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,96 @@ | ||
/* | ||
* 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.eventmesh.api.auth; | ||
|
||
import org.apache.eventmesh.api.exception.AuthException; | ||
|
||
import java.util.Map; | ||
|
||
import org.junit.Assert; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
public class AuthServiceTest { | ||
|
||
private static class DemoAuthService implements AuthService { | ||
|
||
@Override | ||
public void init() throws AuthException { | ||
|
||
} | ||
|
||
@Override | ||
public void start() throws AuthException { | ||
|
||
} | ||
|
||
@Override | ||
public void shutdown() throws AuthException { | ||
|
||
} | ||
|
||
@Override | ||
public Map<String, String> getAuthParams() throws AuthException { | ||
return null; | ||
} | ||
} | ||
|
||
private static AuthService service; | ||
|
||
@BeforeClass | ||
public static void beforeClass() { | ||
service = new DemoAuthService(); | ||
} | ||
|
||
@Test | ||
public void testInit() { | ||
try { | ||
service.init(); | ||
} catch (AuthException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testStart() { | ||
try { | ||
service.start(); | ||
} catch (AuthException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testShutdown() { | ||
try { | ||
service.shutdown(); | ||
} catch (AuthException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testGetAuthParams() { | ||
try { | ||
Map<String, String> authParams = service.getAuthParams(); | ||
Assert.assertNull(authParams); | ||
} catch (AuthException e) { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
} |
Oops, something went wrong.