use of org.apache.servicecomb.AuthHandlerBoot in project java-chassis by ServiceComb.
the class TestAuthHandlerBoot method testMicroserviceInstancePublicKey.
@Test
public void testMicroserviceInstancePublicKey() {
AuthHandlerBoot authHandlerBoot = new AuthHandlerBoot();
BootEvent bootEvent = new BootEvent();
bootEvent.setEventType(BootListener.EventType.BEFORE_REGISTRY);
authHandlerBoot.onBootEvent(bootEvent);
String publicKey = RegistrationManager.INSTANCE.getMicroserviceInstance().getProperties().get(DefinitionConst.INSTANCE_PUBKEY_PRO);
Assert.assertNotNull(publicKey);
}
use of org.apache.servicecomb.AuthHandlerBoot in project incubator-servicecomb-java-chassis by apache.
the class TestAuthHandlerBoot method testGenerateRSAKey.
@Test
public void testGenerateRSAKey() {
MicroserviceInstance microserviceInstance = new MicroserviceInstance();
Microservice microservice = new Microservice();
microservice.setInstance(microserviceInstance);
new Expectations(RegistryUtils.class) {
{
RegistryUtils.getMicroserviceInstance();
result = microserviceInstance;
}
};
AuthHandlerBoot authHandlerBoot = new AuthHandlerBoot();
BootEvent bootEvent = new BootEvent();
bootEvent.setEventType(BootListener.EventType.BEFORE_REGISTRY);
authHandlerBoot.onBootEvent(bootEvent);
Assert.assertNotNull(RSAKeypair4Auth.INSTANCE.getPrivateKey());
Assert.assertNotNull(RSAKeypair4Auth.INSTANCE.getPublicKey());
}
use of org.apache.servicecomb.AuthHandlerBoot in project java-chassis by ServiceComb.
the class TestAuthHandlerBoot method testGenerateRSAKey.
@Test
public void testGenerateRSAKey() {
MicroserviceInstance microserviceInstance = new MicroserviceInstance();
Microservice microservice = new Microservice();
microservice.setInstance(microserviceInstance);
AuthHandlerBoot authHandlerBoot = new AuthHandlerBoot();
BootEvent bootEvent = new BootEvent();
bootEvent.setEventType(BootListener.EventType.BEFORE_REGISTRY);
authHandlerBoot.onBootEvent(bootEvent);
Assert.assertNotNull(RSAKeypair4Auth.INSTANCE.getPrivateKey());
Assert.assertNotNull(RSAKeypair4Auth.INSTANCE.getPublicKey());
}
Aggregations