target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void testCreateSSLEnginewithPort() { SSLOption option = SSLOption.build(DIR + "/server.ssl.properties"); SSLCustom custom = new SSLCustom() { @Override public String getFullPath(String filename) { return DIR + "/ssl/" + filename; } @Override public char[] decode(char[] encrypted) { return encrypted; } }; i...
public static SSLEngine createSSLEngine(SSLOption option, SSLCustom custom) { SSLContext context = createSSLContext(option, custom); SSLEngine engine = context.createSSLEngine(); engine.setEnabledProtocols(option.getProtocols().split(",")); String[] supported = engine.getSupportedCipherSuites(); String[] eanbled = opti...
SSLManager { public static SSLEngine createSSLEngine(SSLOption option, SSLCustom custom) { SSLContext context = createSSLContext(option, custom); SSLEngine engine = context.createSSLEngine(); engine.setEnabledProtocols(option.getProtocols().split(",")); String[] supported = engine.getSupportedCipherSuites(); String[] e...
SSLManager { public static SSLEngine createSSLEngine(SSLOption option, SSLCustom custom) { SSLContext context = createSSLContext(option, custom); SSLEngine engine = context.createSSLEngine(); engine.setEnabledProtocols(option.getProtocols().split(",")); String[] supported = engine.getSupportedCipherSuites(); String[] e...
SSLManager { public static SSLEngine createSSLEngine(SSLOption option, SSLCustom custom) { SSLContext context = createSSLContext(option, custom); SSLEngine engine = context.createSSLEngine(); engine.setEnabledProtocols(option.getProtocols().split(",")); String[] supported = engine.getSupportedCipherSuites(); String[] e...
SSLManager { public static SSLEngine createSSLEngine(SSLOption option, SSLCustom custom) { SSLContext context = createSSLContext(option, custom); SSLEngine engine = context.createSSLEngine(); engine.setEnabledProtocols(option.getProtocols().split(",")); String[] supported = engine.getSupportedCipherSuites(); String[] e...
@Test public void testCreateSSLContextException() { SSLOption option = SSLOption.build(DIR + "/server.ssl.properties"); SSLCustom custom = new SSLCustom() { @Override public String getFullPath(String filename) { return DIR + "/ssl/" + filename; } @Override public char[] decode(char[] encrypted) { return encrypted; } };...
public static SSLContext createSSLContext(SSLOption option, SSLCustom custom) { try { String keyStoreName = custom.getFullPath(option.getKeyStore()); KeyManager[] keymanager; if (keyStoreName != null && new File(keyStoreName).exists()) { char[] keyStoreValue = custom.decode(option.getKeyStoreValue().toCharArray()); Key...
SSLManager { public static SSLContext createSSLContext(SSLOption option, SSLCustom custom) { try { String keyStoreName = custom.getFullPath(option.getKeyStore()); KeyManager[] keymanager; if (keyStoreName != null && new File(keyStoreName).exists()) { char[] keyStoreValue = custom.decode(option.getKeyStoreValue().toChar...
SSLManager { public static SSLContext createSSLContext(SSLOption option, SSLCustom custom) { try { String keyStoreName = custom.getFullPath(option.getKeyStore()); KeyManager[] keymanager; if (keyStoreName != null && new File(keyStoreName).exists()) { char[] keyStoreValue = custom.decode(option.getKeyStoreValue().toChar...
SSLManager { public static SSLContext createSSLContext(SSLOption option, SSLCustom custom) { try { String keyStoreName = custom.getFullPath(option.getKeyStore()); KeyManager[] keymanager; if (keyStoreName != null && new File(keyStoreName).exists()) { char[] keyStoreValue = custom.decode(option.getKeyStoreValue().toChar...
SSLManager { public static SSLContext createSSLContext(SSLOption option, SSLCustom custom) { try { String keyStoreName = custom.getFullPath(option.getKeyStore()); KeyManager[] keymanager; if (keyStoreName != null && new File(keyStoreName).exists()) { char[] keyStoreValue = custom.decode(option.getKeyStoreValue().toChar...
@Test public void testCreateSSLContextKeyManagementException() { SSLOption option = SSLOption.build(DIR + "/server.ssl.properties"); SSLCustom custom = new SSLCustom() { @Override public String getFullPath(String filename) { return DIR + "/ssl/" + filename; } @Override public char[] decode(char[] encrypted) { return en...
public static SSLContext createSSLContext(SSLOption option, SSLCustom custom) { try { String keyStoreName = custom.getFullPath(option.getKeyStore()); KeyManager[] keymanager; if (keyStoreName != null && new File(keyStoreName).exists()) { char[] keyStoreValue = custom.decode(option.getKeyStoreValue().toCharArray()); Key...
SSLManager { public static SSLContext createSSLContext(SSLOption option, SSLCustom custom) { try { String keyStoreName = custom.getFullPath(option.getKeyStore()); KeyManager[] keymanager; if (keyStoreName != null && new File(keyStoreName).exists()) { char[] keyStoreValue = custom.decode(option.getKeyStoreValue().toChar...
SSLManager { public static SSLContext createSSLContext(SSLOption option, SSLCustom custom) { try { String keyStoreName = custom.getFullPath(option.getKeyStore()); KeyManager[] keymanager; if (keyStoreName != null && new File(keyStoreName).exists()) { char[] keyStoreValue = custom.decode(option.getKeyStoreValue().toChar...
SSLManager { public static SSLContext createSSLContext(SSLOption option, SSLCustom custom) { try { String keyStoreName = custom.getFullPath(option.getKeyStore()); KeyManager[] keymanager; if (keyStoreName != null && new File(keyStoreName).exists()) { char[] keyStoreValue = custom.decode(option.getKeyStoreValue().toChar...
SSLManager { public static SSLContext createSSLContext(SSLOption option, SSLCustom custom) { try { String keyStoreName = custom.getFullPath(option.getKeyStore()); KeyManager[] keymanager; if (keyStoreName != null && new File(keyStoreName).exists()) { char[] keyStoreValue = custom.decode(option.getKeyStoreValue().toChar...
@Test public void testCreateSSLServerSocketException() { SSLOption option = SSLOption.build(DIR + "/server.ssl.properties"); SSLCustom custom = new SSLCustom() { @Override public String getFullPath(String filename) { return DIR + "/ssl/" + filename; } @Override public char[] decode(char[] encrypted) { return encrypted;...
public static SSLServerSocket createSSLServerSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLServerSocketFactory factory = context.getServerSocketFactory(); SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(); socket.setEnabledProtocols(op...
SSLManager { public static SSLServerSocket createSSLServerSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLServerSocketFactory factory = context.getServerSocketFactory(); SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(); socket.setEnable...
SSLManager { public static SSLServerSocket createSSLServerSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLServerSocketFactory factory = context.getServerSocketFactory(); SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(); socket.setEnable...
SSLManager { public static SSLServerSocket createSSLServerSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLServerSocketFactory factory = context.getServerSocketFactory(); SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(); socket.setEnable...
SSLManager { public static SSLServerSocket createSSLServerSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLServerSocketFactory factory = context.getServerSocketFactory(); SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(); socket.setEnable...
@Test public void testCreateSSLServerSocketIOException() { SSLOption option = SSLOption.build(DIR + "/server.ssl.properties"); SSLCustom custom = new SSLCustom() { @Override public String getFullPath(String filename) { return DIR + "/ssl/" + filename; } @Override public char[] decode(char[] encrypted) { return encrypte...
public static SSLServerSocket createSSLServerSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLServerSocketFactory factory = context.getServerSocketFactory(); SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(); socket.setEnabledProtocols(op...
SSLManager { public static SSLServerSocket createSSLServerSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLServerSocketFactory factory = context.getServerSocketFactory(); SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(); socket.setEnable...
SSLManager { public static SSLServerSocket createSSLServerSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLServerSocketFactory factory = context.getServerSocketFactory(); SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(); socket.setEnable...
SSLManager { public static SSLServerSocket createSSLServerSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLServerSocketFactory factory = context.getServerSocketFactory(); SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(); socket.setEnable...
SSLManager { public static SSLServerSocket createSSLServerSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLServerSocketFactory factory = context.getServerSocketFactory(); SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(); socket.setEnable...
@Test public void testCreateSSLSocketException() { SSLOption option = SSLOption.build(DIR + "/server.ssl.properties"); SSLCustom custom = new SSLCustom() { @Override public String getFullPath(String filename) { return DIR + "/ssl/" + filename; } @Override public char[] decode(char[] encrypted) { return encrypted; } }; ...
public static SSLSocket createSSLSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLSocketFactory facroty = context.getSocketFactory(); SSLSocket socket = (SSLSocket) facroty.createSocket(); socket.setEnabledProtocols(option.getProtocols().split(",")); String[] ...
SSLManager { public static SSLSocket createSSLSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLSocketFactory facroty = context.getSocketFactory(); SSLSocket socket = (SSLSocket) facroty.createSocket(); socket.setEnabledProtocols(option.getProtocols().split(","...
SSLManager { public static SSLSocket createSSLSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLSocketFactory facroty = context.getSocketFactory(); SSLSocket socket = (SSLSocket) facroty.createSocket(); socket.setEnabledProtocols(option.getProtocols().split(","...
SSLManager { public static SSLSocket createSSLSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLSocketFactory facroty = context.getSocketFactory(); SSLSocket socket = (SSLSocket) facroty.createSocket(); socket.setEnabledProtocols(option.getProtocols().split(","...
SSLManager { public static SSLSocket createSSLSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLSocketFactory facroty = context.getSocketFactory(); SSLSocket socket = (SSLSocket) facroty.createSocket(); socket.setEnabledProtocols(option.getProtocols().split(","...
@Test public void testCreateSSLSocketIOException() { SSLOption option = SSLOption.build(DIR + "/server.ssl.properties"); SSLCustom custom = new SSLCustom() { @Override public String getFullPath(String filename) { return DIR + "/ssl/" + filename; } @Override public char[] decode(char[] encrypted) { return encrypted; } }...
public static SSLSocket createSSLSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLSocketFactory facroty = context.getSocketFactory(); SSLSocket socket = (SSLSocket) facroty.createSocket(); socket.setEnabledProtocols(option.getProtocols().split(",")); String[] ...
SSLManager { public static SSLSocket createSSLSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLSocketFactory facroty = context.getSocketFactory(); SSLSocket socket = (SSLSocket) facroty.createSocket(); socket.setEnabledProtocols(option.getProtocols().split(","...
SSLManager { public static SSLSocket createSSLSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLSocketFactory facroty = context.getSocketFactory(); SSLSocket socket = (SSLSocket) facroty.createSocket(); socket.setEnabledProtocols(option.getProtocols().split(","...
SSLManager { public static SSLSocket createSSLSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLSocketFactory facroty = context.getSocketFactory(); SSLSocket socket = (SSLSocket) facroty.createSocket(); socket.setEnabledProtocols(option.getProtocols().split(","...
SSLManager { public static SSLSocket createSSLSocket(SSLOption option, SSLCustom custom) { try { SSLContext context = createSSLContext(option, custom); SSLSocketFactory facroty = context.getSocketFactory(); SSLSocket socket = (SSLSocket) facroty.createSocket(); socket.setEnabledProtocols(option.getProtocols().split(","...
@Test public void testCreateSSLSocketFactory() { SSLOption option = SSLOption.build(DIR + "/server.ssl.properties"); SSLCustom custom = new SSLCustom() { @Override public String getFullPath(String filename) { return DIR + "/ssl/" + filename; } @Override public char[] decode(char[] encrypted) { return encrypted; } }; SS...
public static SSLSocketFactory createSSLSocketFactory(SSLOption option, SSLCustom custom) { SSLContext context = createSSLContext(option, custom); SSLSocketFactory factory = context.getSocketFactory(); String[] supported = factory.getSupportedCipherSuites(); String[] eanbled = option.getCiphers().split(","); return new...
SSLManager { public static SSLSocketFactory createSSLSocketFactory(SSLOption option, SSLCustom custom) { SSLContext context = createSSLContext(option, custom); SSLSocketFactory factory = context.getSocketFactory(); String[] supported = factory.getSupportedCipherSuites(); String[] eanbled = option.getCiphers().split(","...
SSLManager { public static SSLSocketFactory createSSLSocketFactory(SSLOption option, SSLCustom custom) { SSLContext context = createSSLContext(option, custom); SSLSocketFactory factory = context.getSocketFactory(); String[] supported = factory.getSupportedCipherSuites(); String[] eanbled = option.getCiphers().split(","...
SSLManager { public static SSLSocketFactory createSSLSocketFactory(SSLOption option, SSLCustom custom) { SSLContext context = createSSLContext(option, custom); SSLSocketFactory factory = context.getSocketFactory(); String[] supported = factory.getSupportedCipherSuites(); String[] eanbled = option.getCiphers().split(","...
SSLManager { public static SSLSocketFactory createSSLSocketFactory(SSLOption option, SSLCustom custom) { SSLContext context = createSSLContext(option, custom); SSLSocketFactory factory = context.getSocketFactory(); String[] supported = factory.getSupportedCipherSuites(); String[] eanbled = option.getCiphers().split(","...
@SuppressWarnings("unused") @Test public void testSSLOptionNull() { try { SSLOption option = SSLOption.build(DIR + "/servers.ssl.properties"); } catch (IllegalArgumentException e) { Assert.assertEquals("Bad file name.", e.getMessage()); } }
public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumentException("...
SSLOption { public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumen...
SSLOption { public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumen...
SSLOption { public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumen...
SSLOption { public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumen...
@Test public void testRegisterSchemaException() { new MockUp<RestClientUtil>() { @Mock void put(IpPort ipPort, String uri, RequestParam requestParam, Handler<RestResponse> responseHandler) { } }; InterruptedException e = new InterruptedException(); new MockUp<CountDownLatch>() { @Mock public void await() throws Interru...
@Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaRequest(); request.setSchema(schemaContent); request.setSummar...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaR...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaR...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaR...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaR...
@Test public void testBuildException() { new MockUp<File>() { @Mock public String getCanonicalPath() throws IOException { throw new IOException(); } }; try { SSLOption option = SSLOption.build(DIR + "/server.ssl.properties"); Assert.assertNotNull(option); } catch (Exception e) { Assert.assertEquals("java.lang.IllegalAr...
public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumentException("...
SSLOption { public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumen...
SSLOption { public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumen...
SSLOption { public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumen...
SSLOption { public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumen...
@Test public void testBuildInputStream() { try { URL url = this.getClass().getResource("/server.ssl.properties"); InputStream inputStream = url.openStream(); SSLOption option = SSLOption.build(inputStream); Assert.assertNotNull(option); } catch (Exception e) { Assert.assertEquals("java.lang.IllegalArgumentException", e...
public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumentException("...
SSLOption { public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumen...
SSLOption { public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumen...
SSLOption { public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumen...
SSLOption { public static SSLOption build(String optionfile) { File file = new File(optionfile); if (!file.isFile()) { throw new IllegalArgumentException("Bad file name."); } try { SSLOption option = new SSLOption(); option.load(file.getCanonicalPath()); return option; } catch (IOException e) { throw new IllegalArgumen...
@Test public void testGetCN(@Mocked X500Principal aX500Principal, @Mocked MyX509Certificate myX509Certificate) { new Expectations() { { aX500Principal.getName(); result = "CN=Test1234"; myX509Certificate.getSubjectX500Principal(); result = aX500Principal; } }; MyX509Certificate xxmyX509Certificate = new MyX509Certifica...
public static Set<String> getCN(X509Certificate cert) { Set<String> names = new HashSet<>(); String subjectDN = cert.getSubjectX500Principal().getName(); String[] pairs = subjectDN.split(","); for (String p : pairs) { String[] kv = p.split("="); if (kv.length == 2 && kv[0].equals("CN")) { names.add(kv[1]); } } try { Co...
CertificateUtil { public static Set<String> getCN(X509Certificate cert) { Set<String> names = new HashSet<>(); String subjectDN = cert.getSubjectX500Principal().getName(); String[] pairs = subjectDN.split(","); for (String p : pairs) { String[] kv = p.split("="); if (kv.length == 2 && kv[0].equals("CN")) { names.add(kv...
CertificateUtil { public static Set<String> getCN(X509Certificate cert) { Set<String> names = new HashSet<>(); String subjectDN = cert.getSubjectX500Principal().getName(); String[] pairs = subjectDN.split(","); for (String p : pairs) { String[] kv = p.split("="); if (kv.length == 2 && kv[0].equals("CN")) { names.add(kv...
CertificateUtil { public static Set<String> getCN(X509Certificate cert) { Set<String> names = new HashSet<>(); String subjectDN = cert.getSubjectX500Principal().getName(); String[] pairs = subjectDN.split(","); for (String p : pairs) { String[] kv = p.split("="); if (kv.length == 2 && kv[0].equals("CN")) { names.add(kv...
CertificateUtil { public static Set<String> getCN(X509Certificate cert) { Set<String> names = new HashSet<>(); String subjectDN = cert.getSubjectX500Principal().getName(); String[] pairs = subjectDN.split(","); for (String p : pairs) { String[] kv = p.split("="); if (kv.length == 2 && kv[0].equals("CN")) { names.add(kv...
@Test public void testGetCNException(@Mocked X500Principal aX500Principal, @Mocked MyX509Certificate myX509Certificate) { new Expectations() { { aX500Principal.getName(); result = "NOCN=Test1234"; myX509Certificate.getSubjectX500Principal(); result = aX500Principal; } }; MyX509Certificate xxmyX509Certificate = new MyX5...
public static Set<String> getCN(X509Certificate cert) { Set<String> names = new HashSet<>(); String subjectDN = cert.getSubjectX500Principal().getName(); String[] pairs = subjectDN.split(","); for (String p : pairs) { String[] kv = p.split("="); if (kv.length == 2 && kv[0].equals("CN")) { names.add(kv[1]); } } try { Co...
CertificateUtil { public static Set<String> getCN(X509Certificate cert) { Set<String> names = new HashSet<>(); String subjectDN = cert.getSubjectX500Principal().getName(); String[] pairs = subjectDN.split(","); for (String p : pairs) { String[] kv = p.split("="); if (kv.length == 2 && kv[0].equals("CN")) { names.add(kv...
CertificateUtil { public static Set<String> getCN(X509Certificate cert) { Set<String> names = new HashSet<>(); String subjectDN = cert.getSubjectX500Principal().getName(); String[] pairs = subjectDN.split(","); for (String p : pairs) { String[] kv = p.split("="); if (kv.length == 2 && kv[0].equals("CN")) { names.add(kv...
CertificateUtil { public static Set<String> getCN(X509Certificate cert) { Set<String> names = new HashSet<>(); String subjectDN = cert.getSubjectX500Principal().getName(); String[] pairs = subjectDN.split(","); for (String p : pairs) { String[] kv = p.split("="); if (kv.length == 2 && kv[0].equals("CN")) { names.add(kv...
CertificateUtil { public static Set<String> getCN(X509Certificate cert) { Set<String> names = new HashSet<>(); String subjectDN = cert.getSubjectX500Principal().getName(); String[] pairs = subjectDN.split(","); for (String p : pairs) { String[] kv = p.split("="); if (kv.length == 2 && kv[0].equals("CN")) { names.add(kv...
@Test public void testFindOwner(@Mocked X500Principal aX500Principal1, @Mocked X500Principal aX500Principal2, @Mocked MyX509Certificate myX509Certificate) { new Expectations() { { aX500Principal1.getName(); result = "Huawei"; } { aX500Principal2.getName(); result = "Huawei"; } { myX509Certificate.getSubjectX500Principa...
public static X509Certificate findOwner(X509Certificate[] cerChain) { X509Certificate[] sorted = sort(cerChain); return sorted[sorted.length - 1]; }
CertificateUtil { public static X509Certificate findOwner(X509Certificate[] cerChain) { X509Certificate[] sorted = sort(cerChain); return sorted[sorted.length - 1]; } }
CertificateUtil { public static X509Certificate findOwner(X509Certificate[] cerChain) { X509Certificate[] sorted = sort(cerChain); return sorted[sorted.length - 1]; } private CertificateUtil(); }
CertificateUtil { public static X509Certificate findOwner(X509Certificate[] cerChain) { X509Certificate[] sorted = sort(cerChain); return sorted[sorted.length - 1]; } private CertificateUtil(); static X509Certificate findOwner(X509Certificate[] cerChain); static Set<String> getCN(X509Certificate cert); }
CertificateUtil { public static X509Certificate findOwner(X509Certificate[] cerChain) { X509Certificate[] sorted = sort(cerChain); return sorted[sorted.length - 1]; } private CertificateUtil(); static X509Certificate findOwner(X509Certificate[] cerChain); static Set<String> getCN(X509Certificate cert); }
@Test public void testFindRootCAException(@Mocked X500Principal aX500Principal1, @Mocked X500Principal aX500Principal2, @Mocked MyX509Certificate myX509Certificate) { new Expectations() { { aX500Principal1.getName(); result = "Huawei1"; } { aX500Principal2.getName(); result = "Huawei3"; } { myX509Certificate.getSubject...
public static X509Certificate findOwner(X509Certificate[] cerChain) { X509Certificate[] sorted = sort(cerChain); return sorted[sorted.length - 1]; }
CertificateUtil { public static X509Certificate findOwner(X509Certificate[] cerChain) { X509Certificate[] sorted = sort(cerChain); return sorted[sorted.length - 1]; } }
CertificateUtil { public static X509Certificate findOwner(X509Certificate[] cerChain) { X509Certificate[] sorted = sort(cerChain); return sorted[sorted.length - 1]; } private CertificateUtil(); }
CertificateUtil { public static X509Certificate findOwner(X509Certificate[] cerChain) { X509Certificate[] sorted = sort(cerChain); return sorted[sorted.length - 1]; } private CertificateUtil(); static X509Certificate findOwner(X509Certificate[] cerChain); static Set<String> getCN(X509Certificate cert); }
CertificateUtil { public static X509Certificate findOwner(X509Certificate[] cerChain) { X509Certificate[] sorted = sort(cerChain); return sorted[sorted.length - 1]; } private CertificateUtil(); static X509Certificate findOwner(X509Certificate[] cerChain); static Set<String> getCN(X509Certificate cert); }
@SuppressWarnings("unused") @Test public void testConstructor() { String keyStoreName = custom.getFullPath(option.getKeyStore()); char[] keyStoreValue = custom.decode(option.getKeyStoreValue().toCharArray()); String trustStoreName = custom.getFullPath(option.getTrustStore()); char[] trustStoreValue = custom.decode(opti...
@Override public X509Certificate[] getAcceptedIssuers() { return trustManager.getAcceptedIssuers(); }
TrustManagerExt extends X509ExtendedTrustManager { @Override public X509Certificate[] getAcceptedIssuers() { return trustManager.getAcceptedIssuers(); } }
TrustManagerExt extends X509ExtendedTrustManager { @Override public X509Certificate[] getAcceptedIssuers() { return trustManager.getAcceptedIssuers(); } TrustManagerExt(X509ExtendedTrustManager manager, SSLOption option, SSLCustom custom); }
TrustManagerExt extends X509ExtendedTrustManager { @Override public X509Certificate[] getAcceptedIssuers() { return trustManager.getAcceptedIssuers(); } TrustManagerExt(X509ExtendedTrustManager manager, SSLOption option, SSLCustom custom); @Override void checkClientTrusted(X509Certificate[] chain, String authType...
TrustManagerExt extends X509ExtendedTrustManager { @Override public X509Certificate[] getAcceptedIssuers() { return trustManager.getAcceptedIssuers(); } TrustManagerExt(X509ExtendedTrustManager manager, SSLOption option, SSLCustom custom); @Override void checkClientTrusted(X509Certificate[] chain, String authType...
@Test public void testCheckClientTrusted(@Mocked CertificateUtil certificateUtil) { MyX509Certificate myX509Certificate1 = new MyX509Certificate(); MyX509Certificate myX509Certificate2 = new MyX509Certificate(); MyX509Certificate[] MyX509CertificateArray = new MyX509Certificate[2]; MyX509CertificateArray[0] = myX509Cer...
@Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { if (!option.isAuthPeer()) { return; } checkTrustedCustom(chain, null); trustManager.checkClientTrusted(chain, authType); }
TrustManagerExt extends X509ExtendedTrustManager { @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { if (!option.isAuthPeer()) { return; } checkTrustedCustom(chain, null); trustManager.checkClientTrusted(chain, authType); } }
TrustManagerExt extends X509ExtendedTrustManager { @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { if (!option.isAuthPeer()) { return; } checkTrustedCustom(chain, null); trustManager.checkClientTrusted(chain, authType); } TrustManagerExt(X509ExtendedTrust...
TrustManagerExt extends X509ExtendedTrustManager { @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { if (!option.isAuthPeer()) { return; } checkTrustedCustom(chain, null); trustManager.checkClientTrusted(chain, authType); } TrustManagerExt(X509ExtendedTrust...
TrustManagerExt extends X509ExtendedTrustManager { @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { if (!option.isAuthPeer()) { return; } checkTrustedCustom(chain, null); trustManager.checkClientTrusted(chain, authType); } TrustManagerExt(X509ExtendedTrust...
@Test public void testCatchException(@Mocked CertificateUtil certificateUtil) { MyX509Certificate myX509Certificate1 = new MyX509Certificate(); MyX509Certificate myX509Certificate2 = new MyX509Certificate(); MyX509Certificate[] MyX509CertificateArray = new MyX509Certificate[2]; MyX509CertificateArray[0] = myX509Certifi...
@Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { if (!option.isAuthPeer()) { return; } checkTrustedCustom(chain, null); trustManager.checkClientTrusted(chain, authType); }
TrustManagerExt extends X509ExtendedTrustManager { @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { if (!option.isAuthPeer()) { return; } checkTrustedCustom(chain, null); trustManager.checkClientTrusted(chain, authType); } }
TrustManagerExt extends X509ExtendedTrustManager { @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { if (!option.isAuthPeer()) { return; } checkTrustedCustom(chain, null); trustManager.checkClientTrusted(chain, authType); } TrustManagerExt(X509ExtendedTrust...
TrustManagerExt extends X509ExtendedTrustManager { @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { if (!option.isAuthPeer()) { return; } checkTrustedCustom(chain, null); trustManager.checkClientTrusted(chain, authType); } TrustManagerExt(X509ExtendedTrust...
TrustManagerExt extends X509ExtendedTrustManager { @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { if (!option.isAuthPeer()) { return; } checkTrustedCustom(chain, null); trustManager.checkClientTrusted(chain, authType); } TrustManagerExt(X509ExtendedTrust...
@Test public void testCreateSocketException() { boolean validAssert = true; try { instance.createSocket("host", 8080); } catch (Exception e) { validAssert = false; } Assert.assertFalse(validAssert); }
@Override public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException { return wrapSocket((SSLSocket) this.sslSocketFactory.createSocket(s, host, port, autoClose)); }
SSLSocketFactoryExt extends SSLSocketFactory { @Override public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException { return wrapSocket((SSLSocket) this.sslSocketFactory.createSocket(s, host, port, autoClose)); } }
SSLSocketFactoryExt extends SSLSocketFactory { @Override public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException { return wrapSocket((SSLSocket) this.sslSocketFactory.createSocket(s, host, port, autoClose)); } SSLSocketFactoryExt(SSLSocketFactory factory, String[] ciphers, Stri...
SSLSocketFactoryExt extends SSLSocketFactory { @Override public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException { return wrapSocket((SSLSocket) this.sslSocketFactory.createSocket(s, host, port, autoClose)); } SSLSocketFactoryExt(SSLSocketFactory factory, String[] ciphers, Stri...
SSLSocketFactoryExt extends SSLSocketFactory { @Override public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException { return wrapSocket((SSLSocket) this.sslSocketFactory.createSocket(s, host, port, autoClose)); } SSLSocketFactoryExt(SSLSocketFactory factory, String[] ciphers, Stri...
@Test public void testRegisterSchemaErrorResponse() { new MockUp<ServiceRegistryClientImpl>() { @Mock Handler<RestResponse> syncHandlerEx(CountDownLatch countDownLatch, Holder<ResponseWrapper> holder) { return restResponse -> { HttpClientResponse response = Mockito.mock(HttpClientResponse.class); Mockito.when(response....
@Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaRequest(); request.setSchema(schemaContent); request.setSummar...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaR...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaR...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaR...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaR...
@Test public void testCreateKeyStoreException() { String storename = ""; String storetype = "testType"; char[] storevalue = "Changeme_123".toCharArray(); try { KeyStoreUtil.createKeyStore(storename, storetype, storevalue); } catch (IllegalArgumentException e) { Assert.assertEquals("Bad key store or value.testType not f...
public static KeyStore createKeyStore(String storename, String storetype, char[] storevalue) { InputStream is = null; try { KeyStore keystore = KeyStore.getInstance(storetype); is = new FileInputStream(storename); keystore.load(is, storevalue); return keystore; } catch (Exception e) { throw new IllegalArgumentException...
KeyStoreUtil { public static KeyStore createKeyStore(String storename, String storetype, char[] storevalue) { InputStream is = null; try { KeyStore keystore = KeyStore.getInstance(storetype); is = new FileInputStream(storename); keystore.load(is, storevalue); return keystore; } catch (Exception e) { throw new IllegalAr...
KeyStoreUtil { public static KeyStore createKeyStore(String storename, String storetype, char[] storevalue) { InputStream is = null; try { KeyStore keystore = KeyStore.getInstance(storetype); is = new FileInputStream(storename); keystore.load(is, storevalue); return keystore; } catch (Exception e) { throw new IllegalAr...
KeyStoreUtil { public static KeyStore createKeyStore(String storename, String storetype, char[] storevalue) { InputStream is = null; try { KeyStore keystore = KeyStore.getInstance(storetype); is = new FileInputStream(storename); keystore.load(is, storevalue); return keystore; } catch (Exception e) { throw new IllegalAr...
KeyStoreUtil { public static KeyStore createKeyStore(String storename, String storetype, char[] storevalue) { InputStream is = null; try { KeyStore keystore = KeyStore.getInstance(storetype); is = new FileInputStream(storename); keystore.load(is, storevalue); return keystore; } catch (Exception e) { throw new IllegalAr...
@Test public void testCreateKeyStoreException2() { String storename = strFilePath + "/ssl/trust.jks"; String storetype = "PKCS12"; char[] storevalue = "Changeme_123".toCharArray(); try { KeyStoreUtil.createKeyStore(storename, storetype, storevalue); } catch (IllegalArgumentException e) { Assert.assertEquals("Bad key st...
public static KeyStore createKeyStore(String storename, String storetype, char[] storevalue) { InputStream is = null; try { KeyStore keystore = KeyStore.getInstance(storetype); is = new FileInputStream(storename); keystore.load(is, storevalue); return keystore; } catch (Exception e) { throw new IllegalArgumentException...
KeyStoreUtil { public static KeyStore createKeyStore(String storename, String storetype, char[] storevalue) { InputStream is = null; try { KeyStore keystore = KeyStore.getInstance(storetype); is = new FileInputStream(storename); keystore.load(is, storevalue); return keystore; } catch (Exception e) { throw new IllegalAr...
KeyStoreUtil { public static KeyStore createKeyStore(String storename, String storetype, char[] storevalue) { InputStream is = null; try { KeyStore keystore = KeyStore.getInstance(storetype); is = new FileInputStream(storename); keystore.load(is, storevalue); return keystore; } catch (Exception e) { throw new IllegalAr...
KeyStoreUtil { public static KeyStore createKeyStore(String storename, String storetype, char[] storevalue) { InputStream is = null; try { KeyStore keystore = KeyStore.getInstance(storetype); is = new FileInputStream(storename); keystore.load(is, storevalue); return keystore; } catch (Exception e) { throw new IllegalAr...
KeyStoreUtil { public static KeyStore createKeyStore(String storename, String storetype, char[] storevalue) { InputStream is = null; try { KeyStore keystore = KeyStore.getInstance(storetype); is = new FileInputStream(storename); keystore.load(is, storevalue); return keystore; } catch (Exception e) { throw new IllegalAr...
@Test public void testCreateCRL() { String crlfile = strFilePath + "/ssl/server.p12"; mockGenerateCRLs(); boolean validAssert = true; try { CRL[] crl = KeyStoreUtil.createCRL(crlfile); Assert.assertNull(crl); } catch (Exception e) { validAssert = false; } Assert.assertTrue(validAssert); }
@SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()]); return crls...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
@Test public void testCreateCRLException() { String crlfile = strFilePath + "/ssl/server.p12"; boolean validAssert = true; try { new MockUp<CertificateFactory>() { @Mock public final CertificateFactory getInstance(String type) throws CertificateException { throw new CertificateException(); } }; KeyStoreUtil.createCRL(c...
@SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()]); return crls...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
@Test public void testExceptionFileNotFound() { String crlfile = strFilePath + "/ssl/server.p12"; boolean validAssert = true; try { new MockUp<CertificateFactory>() { @Mock public final CertificateFactory getInstance( String type) throws CertificateException, FileNotFoundException { throw new FileNotFoundException(); }...
@SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()]); return crls...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
@Test public void testExceptionCRLException() { String crlfile = strFilePath + "/ssl/server.p12"; boolean validAssert = true; try { new MockUp<CertificateFactory>() { @Mock public final CertificateFactory getInstance(String type) throws CertificateException, CRLException { throw new CRLException(); } }; KeyStoreUtil.cr...
@SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()]); return crls...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
KeyStoreUtil { @SuppressWarnings({"rawtypes", "unchecked"}) public static CRL[] createCRL(String crlfile) { InputStream is = null; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); is = new FileInputStream(crlfile); Collection c = cf.generateCRLs(is); CRL[] crls = (CRL[]) c.toArray(new CRL[c.size()...
@Test public void parse() throws IOException { URL url = Thread.currentThread().getContextClassLoader().getResource("protobufRoot.proto"); String content = IOUtils.toString(url, StandardCharsets.UTF_8); ProtoParser parser = new ProtoParser(); Proto protoFromContent = parser.parseFromContent(content); Proto protoFromNam...
public Proto parse(String name) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { if (classLoader == null) { Thread.currentThread().setContextClassLoader(ProtoParser.class.getClassLoader()); } ProtoContext context = loader.load(defaultReader, name); return context.getProto(); } finally {...
ProtoParser { public Proto parse(String name) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { if (classLoader == null) { Thread.currentThread().setContextClassLoader(ProtoParser.class.getClassLoader()); } ProtoContext context = loader.load(defaultReader, name); return context.getProto(...
ProtoParser { public Proto parse(String name) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { if (classLoader == null) { Thread.currentThread().setContextClassLoader(ProtoParser.class.getClassLoader()); } ProtoContext context = loader.load(defaultReader, name); return context.getProto(...
ProtoParser { public Proto parse(String name) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { if (classLoader == null) { Thread.currentThread().setContextClassLoader(ProtoParser.class.getClassLoader()); } ProtoContext context = loader.load(defaultReader, name); return context.getProto(...
ProtoParser { public Proto parse(String name) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { if (classLoader == null) { Thread.currentThread().setContextClassLoader(ProtoParser.class.getClassLoader()); } ProtoContext context = loader.load(defaultReader, name); return context.getProto(...
@Test public void generic() { Method method = ReflectUtils.findMethod(GenericSchema.class, "genericMethod"); BeanDescriptor beanDescriptor = beanDescriptorManager .getOrCreateBeanDescriptor(method.getGenericParameterTypes()[0]); Assert.assertEquals(String.class, beanDescriptor.getPropertyDescriptors().get("value").getJ...
public BeanDescriptor getOrCreateBeanDescriptor(Type type) { return beanDescriptors.computeIfAbsent(type, this::createBeanDescriptor); }
BeanDescriptorManager { public BeanDescriptor getOrCreateBeanDescriptor(Type type) { return beanDescriptors.computeIfAbsent(type, this::createBeanDescriptor); } }
BeanDescriptorManager { public BeanDescriptor getOrCreateBeanDescriptor(Type type) { return beanDescriptors.computeIfAbsent(type, this::createBeanDescriptor); } BeanDescriptorManager(SerializationConfig serializationConfig); }
BeanDescriptorManager { public BeanDescriptor getOrCreateBeanDescriptor(Type type) { return beanDescriptors.computeIfAbsent(type, this::createBeanDescriptor); } BeanDescriptorManager(SerializationConfig serializationConfig); BeanDescriptor getOrCreateBeanDescriptor(Type type); }
BeanDescriptorManager { public BeanDescriptor getOrCreateBeanDescriptor(Type type) { return beanDescriptors.computeIfAbsent(type, this::createBeanDescriptor); } BeanDescriptorManager(SerializationConfig serializationConfig); BeanDescriptor getOrCreateBeanDescriptor(Type type); }
@Test public void getOrCreate() { Assert.assertSame(beanDescriptor, beanDescriptorManager.getOrCreateBeanDescriptor(Model.class)); Assert.assertSame(Model.class, beanDescriptor.getJavaType().getRawClass()); }
public BeanDescriptor getOrCreateBeanDescriptor(Type type) { return beanDescriptors.computeIfAbsent(type, this::createBeanDescriptor); }
BeanDescriptorManager { public BeanDescriptor getOrCreateBeanDescriptor(Type type) { return beanDescriptors.computeIfAbsent(type, this::createBeanDescriptor); } }
BeanDescriptorManager { public BeanDescriptor getOrCreateBeanDescriptor(Type type) { return beanDescriptors.computeIfAbsent(type, this::createBeanDescriptor); } BeanDescriptorManager(SerializationConfig serializationConfig); }
BeanDescriptorManager { public BeanDescriptor getOrCreateBeanDescriptor(Type type) { return beanDescriptors.computeIfAbsent(type, this::createBeanDescriptor); } BeanDescriptorManager(SerializationConfig serializationConfig); BeanDescriptor getOrCreateBeanDescriptor(Type type); }
BeanDescriptorManager { public BeanDescriptor getOrCreateBeanDescriptor(Type type) { return beanDescriptors.computeIfAbsent(type, this::createBeanDescriptor); } BeanDescriptorManager(SerializationConfig serializationConfig); BeanDescriptor getOrCreateBeanDescriptor(Type type); }
@Test public void testValidProperty() { String validProperty1 = "0,1,2,10"; String validProperty2 = "0,1, 2 , 10 "; String validProperty3 = "0,1,2,10,"; LatencyDistributionConfig config1 = new LatencyDistributionConfig(validProperty1); LatencyDistributionConfig config2 = new LatencyDistributionConfig(validProperty2); L...
public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; }
LatencyDistributionConfig { public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; } }
LatencyDistributionConfig { public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; } LatencyDistributionConfig(String config); }
LatencyDistributionConfig { public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; } LatencyDistributionConfig(String config); List<LatencyScopeConfig> getScopeConfigs(); }
LatencyDistributionConfig { public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; } LatencyDistributionConfig(String config); List<LatencyScopeConfig> getScopeConfigs(); }
@Test public void testRegisterSchemaSuccess() { new MockUp<ServiceRegistryClientImpl>() { @Mock Handler<RestResponse> syncHandlerEx(CountDownLatch countDownLatch, Holder<ResponseWrapper> holder) { return restResponse -> { HttpClientResponse response = Mockito.mock(HttpClientResponse.class); Mockito.when(response.status...
@Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaRequest(); request.setSchema(schemaContent); request.setSummar...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaR...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaR...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaR...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) { Holder<ResponseWrapper> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); try { CreateSchemaRequest request = new CreateSchemaR...
@Test public void testInValidProperty1() { expectedException.expect(IllegalStateException.class); expectedException.expectMessage("invalid latency scope, min=2, max=1."); LatencyDistributionConfig latencyDistributionConfig = new LatencyDistributionConfig("2,1,10"); Assert.assertEquals(0, latencyDistributionConfig.getSc...
public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; }
LatencyDistributionConfig { public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; } }
LatencyDistributionConfig { public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; } LatencyDistributionConfig(String config); }
LatencyDistributionConfig { public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; } LatencyDistributionConfig(String config); List<LatencyScopeConfig> getScopeConfigs(); }
LatencyDistributionConfig { public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; } LatencyDistributionConfig(String config); List<LatencyScopeConfig> getScopeConfigs(); }
@Test public void testInValidProperty2() { expectedException.expect(NumberFormatException.class); expectedException.expectMessage("For input string: \"a\""); LatencyDistributionConfig latencyDistributionConfig = new LatencyDistributionConfig("a,1,10"); Assert.assertEquals(0, latencyDistributionConfig.getScopeConfigs()....
public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; }
LatencyDistributionConfig { public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; } }
LatencyDistributionConfig { public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; } LatencyDistributionConfig(String config); }
LatencyDistributionConfig { public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; } LatencyDistributionConfig(String config); List<LatencyScopeConfig> getScopeConfigs(); }
LatencyDistributionConfig { public List<LatencyScopeConfig> getScopeConfigs() { return scopeConfigs; } LatencyDistributionConfig(String config); List<LatencyScopeConfig> getScopeConfigs(); }
@Test public void getTagKey() { Assert.assertEquals("key", finder.getTagKey()); }
@Override public String getTagKey() { return tagKey; }
DefaultTagFinder implements TagFinder { @Override public String getTagKey() { return tagKey; } }
DefaultTagFinder implements TagFinder { @Override public String getTagKey() { return tagKey; } DefaultTagFinder(String tagKey); DefaultTagFinder(String tagKey, boolean skipOnNull); }
DefaultTagFinder implements TagFinder { @Override public String getTagKey() { return tagKey; } DefaultTagFinder(String tagKey); DefaultTagFinder(String tagKey, boolean skipOnNull); @Override boolean skipOnNull(); @Override String getTagKey(); @Override Tag find(Iterable<Tag> tags); }
DefaultTagFinder implements TagFinder { @Override public String getTagKey() { return tagKey; } DefaultTagFinder(String tagKey); DefaultTagFinder(String tagKey, boolean skipOnNull); @Override boolean skipOnNull(); @Override String getTagKey(); @Override Tag find(Iterable<Tag> tags); }
@Test public void readSucc() { Tag tag = new BasicTag("key", "value"); List<Tag> tags = Arrays.asList(new BasicTag("t1", "t1v"), tag); Assert.assertSame(tag, finder.find(tags)); }
@Override public Tag find(Iterable<Tag> tags) { for (Tag tag : tags) { if (tag.key().equals(tagKey)) { return tag; } } return null; }
DefaultTagFinder implements TagFinder { @Override public Tag find(Iterable<Tag> tags) { for (Tag tag : tags) { if (tag.key().equals(tagKey)) { return tag; } } return null; } }
DefaultTagFinder implements TagFinder { @Override public Tag find(Iterable<Tag> tags) { for (Tag tag : tags) { if (tag.key().equals(tagKey)) { return tag; } } return null; } DefaultTagFinder(String tagKey); DefaultTagFinder(String tagKey, boolean skipOnNull); }
DefaultTagFinder implements TagFinder { @Override public Tag find(Iterable<Tag> tags) { for (Tag tag : tags) { if (tag.key().equals(tagKey)) { return tag; } } return null; } DefaultTagFinder(String tagKey); DefaultTagFinder(String tagKey, boolean skipOnNull); @Override boolean skipOnNull(); @Override String getTagKey(...
DefaultTagFinder implements TagFinder { @Override public Tag find(Iterable<Tag> tags) { for (Tag tag : tags) { if (tag.key().equals(tagKey)) { return tag; } } return null; } DefaultTagFinder(String tagKey); DefaultTagFinder(String tagKey, boolean skipOnNull); @Override boolean skipOnNull(); @Override String getTagKey(...
@Test public void readFail() { List<Tag> tags = Arrays.asList(new BasicTag("t1", "t1v")); Assert.assertNull(finder.find(tags)); }
@Override public Tag find(Iterable<Tag> tags) { for (Tag tag : tags) { if (tag.key().equals(tagKey)) { return tag; } } return null; }
DefaultTagFinder implements TagFinder { @Override public Tag find(Iterable<Tag> tags) { for (Tag tag : tags) { if (tag.key().equals(tagKey)) { return tag; } } return null; } }
DefaultTagFinder implements TagFinder { @Override public Tag find(Iterable<Tag> tags) { for (Tag tag : tags) { if (tag.key().equals(tagKey)) { return tag; } } return null; } DefaultTagFinder(String tagKey); DefaultTagFinder(String tagKey, boolean skipOnNull); }
DefaultTagFinder implements TagFinder { @Override public Tag find(Iterable<Tag> tags) { for (Tag tag : tags) { if (tag.key().equals(tagKey)) { return tag; } } return null; } DefaultTagFinder(String tagKey); DefaultTagFinder(String tagKey, boolean skipOnNull); @Override boolean skipOnNull(); @Override String getTagKey(...
DefaultTagFinder implements TagFinder { @Override public Tag find(Iterable<Tag> tags) { for (Tag tag : tags) { if (tag.key().equals(tagKey)) { return tag; } } return null; } DefaultTagFinder(String tagKey); DefaultTagFinder(String tagKey, boolean skipOnNull); @Override boolean skipOnNull(); @Override String getTagKey(...
@Test public void addGroup() { config.addGroup("id1", "tag1.1", "tag1.2"); config.addGroup("id2", "tag2.1", "tag2.2"); Assert.assertThat(groups.keySet(), Matchers.contains("id2", "id1")); Assert.assertThat(groups.get("id1").stream().map(e -> { return e.getTagKey(); }).toArray(), Matchers.arrayContaining("tag1.1", "tag1...
public void addGroup(String idName, Object... tagNameOrFinders) { groups.put(idName, Arrays .asList(tagNameOrFinders) .stream() .map(r -> TagFinder.build(r)) .collect(Collectors.toList())); }
MeasurementGroupConfig { public void addGroup(String idName, Object... tagNameOrFinders) { groups.put(idName, Arrays .asList(tagNameOrFinders) .stream() .map(r -> TagFinder.build(r)) .collect(Collectors.toList())); } }
MeasurementGroupConfig { public void addGroup(String idName, Object... tagNameOrFinders) { groups.put(idName, Arrays .asList(tagNameOrFinders) .stream() .map(r -> TagFinder.build(r)) .collect(Collectors.toList())); } MeasurementGroupConfig(); MeasurementGroupConfig(String idName, Object... tagNameOrFinders); }
MeasurementGroupConfig { public void addGroup(String idName, Object... tagNameOrFinders) { groups.put(idName, Arrays .asList(tagNameOrFinders) .stream() .map(r -> TagFinder.build(r)) .collect(Collectors.toList())); } MeasurementGroupConfig(); MeasurementGroupConfig(String idName, Object... tagNameOrFinders); void addG...
MeasurementGroupConfig { public void addGroup(String idName, Object... tagNameOrFinders) { groups.put(idName, Arrays .asList(tagNameOrFinders) .stream() .map(r -> TagFinder.build(r)) .collect(Collectors.toList())); } MeasurementGroupConfig(); MeasurementGroupConfig(String idName, Object... tagNameOrFinders); void addG...
@Test public void from() { timer.record(10, TimeUnit.NANOSECONDS); timer.record(2, TimeUnit.NANOSECONDS); MeasurementGroupConfig config = new MeasurementGroupConfig("id", "g1", "g2", Statistic.count.key()); tree.from(registry.iterator(), config); Assert.assertEquals(2, tree.getChildren().size()); MeasurementNode node =...
public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); }
MeasurementTree extends MeasurementNode { public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); } }
MeasurementTree extends MeasurementNode { public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); } MeasurementTree(); }
MeasurementTree extends MeasurementNode { public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); } MeasurementTree(); void from(Iterator<Meter> meters, MeasurementGroupCo...
MeasurementTree extends MeasurementNode { public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); } MeasurementTree(); void from(Iterator<Meter> meters, MeasurementGroupCo...
@Test public void from_withSkipOnNull() { try { MeasurementGroupConfig config = new MeasurementGroupConfig("id", new DefaultTagFinder("notExist", true)); tree.from(registry.iterator(), config); } catch (Exception e) { Assert.fail("should not throw exception"); } }
public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); }
MeasurementTree extends MeasurementNode { public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); } }
MeasurementTree extends MeasurementNode { public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); } MeasurementTree(); }
MeasurementTree extends MeasurementNode { public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); } MeasurementTree(); void from(Iterator<Meter> meters, MeasurementGroupCo...
MeasurementTree extends MeasurementNode { public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); } MeasurementTree(); void from(Iterator<Meter> meters, MeasurementGroupCo...
@Test public void from_failed() { expectedException.expect(IllegalStateException.class); expectedException.expectMessage(Matchers .is("tag key \"notExist\" not exist in Measurement(id:g1=g1v:g2=g2v:statistic=count:t3=t3v:t4=t4v,0,0.0)")); MeasurementGroupConfig config = new MeasurementGroupConfig("id", "notExist"); tre...
public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); }
MeasurementTree extends MeasurementNode { public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); } }
MeasurementTree extends MeasurementNode { public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); } MeasurementTree(); }
MeasurementTree extends MeasurementNode { public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); } MeasurementTree(); void from(Iterator<Meter> meters, MeasurementGroupCo...
MeasurementTree extends MeasurementNode { public void from(Iterator<Meter> meters, MeasurementGroupConfig groupConfig) { meters.forEachRemaining(meter -> { Iterable<Measurement> measurements = meter.measure(); from(measurements, groupConfig); }); } MeasurementTree(); void from(Iterator<Meter> meters, MeasurementGroupCo...
@Test public void getName() { Assert.assertEquals("name", node.getName()); }
public String getName() { return name; }
MeasurementNode { public String getName() { return name; } }
MeasurementNode { public String getName() { return name; } MeasurementNode(String name, Map<String, MeasurementNode> children); }
MeasurementNode { public String getName() { return name; } MeasurementNode(String name, Map<String, MeasurementNode> children); String getName(); Map<String, MeasurementNode> getChildren(); MeasurementNode findChild(String childName); MeasurementNode findChild(String... childNames); MeasurementNode addChild(String chil...
MeasurementNode { public String getName() { return name; } MeasurementNode(String name, Map<String, MeasurementNode> children); String getName(); Map<String, MeasurementNode> getChildren(); MeasurementNode findChild(String childName); MeasurementNode findChild(String... childNames); MeasurementNode addChild(String chil...
@Test public void syncHandler_failed(@Mocked RequestContext requestContext, @Mocked HttpClientResponse response) { CountDownLatch countDownLatch = new CountDownLatch(1); Class<GetExistenceResponse> cls = GetExistenceResponse.class; Holder<GetExistenceResponse> holder = new Holder<>(); Handler<RestResponse> handler = oC...
@VisibleForTesting @SuppressWarnings("unchecked") protected <T> Handler<RestResponse> syncHandler(CountDownLatch countDownLatch, Class<T> cls, Holder<T> holder) { return restResponse -> { RequestContext requestContext = restResponse.getRequestContext(); HttpClientResponse response = restResponse.getResponse(); if (resp...
ServiceRegistryClientImpl implements ServiceRegistryClient { @VisibleForTesting @SuppressWarnings("unchecked") protected <T> Handler<RestResponse> syncHandler(CountDownLatch countDownLatch, Class<T> cls, Holder<T> holder) { return restResponse -> { RequestContext requestContext = restResponse.getRequestContext(); HttpC...
ServiceRegistryClientImpl implements ServiceRegistryClient { @VisibleForTesting @SuppressWarnings("unchecked") protected <T> Handler<RestResponse> syncHandler(CountDownLatch countDownLatch, Class<T> cls, Holder<T> holder) { return restResponse -> { RequestContext requestContext = restResponse.getRequestContext(); HttpC...
ServiceRegistryClientImpl implements ServiceRegistryClient { @VisibleForTesting @SuppressWarnings("unchecked") protected <T> Handler<RestResponse> syncHandler(CountDownLatch countDownLatch, Class<T> cls, Holder<T> holder) { return restResponse -> { RequestContext requestContext = restResponse.getRequestContext(); HttpC...
ServiceRegistryClientImpl implements ServiceRegistryClient { @VisibleForTesting @SuppressWarnings("unchecked") protected <T> Handler<RestResponse> syncHandler(CountDownLatch countDownLatch, Class<T> cls, Holder<T> holder) { return restResponse -> { RequestContext requestContext = restResponse.getRequestContext(); HttpC...
@Test public void getChildren() { Map<String, MeasurementNode> children = new HashMap<>(); node = new MeasurementNode("name", children); Assert.assertSame(children, node.getChildren()); }
public Map<String, MeasurementNode> getChildren() { return children; }
MeasurementNode { public Map<String, MeasurementNode> getChildren() { return children; } }
MeasurementNode { public Map<String, MeasurementNode> getChildren() { return children; } MeasurementNode(String name, Map<String, MeasurementNode> children); }
MeasurementNode { public Map<String, MeasurementNode> getChildren() { return children; } MeasurementNode(String name, Map<String, MeasurementNode> children); String getName(); Map<String, MeasurementNode> getChildren(); MeasurementNode findChild(String childName); MeasurementNode findChild(String... childNames); Measur...
MeasurementNode { public Map<String, MeasurementNode> getChildren() { return children; } MeasurementNode(String name, Map<String, MeasurementNode> children); String getName(); Map<String, MeasurementNode> getChildren(); MeasurementNode findChild(String childName); MeasurementNode findChild(String... childNames); Measur...
@Test public void findChild_noChildren() { Assert.assertNull(node.findChild("child")); }
public MeasurementNode findChild(String childName) { if (children == null) { return null; } return children.get(childName); }
MeasurementNode { public MeasurementNode findChild(String childName) { if (children == null) { return null; } return children.get(childName); } }
MeasurementNode { public MeasurementNode findChild(String childName) { if (children == null) { return null; } return children.get(childName); } MeasurementNode(String name, Map<String, MeasurementNode> children); }
MeasurementNode { public MeasurementNode findChild(String childName) { if (children == null) { return null; } return children.get(childName); } MeasurementNode(String name, Map<String, MeasurementNode> children); String getName(); Map<String, MeasurementNode> getChildren(); MeasurementNode findChild(String childName); ...
MeasurementNode { public MeasurementNode findChild(String childName) { if (children == null) { return null; } return children.get(childName); } MeasurementNode(String name, Map<String, MeasurementNode> children); String getName(); Map<String, MeasurementNode> getChildren(); MeasurementNode findChild(String childName); ...
@Test public void addChild(@Mocked Measurement measurement) { MeasurementNode c1 = node.addChild("c1", measurement); MeasurementNode c2 = node.addChild("c2", measurement); Assert.assertSame(c1, node.findChild("c1")); Assert.assertSame(c2, node.findChild("c2")); }
public MeasurementNode addChild(String childName, Measurement measurement) { if (children == null) { children = new LinkedHashMap<>(); } MeasurementNode node = children.computeIfAbsent(childName, name -> new MeasurementNode(name, null)); node.addMeasurement(measurement); return node; }
MeasurementNode { public MeasurementNode addChild(String childName, Measurement measurement) { if (children == null) { children = new LinkedHashMap<>(); } MeasurementNode node = children.computeIfAbsent(childName, name -> new MeasurementNode(name, null)); node.addMeasurement(measurement); return node; } }
MeasurementNode { public MeasurementNode addChild(String childName, Measurement measurement) { if (children == null) { children = new LinkedHashMap<>(); } MeasurementNode node = children.computeIfAbsent(childName, name -> new MeasurementNode(name, null)); node.addMeasurement(measurement); return node; } MeasurementNode...
MeasurementNode { public MeasurementNode addChild(String childName, Measurement measurement) { if (children == null) { children = new LinkedHashMap<>(); } MeasurementNode node = children.computeIfAbsent(childName, name -> new MeasurementNode(name, null)); node.addMeasurement(measurement); return node; } MeasurementNode...
MeasurementNode { public MeasurementNode addChild(String childName, Measurement measurement) { if (children == null) { children = new LinkedHashMap<>(); } MeasurementNode node = children.computeIfAbsent(childName, name -> new MeasurementNode(name, null)); node.addMeasurement(measurement); return node; } MeasurementNode...
@Test public void getMeasurements(@Mocked Measurement measurement) { node.addMeasurement(measurement); Assert.assertThat(node.getMeasurements(), Matchers.contains(measurement)); }
public List<Measurement> getMeasurements() { return measurements; }
MeasurementNode { public List<Measurement> getMeasurements() { return measurements; } }
MeasurementNode { public List<Measurement> getMeasurements() { return measurements; } MeasurementNode(String name, Map<String, MeasurementNode> children); }
MeasurementNode { public List<Measurement> getMeasurements() { return measurements; } MeasurementNode(String name, Map<String, MeasurementNode> children); String getName(); Map<String, MeasurementNode> getChildren(); MeasurementNode findChild(String childName); MeasurementNode findChild(String... childNames); Measureme...
MeasurementNode { public List<Measurement> getMeasurements() { return measurements; } MeasurementNode(String name, Map<String, MeasurementNode> children); String getName(); Map<String, MeasurementNode> getChildren(); MeasurementNode findChild(String childName); MeasurementNode findChild(String... childNames); Measureme...
@Test public void summary(@Mocked Measurement measurement) { new Expectations() { { measurement.value(); result = 10; } }; node.addMeasurement(measurement); node.addMeasurement(measurement); Assert.assertEquals(20, node.summary(), 0); }
public double summary() { double result = 0; for (Measurement measurement : measurements) { result += measurement.value(); } return result; }
MeasurementNode { public double summary() { double result = 0; for (Measurement measurement : measurements) { result += measurement.value(); } return result; } }
MeasurementNode { public double summary() { double result = 0; for (Measurement measurement : measurements) { result += measurement.value(); } return result; } MeasurementNode(String name, Map<String, MeasurementNode> children); }
MeasurementNode { public double summary() { double result = 0; for (Measurement measurement : measurements) { result += measurement.value(); } return result; } MeasurementNode(String name, Map<String, MeasurementNode> children); String getName(); Map<String, MeasurementNode> getChildren(); MeasurementNode findChild(Str...
MeasurementNode { public double summary() { double result = 0; for (Measurement measurement : measurements) { result += measurement.value(); } return result; } MeasurementNode(String name, Map<String, MeasurementNode> children); String getName(); Map<String, MeasurementNode> getChildren(); MeasurementNode findChild(Str...
@Test public void loadMetricsInitializers() { List<MetricsInitializer> initList = new ArrayList<>(); MetricsInitializer metricsInitializer = new MetricsInitializer() { @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { initList.add(this); } }; new Expectations(...
protected void loadMetricsInitializers() { SPIServiceUtils.getSortedService(MetricsInitializer.class) .forEach(initializer -> initializer.init(globalRegistry, eventBus, config)); }
MetricsBootstrap { protected void loadMetricsInitializers() { SPIServiceUtils.getSortedService(MetricsInitializer.class) .forEach(initializer -> initializer.init(globalRegistry, eventBus, config)); } }
MetricsBootstrap { protected void loadMetricsInitializers() { SPIServiceUtils.getSortedService(MetricsInitializer.class) .forEach(initializer -> initializer.init(globalRegistry, eventBus, config)); } }
MetricsBootstrap { protected void loadMetricsInitializers() { SPIServiceUtils.getSortedService(MetricsInitializer.class) .forEach(initializer -> initializer.init(globalRegistry, eventBus, config)); } void start(GlobalRegistry globalRegistry, EventBus eventBus); void shutdown(); synchronized void pollMeters(); }
MetricsBootstrap { protected void loadMetricsInitializers() { SPIServiceUtils.getSortedService(MetricsInitializer.class) .forEach(initializer -> initializer.init(globalRegistry, eventBus, config)); } void start(GlobalRegistry globalRegistry, EventBus eventBus); void shutdown(); synchronized void pollMeters(); }
@Test public void pollMeters(@Mocked Registry registry, @Mocked Meter meter, @Mocked Measurement measurement, @Mocked ScheduledExecutorService executor) { List<Meter> meters = Arrays.asList(meter); globalRegistry.add(registry); new Expectations(Executors.class) { { Executors.newScheduledThreadPool(1, (ThreadFactory) an...
public synchronized void pollMeters() { try { long secondInterval = TimeUnit.MILLISECONDS.toSeconds(config.getMsPollInterval()); PolledEvent polledEvent = globalRegistry.poll(secondInterval); eventBus.post(polledEvent); } catch (Throwable e) { LOGGER.error("poll meters error. ", e); } }
MetricsBootstrap { public synchronized void pollMeters() { try { long secondInterval = TimeUnit.MILLISECONDS.toSeconds(config.getMsPollInterval()); PolledEvent polledEvent = globalRegistry.poll(secondInterval); eventBus.post(polledEvent); } catch (Throwable e) { LOGGER.error("poll meters error. ", e); } } }
MetricsBootstrap { public synchronized void pollMeters() { try { long secondInterval = TimeUnit.MILLISECONDS.toSeconds(config.getMsPollInterval()); PolledEvent polledEvent = globalRegistry.poll(secondInterval); eventBus.post(polledEvent); } catch (Throwable e) { LOGGER.error("poll meters error. ", e); } } }
MetricsBootstrap { public synchronized void pollMeters() { try { long secondInterval = TimeUnit.MILLISECONDS.toSeconds(config.getMsPollInterval()); PolledEvent polledEvent = globalRegistry.poll(secondInterval); eventBus.post(polledEvent); } catch (Throwable e) { LOGGER.error("poll meters error. ", e); } } void start(G...
MetricsBootstrap { public synchronized void pollMeters() { try { long secondInterval = TimeUnit.MILLISECONDS.toSeconds(config.getMsPollInterval()); PolledEvent polledEvent = globalRegistry.poll(secondInterval); eventBus.post(polledEvent); } catch (Throwable e) { LOGGER.error("poll meters error. ", e); } } void start(G...
@Test public void shutdown(@Mocked ScheduledExecutorService scheduledExecutorService) { List<MetricsInitializer> destroyList = new ArrayList<>(); MetricsInitializer initializer1 = new MetricsInitializer() { @Override public int getOrder() { return 1; } @Override public void init(GlobalRegistry globalRegistry, EventBus ...
public void shutdown() { if (executorService != null) { executorService.shutdown(); } List<MetricsInitializer> initializers = new ArrayList<>(SPIServiceUtils.getSortedService(MetricsInitializer.class)); Collections.reverse(initializers); initializers.forEach(initializer -> initializer.destroy()); }
MetricsBootstrap { public void shutdown() { if (executorService != null) { executorService.shutdown(); } List<MetricsInitializer> initializers = new ArrayList<>(SPIServiceUtils.getSortedService(MetricsInitializer.class)); Collections.reverse(initializers); initializers.forEach(initializer -> initializer.destroy()); } }
MetricsBootstrap { public void shutdown() { if (executorService != null) { executorService.shutdown(); } List<MetricsInitializer> initializers = new ArrayList<>(SPIServiceUtils.getSortedService(MetricsInitializer.class)); Collections.reverse(initializers); initializers.forEach(initializer -> initializer.destroy()); } ...
MetricsBootstrap { public void shutdown() { if (executorService != null) { executorService.shutdown(); } List<MetricsInitializer> initializers = new ArrayList<>(SPIServiceUtils.getSortedService(MetricsInitializer.class)); Collections.reverse(initializers); initializers.forEach(initializer -> initializer.destroy()); } ...
MetricsBootstrap { public void shutdown() { if (executorService != null) { executorService.shutdown(); } List<MetricsInitializer> initializers = new ArrayList<>(SPIServiceUtils.getSortedService(MetricsInitializer.class)); Collections.reverse(initializers); initializers.forEach(initializer -> initializer.destroy()); } ...
@Test public void shutdown_notStart() { Assert.assertNull(Deencapsulation.getField(bootstrap, "executorService")); bootstrap.shutdown(); }
public void shutdown() { if (executorService != null) { executorService.shutdown(); } List<MetricsInitializer> initializers = new ArrayList<>(SPIServiceUtils.getSortedService(MetricsInitializer.class)); Collections.reverse(initializers); initializers.forEach(initializer -> initializer.destroy()); }
MetricsBootstrap { public void shutdown() { if (executorService != null) { executorService.shutdown(); } List<MetricsInitializer> initializers = new ArrayList<>(SPIServiceUtils.getSortedService(MetricsInitializer.class)); Collections.reverse(initializers); initializers.forEach(initializer -> initializer.destroy()); } }
MetricsBootstrap { public void shutdown() { if (executorService != null) { executorService.shutdown(); } List<MetricsInitializer> initializers = new ArrayList<>(SPIServiceUtils.getSortedService(MetricsInitializer.class)); Collections.reverse(initializers); initializers.forEach(initializer -> initializer.destroy()); } ...
MetricsBootstrap { public void shutdown() { if (executorService != null) { executorService.shutdown(); } List<MetricsInitializer> initializers = new ArrayList<>(SPIServiceUtils.getSortedService(MetricsInitializer.class)); Collections.reverse(initializers); initializers.forEach(initializer -> initializer.destroy()); } ...
MetricsBootstrap { public void shutdown() { if (executorService != null) { executorService.shutdown(); } List<MetricsInitializer> initializers = new ArrayList<>(SPIServiceUtils.getSortedService(MetricsInitializer.class)); Collections.reverse(initializers); initializers.forEach(initializer -> initializer.destroy()); } ...
@Test public void unknown() { Assert.assertThat(resolver.replace("prefix${xxx}suffix", parameters), Matchers.contains("prefix${xxx}suffix")); }
public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.get(idx); replaced.set(...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
@Test public void isSchemaExist() { String microserviceId = "msId"; String schemaId = "schemaId"; new MockUp<RestClientUtil>() { @Mock void httpDo(RequestContext requestContext, Handler<RestResponse> responseHandler) { Holder<GetExistenceResponse> holder = Deencapsulation.getField(responseHandler, "arg$4"); holder.valu...
@Override public boolean isSchemaExist(String microserviceId, String schemaId) { Holder<GetExistenceResponse> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); CountDownLatch countDownLatch = new CountDownLatch(1); restClientUtil.get(ipPort, Const.REGISTRY_API.MICROSERVICE_EXISTENCE, new Req...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean isSchemaExist(String microserviceId, String schemaId) { Holder<GetExistenceResponse> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); CountDownLatch countDownLatch = new CountDownLatch(1); restClientUtil.g...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean isSchemaExist(String microserviceId, String schemaId) { Holder<GetExistenceResponse> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); CountDownLatch countDownLatch = new CountDownLatch(1); restClientUtil.g...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean isSchemaExist(String microserviceId, String schemaId) { Holder<GetExistenceResponse> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); CountDownLatch countDownLatch = new CountDownLatch(1); restClientUtil.g...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public boolean isSchemaExist(String microserviceId, String schemaId) { Holder<GetExistenceResponse> holder = new Holder<>(); IpPort ipPort = ipPortManager.getAvailableAddress(); CountDownLatch countDownLatch = new CountDownLatch(1); restClientUtil.g...
@Test public void empty() { Assert.assertThat(resolver.replace("prefix${}suffix", parameters), Matchers.contains("prefix${}suffix")); }
public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.get(idx); replaced.set(...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
@Test public void notComplete() { Assert.assertThat(resolver.replace("prefix${suffix", parameters), Matchers.contains("prefix${suffix")); }
public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.get(idx); replaced.set(...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
@Test public void normal() { Assert.assertThat(resolver.replace("prefix.${key}.suffix", parameters), Matchers.contains("prefix.value.suffix")); }
public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.get(idx); replaced.set(...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
@Test public void disable() { Assert.assertThat(resolver.replace("prefix.\\${key}.suffix", parameters), Matchers.contains("prefix.${key}.suffix")); }
public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.get(idx); replaced.set(...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
@Test public void varOfVar() { Assert.assertThat(resolver.replace("prefix.${varOfVar}.suffix", parameters), Matchers.contains("prefix.value.suffix")); }
public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.get(idx); replaced.set(...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
@Test public void list() { Assert.assertThat(resolver.replace("prefix.${low-list}.suffix", parameters), Matchers.contains("prefix.low-1.suffix", "prefix.low-2.suffix")); }
public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.get(idx); replaced.set(...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
@Test public void multi_list() { Assert.assertThat(resolver.replace("prefix.${low-list}.${middle-list}.${high-list}.suffix", parameters), Matchers.contains( "prefix.low-1.middle-1.high-1.suffix", "prefix.low-1.middle-1.high-2.suffix", "prefix.low-1.middle-2.high-1.suffix", "prefix.low-1.middle-2.high-2.suffix", "prefix...
public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.get(idx); replaced.set(...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
@Test public void nested() { Assert.assertThat(resolver.replace("prefix.${${priority}-list}.suffix", parameters), Matchers.contains("prefix.low-1.suffix", "prefix.low-2.suffix")); }
public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.get(idx); replaced.set(...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
@Test public void mixed() { Assert.assertThat(resolver.replace("prefix.${${priority}-list}.${key}.${high-list}.suffix ${xxx}", parameters), Matchers.contains( "prefix.low-1.value.high-1.suffix ${xxx}", "prefix.low-2.value.high-1.suffix ${xxx}", "prefix.low-1.value.high-2.suffix ${xxx}", "prefix.low-2.value.high-2.suffi...
public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.get(idx); replaced.set(...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
PlaceholderResolver { public List<String> replace(String str, Map<String, Object> parameters) { List<Row> finalRows = replaceToRows(str, parameters); List<String> replaced = new ArrayList<>(); for (Row row : finalRows) { resolve(row, replaced); } for (int idx = 0; idx < replaced.size(); idx++) { String row = replaced.g...
@Test public void testLong() { PriorityProperty<Long> config = priorityPropertyManager.createPriorityProperty(Long.class, -1L, -2L, keys); Assert.assertEquals(-2L, (long) config.getValue()); ArchaiusUtils.setProperty(low, 1L); Assert.assertEquals(1L, (long) config.getValue()); ArchaiusUtils.setProperty(middle, 2L); Ass...
public T getValue() { return finalValue; }
PriorityProperty { public T getValue() { return finalValue; } }
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); }
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); String[] getPriorityKeys(); T getDefaultValue(); DynamicProperty[] getProperties(); T getValue(); void setCallback(BiConsumer<T, Object> call...
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); String[] getPriorityKeys(); T getDefaultValue(); DynamicProperty[] getProperties(); T getValue(); void setCallback(BiConsumer<T, Object> call...
@Test public void getAggregatedMicroservice() { String microserviceId = "msId"; new MockUp<RestClientUtil>() { @Mock void httpDo(RequestContext requestContext, Handler<RestResponse> responseHandler) { Holder<GetServiceResponse> holder = Deencapsulation.getField(responseHandler, "arg$4"); holder.value = Json .decodeValu...
@Override public Microservice getAggregatedMicroservice(String microserviceId) { return doGetMicroservice(microserviceId, true); }
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public Microservice getAggregatedMicroservice(String microserviceId) { return doGetMicroservice(microserviceId, true); } }
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public Microservice getAggregatedMicroservice(String microserviceId) { return doGetMicroservice(microserviceId, true); } ServiceRegistryClientImpl(ServiceRegistryConfig serviceRegistryConfig); }
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public Microservice getAggregatedMicroservice(String microserviceId) { return doGetMicroservice(microserviceId, true); } ServiceRegistryClientImpl(ServiceRegistryConfig serviceRegistryConfig); @Override void init(); @Override List<Microservice> getA...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public Microservice getAggregatedMicroservice(String microserviceId) { return doGetMicroservice(microserviceId, true); } ServiceRegistryClientImpl(ServiceRegistryConfig serviceRegistryConfig); @Override void init(); @Override List<Microservice> getA...
@Test public void onBeforeProducerProvider_metrics_endpoint_enabled_by_default() { final MetricsBootListener listener = new MetricsBootListener(); final List<ProducerMeta> producerMetas = new ArrayList<>(); final BootEvent event = new BootEvent(); final ProducerMeta producerMeta = new ProducerMeta(); final SCBEngine sc...
@Override public void onBeforeProducerProvider(BootEvent event) { if (!DynamicPropertyFactory.getInstance().getBooleanProperty("servicecomb.metrics.endpoint.enabled", true).get()) { return; } MetricsRestPublisher metricsRestPublisher = SPIServiceUtils.getTargetService(MetricsInitializer.class, MetricsRestPublisher.clas...
MetricsBootListener implements BootListener { @Override public void onBeforeProducerProvider(BootEvent event) { if (!DynamicPropertyFactory.getInstance().getBooleanProperty("servicecomb.metrics.endpoint.enabled", true).get()) { return; } MetricsRestPublisher metricsRestPublisher = SPIServiceUtils.getTargetService(Metri...
MetricsBootListener implements BootListener { @Override public void onBeforeProducerProvider(BootEvent event) { if (!DynamicPropertyFactory.getInstance().getBooleanProperty("servicecomb.metrics.endpoint.enabled", true).get()) { return; } MetricsRestPublisher metricsRestPublisher = SPIServiceUtils.getTargetService(Metri...
MetricsBootListener implements BootListener { @Override public void onBeforeProducerProvider(BootEvent event) { if (!DynamicPropertyFactory.getInstance().getBooleanProperty("servicecomb.metrics.endpoint.enabled", true).get()) { return; } MetricsRestPublisher metricsRestPublisher = SPIServiceUtils.getTargetService(Metri...
MetricsBootListener implements BootListener { @Override public void onBeforeProducerProvider(BootEvent event) { if (!DynamicPropertyFactory.getInstance().getBooleanProperty("servicecomb.metrics.endpoint.enabled", true).get()) { return; } MetricsRestPublisher metricsRestPublisher = SPIServiceUtils.getTargetService(Metri...
@Test public void testInt() { PriorityProperty<Integer> config = priorityPropertyManager.createPriorityProperty(Integer.class, -1, -2, keys); Assert.assertEquals(-2L, (int) config.getValue()); ArchaiusUtils.setProperty(low, 1); Assert.assertEquals(1, (int) config.getValue()); ArchaiusUtils.setProperty(middle, 2); Asser...
public T getValue() { return finalValue; }
PriorityProperty { public T getValue() { return finalValue; } }
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); }
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); String[] getPriorityKeys(); T getDefaultValue(); DynamicProperty[] getProperties(); T getValue(); void setCallback(BiConsumer<T, Object> call...
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); String[] getPriorityKeys(); T getDefaultValue(); DynamicProperty[] getProperties(); T getValue(); void setCallback(BiConsumer<T, Object> call...
@Test public void testString() { PriorityProperty<String> config = priorityPropertyManager.createPriorityProperty(String.class, null, "def", keys); Assert.assertEquals("def", config.getValue()); ArchaiusUtils.setProperty(low, 1); Assert.assertEquals("1", config.getValue()); ArchaiusUtils.setProperty(middle, 2); Assert....
public T getValue() { return finalValue; }
PriorityProperty { public T getValue() { return finalValue; } }
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); }
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); String[] getPriorityKeys(); T getDefaultValue(); DynamicProperty[] getProperties(); T getValue(); void setCallback(BiConsumer<T, Object> call...
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); String[] getPriorityKeys(); T getDefaultValue(); DynamicProperty[] getProperties(); T getValue(); void setCallback(BiConsumer<T, Object> call...
@Test public void testBoolean() { PriorityProperty<Boolean> config = priorityPropertyManager.createPriorityProperty(Boolean.class, null, false, keys); Assert.assertFalse(config.getValue()); ArchaiusUtils.setProperty(low, true); Assert.assertTrue(config.getValue()); ArchaiusUtils.setProperty(middle, false); Assert.asser...
public T getValue() { return finalValue; }
PriorityProperty { public T getValue() { return finalValue; } }
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); }
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); String[] getPriorityKeys(); T getDefaultValue(); DynamicProperty[] getProperties(); T getValue(); void setCallback(BiConsumer<T, Object> call...
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); String[] getPriorityKeys(); T getDefaultValue(); DynamicProperty[] getProperties(); T getValue(); void setCallback(BiConsumer<T, Object> call...
@Test public void testDouble() { PriorityProperty<Double> config = priorityPropertyManager.createPriorityProperty(Double.class, null, -2.0, keys); Assert.assertEquals(-2, config.getValue(), 0); ArchaiusUtils.setProperty(low, 1); Assert.assertEquals(1, config.getValue(), 0); ArchaiusUtils.setProperty(middle, 2); Assert....
public T getValue() { return finalValue; }
PriorityProperty { public T getValue() { return finalValue; } }
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); }
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); String[] getPriorityKeys(); T getDefaultValue(); DynamicProperty[] getProperties(); T getValue(); void setCallback(BiConsumer<T, Object> call...
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); String[] getPriorityKeys(); T getDefaultValue(); DynamicProperty[] getProperties(); T getValue(); void setCallback(BiConsumer<T, Object> call...
@Test public void testFloat() { PriorityProperty<Float> config = priorityPropertyManager.createPriorityProperty(Float.class, null, -2.0f, keys); Assert.assertEquals(-2, config.getValue(), 0); ArchaiusUtils.setProperty(low, 1); Assert.assertEquals(1, config.getValue(), 0); ArchaiusUtils.setProperty(middle, 2); Assert.as...
public T getValue() { return finalValue; }
PriorityProperty { public T getValue() { return finalValue; } }
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); }
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); String[] getPriorityKeys(); T getDefaultValue(); DynamicProperty[] getProperties(); T getValue(); void setCallback(BiConsumer<T, Object> call...
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); String[] getPriorityKeys(); T getDefaultValue(); DynamicProperty[] getProperties(); T getValue(); void setCallback(BiConsumer<T, Object> call...
@Test public void globalRefresh() { PriorityProperty<String> property = priorityPropertyManager.createPriorityProperty(String.class, null, null, keys); Assert.assertNull(property.getValue()); ConcurrentCompositeConfiguration config = (ConcurrentCompositeConfiguration) DynamicPropertyFactory .getBackingConfigurationSour...
public T getValue() { return finalValue; }
PriorityProperty { public T getValue() { return finalValue; } }
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); }
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); String[] getPriorityKeys(); T getDefaultValue(); DynamicProperty[] getProperties(); T getValue(); void setCallback(BiConsumer<T, Object> call...
PriorityProperty { public T getValue() { return finalValue; } @SuppressWarnings("unchecked") PriorityProperty(Type type, T invalidValue, T defaultValue, String... priorityKeys); String[] getPriorityKeys(); T getDefaultValue(); DynamicProperty[] getProperties(); T getValue(); void setCallback(BiConsumer<T, Object> call...
@Test public void testAddConfig() { Map<String, Object> config = new HashMap<>(); config.put("service_description.name", "service_name_test"); ConfigUtil.setConfigs(config); ConfigUtil.addConfig("service_description.version", "1.0.2"); ConfigUtil.addConfig("cse.test.enabled", true); ConfigUtil.addConfig("cse.test.num",...
public static void addConfig(String key, Object value) { localConfig.put(key, value); }
ConfigUtil { public static void addConfig(String key, Object value) { localConfig.put(key, value); } }
ConfigUtil { public static void addConfig(String key, Object value) { localConfig.put(key, value); } private ConfigUtil(); }
ConfigUtil { public static void addConfig(String key, Object value) { localConfig.put(key, value); } private ConfigUtil(); static void setConfigs(Map<String, Object> config); static void addConfig(String key, Object value); static Object getProperty(String key); static Object getProperty(Object config, String key); st...
ConfigUtil { public static void addConfig(String key, Object value) { localConfig.put(key, value); } private ConfigUtil(); static void setConfigs(Map<String, Object> config); static void addConfig(String key, Object value); static Object getProperty(String key); static Object getProperty(Object config, String key); st...
@Test public void testCreateDynamicConfigHasConfigCenter() { AbstractConfiguration dynamicConfig = ConfigUtil.createDynamicConfig(); Assert.assertEquals(DynamicWatchedConfiguration.class, ((ConcurrentCompositeConfiguration) dynamicConfig).getConfiguration(0).getClass()); }
public static AbstractConfiguration createDynamicConfig() { ConcurrentCompositeConfiguration compositeConfig = ConfigUtil.createLocalConfig(); ConfigCenterConfigurationSource configCenterConfigurationSource = createConfigCenterConfigurationSource(compositeConfig); if (configCenterConfigurationSource != null) { createDy...
ConfigUtil { public static AbstractConfiguration createDynamicConfig() { ConcurrentCompositeConfiguration compositeConfig = ConfigUtil.createLocalConfig(); ConfigCenterConfigurationSource configCenterConfigurationSource = createConfigCenterConfigurationSource(compositeConfig); if (configCenterConfigurationSource != nul...
ConfigUtil { public static AbstractConfiguration createDynamicConfig() { ConcurrentCompositeConfiguration compositeConfig = ConfigUtil.createLocalConfig(); ConfigCenterConfigurationSource configCenterConfigurationSource = createConfigCenterConfigurationSource(compositeConfig); if (configCenterConfigurationSource != nul...
ConfigUtil { public static AbstractConfiguration createDynamicConfig() { ConcurrentCompositeConfiguration compositeConfig = ConfigUtil.createLocalConfig(); ConfigCenterConfigurationSource configCenterConfigurationSource = createConfigCenterConfigurationSource(compositeConfig); if (configCenterConfigurationSource != nul...
ConfigUtil { public static AbstractConfiguration createDynamicConfig() { ConcurrentCompositeConfiguration compositeConfig = ConfigUtil.createLocalConfig(); ConfigCenterConfigurationSource configCenterConfigurationSource = createConfigCenterConfigurationSource(compositeConfig); if (configCenterConfigurationSource != nul...
@Test public void testGetPropertyInvalidConfig() { Assert.assertNull(ConfigUtil.getProperty(null, "any")); Assert.assertNull(ConfigUtil.getProperty(new Object(), "any")); }
public static Object getProperty(String key) { Object config = DynamicPropertyFactory.getBackingConfigurationSource(); return getProperty(config, key); }
ConfigUtil { public static Object getProperty(String key) { Object config = DynamicPropertyFactory.getBackingConfigurationSource(); return getProperty(config, key); } }
ConfigUtil { public static Object getProperty(String key) { Object config = DynamicPropertyFactory.getBackingConfigurationSource(); return getProperty(config, key); } private ConfigUtil(); }
ConfigUtil { public static Object getProperty(String key) { Object config = DynamicPropertyFactory.getBackingConfigurationSource(); return getProperty(config, key); } private ConfigUtil(); static void setConfigs(Map<String, Object> config); static void addConfig(String key, Object value); static Object getProperty(Str...
ConfigUtil { public static Object getProperty(String key) { Object config = DynamicPropertyFactory.getBackingConfigurationSource(); return getProperty(config, key); } private ConfigUtil(); static void setConfigs(Map<String, Object> config); static void addConfig(String key, Object value); static Object getProperty(Str...
@Test public void duplicateServiceCombConfigToCseListValue() { List<String> list = Arrays.asList("a", "b"); AbstractConfiguration config = new DynamicConfiguration(); config.addProperty("cse.list", list); Deencapsulation.invoke(ConfigUtil.class, "duplicateCseConfigToServicecomb", config); Object result = config.getProp...
public static Object getProperty(String key) { Object config = DynamicPropertyFactory.getBackingConfigurationSource(); return getProperty(config, key); }
ConfigUtil { public static Object getProperty(String key) { Object config = DynamicPropertyFactory.getBackingConfigurationSource(); return getProperty(config, key); } }
ConfigUtil { public static Object getProperty(String key) { Object config = DynamicPropertyFactory.getBackingConfigurationSource(); return getProperty(config, key); } private ConfigUtil(); }
ConfigUtil { public static Object getProperty(String key) { Object config = DynamicPropertyFactory.getBackingConfigurationSource(); return getProperty(config, key); } private ConfigUtil(); static void setConfigs(Map<String, Object> config); static void addConfig(String key, Object value); static Object getProperty(Str...
ConfigUtil { public static Object getProperty(String key) { Object config = DynamicPropertyFactory.getBackingConfigurationSource(); return getProperty(config, key); } private ConfigUtil(); static void setConfigs(Map<String, Object> config); static void addConfig(String key, Object value); static Object getProperty(Str...
@Test public void getAggregatedSchema() { String microserviceId = "msId"; String schemaId = "schemaId"; new MockUp<RestClientUtil>() { @Mock void httpDo(RequestContext requestContext, Handler<RestResponse> responseHandler) { Holder<GetSchemaResponse> holder = Deencapsulation.getField(responseHandler, "arg$4"); holder.v...
@Override public String getAggregatedSchema(String microserviceId, String schemaId) { return doGetSchema(microserviceId, schemaId, true); }
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public String getAggregatedSchema(String microserviceId, String schemaId) { return doGetSchema(microserviceId, schemaId, true); } }
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public String getAggregatedSchema(String microserviceId, String schemaId) { return doGetSchema(microserviceId, schemaId, true); } ServiceRegistryClientImpl(ServiceRegistryConfig serviceRegistryConfig); }
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public String getAggregatedSchema(String microserviceId, String schemaId) { return doGetSchema(microserviceId, schemaId, true); } ServiceRegistryClientImpl(ServiceRegistryConfig serviceRegistryConfig); @Override void init(); @Override List<Microserv...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public String getAggregatedSchema(String microserviceId, String schemaId) { return doGetSchema(microserviceId, schemaId, true); } ServiceRegistryClientImpl(ServiceRegistryConfig serviceRegistryConfig); @Override void init(); @Override List<Microserv...
@Test public void testConvertEnvVariable() { String someProperty = "cse_service_registry_address"; AbstractConfiguration config = new DynamicConfiguration(); config.addProperty(someProperty, "testing"); AbstractConfiguration result = ConfigUtil.convertEnvVariable(config); assertThat(result.getString("cse.service.regist...
public static AbstractConfiguration convertEnvVariable(AbstractConfiguration source) { Iterator<String> keys = source.getKeys(); while (keys.hasNext()) { String key = keys.next(); String[] separatedKey = key.split(CONFIG_KEY_SPLITER); if (separatedKey.length == 1) { continue; } String newKey = String.join(".", separate...
ConfigUtil { public static AbstractConfiguration convertEnvVariable(AbstractConfiguration source) { Iterator<String> keys = source.getKeys(); while (keys.hasNext()) { String key = keys.next(); String[] separatedKey = key.split(CONFIG_KEY_SPLITER); if (separatedKey.length == 1) { continue; } String newKey = String.join(...
ConfigUtil { public static AbstractConfiguration convertEnvVariable(AbstractConfiguration source) { Iterator<String> keys = source.getKeys(); while (keys.hasNext()) { String key = keys.next(); String[] separatedKey = key.split(CONFIG_KEY_SPLITER); if (separatedKey.length == 1) { continue; } String newKey = String.join(...
ConfigUtil { public static AbstractConfiguration convertEnvVariable(AbstractConfiguration source) { Iterator<String> keys = source.getKeys(); while (keys.hasNext()) { String key = keys.next(); String[] separatedKey = key.split(CONFIG_KEY_SPLITER); if (separatedKey.length == 1) { continue; } String newKey = String.join(...
ConfigUtil { public static AbstractConfiguration convertEnvVariable(AbstractConfiguration source) { Iterator<String> keys = source.getKeys(); while (keys.hasNext()) { String key = keys.next(); String[] separatedKey = key.split(CONFIG_KEY_SPLITER); if (separatedKey.length == 1) { continue; } String newKey = String.join(...
@Test public void destroyConfigCenterConfigurationSource() { AtomicInteger count = new AtomicInteger(); ConfigCenterConfigurationSource source = new MockUp<ConfigCenterConfigurationSource>() { @Mock void destroy() { count.incrementAndGet(); } }.getMockInstance(); new Expectations(SPIServiceUtils.class) { { SPIServiceUt...
public static void destroyConfigCenterConfigurationSource() { SPIServiceUtils.getAllService(ConfigCenterConfigurationSource.class).forEach(source -> { try { source.destroy(); } catch (Throwable e) { LOGGER.error("Failed to destroy {}", source.getClass().getName()); } }); }
ConfigUtil { public static void destroyConfigCenterConfigurationSource() { SPIServiceUtils.getAllService(ConfigCenterConfigurationSource.class).forEach(source -> { try { source.destroy(); } catch (Throwable e) { LOGGER.error("Failed to destroy {}", source.getClass().getName()); } }); } }
ConfigUtil { public static void destroyConfigCenterConfigurationSource() { SPIServiceUtils.getAllService(ConfigCenterConfigurationSource.class).forEach(source -> { try { source.destroy(); } catch (Throwable e) { LOGGER.error("Failed to destroy {}", source.getClass().getName()); } }); } private ConfigUtil(); }
ConfigUtil { public static void destroyConfigCenterConfigurationSource() { SPIServiceUtils.getAllService(ConfigCenterConfigurationSource.class).forEach(source -> { try { source.destroy(); } catch (Throwable e) { LOGGER.error("Failed to destroy {}", source.getClass().getName()); } }); } private ConfigUtil(); static voi...
ConfigUtil { public static void destroyConfigCenterConfigurationSource() { SPIServiceUtils.getAllService(ConfigCenterConfigurationSource.class).forEach(source -> { try { source.destroy(); } catch (Throwable e) { LOGGER.error("Failed to destroy {}", source.getClass().getName()); } }); } private ConfigUtil(); static voi...
@Test public void loadFromSPI(@Mocked DiscoveryFilter f1, @Mocked DiscoveryFilter f2) { Class<? extends DiscoveryFilter> cls = DiscoveryFilter.class; new Expectations(SPIServiceUtils.class) { { SPIServiceUtils.getSortedService(cls); result = Arrays.asList(f1, f2); } }; discoveryTree.loadFromSPI(cls); Assert.assertThat(...
public void loadFromSPI(Class<? extends DiscoveryFilter> cls) { filters.addAll(SPIServiceUtils.getSortedService(cls)); }
DiscoveryTree { public void loadFromSPI(Class<? extends DiscoveryFilter> cls) { filters.addAll(SPIServiceUtils.getSortedService(cls)); } }
DiscoveryTree { public void loadFromSPI(Class<? extends DiscoveryFilter> cls) { filters.addAll(SPIServiceUtils.getSortedService(cls)); } }
DiscoveryTree { public void loadFromSPI(Class<? extends DiscoveryFilter> cls) { filters.addAll(SPIServiceUtils.getSortedService(cls)); } void loadFromSPI(Class<? extends DiscoveryFilter> cls); void addFilter(DiscoveryFilter filter); void sort(); DiscoveryTreeNode discovery(DiscoveryContext context, String appId, Strin...
DiscoveryTree { public void loadFromSPI(Class<? extends DiscoveryFilter> cls) { filters.addAll(SPIServiceUtils.getSortedService(cls)); } void loadFromSPI(Class<? extends DiscoveryFilter> cls); void addFilter(DiscoveryFilter filter); void sort(); DiscoveryTreeNode discovery(DiscoveryContext context, String appId, Strin...
@Test public void sort(@Mocked DiscoveryFilter f1, @Mocked DiscoveryFilter f2, @Mocked DiscoveryFilter f3) { new Expectations() { { f1.getOrder(); result = -1; f1.enabled(); result = true; f2.getOrder(); result = 0; f2.enabled(); result = true; f3.getOrder(); result = 0; f3.enabled(); result = false; } }; discoveryTree...
public void sort() { filters.sort(Comparator.comparingInt(DiscoveryFilter::getOrder)); Iterator<DiscoveryFilter> iterator = filters.iterator(); while (iterator.hasNext()) { DiscoveryFilter filter = iterator.next(); if (!filter.enabled()) { iterator.remove(); } LOGGER.info("DiscoveryFilter {}, enabled {}.", filter.getCl...
DiscoveryTree { public void sort() { filters.sort(Comparator.comparingInt(DiscoveryFilter::getOrder)); Iterator<DiscoveryFilter> iterator = filters.iterator(); while (iterator.hasNext()) { DiscoveryFilter filter = iterator.next(); if (!filter.enabled()) { iterator.remove(); } LOGGER.info("DiscoveryFilter {}, enabled {}...
DiscoveryTree { public void sort() { filters.sort(Comparator.comparingInt(DiscoveryFilter::getOrder)); Iterator<DiscoveryFilter> iterator = filters.iterator(); while (iterator.hasNext()) { DiscoveryFilter filter = iterator.next(); if (!filter.enabled()) { iterator.remove(); } LOGGER.info("DiscoveryFilter {}, enabled {}...
DiscoveryTree { public void sort() { filters.sort(Comparator.comparingInt(DiscoveryFilter::getOrder)); Iterator<DiscoveryFilter> iterator = filters.iterator(); while (iterator.hasNext()) { DiscoveryFilter filter = iterator.next(); if (!filter.enabled()) { iterator.remove(); } LOGGER.info("DiscoveryFilter {}, enabled {}...
DiscoveryTree { public void sort() { filters.sort(Comparator.comparingInt(DiscoveryFilter::getOrder)); Iterator<DiscoveryFilter> iterator = filters.iterator(); while (iterator.hasNext()) { DiscoveryFilter filter = iterator.next(); if (!filter.enabled()) { iterator.remove(); } LOGGER.info("DiscoveryFilter {}, enabled {}...
@Test public void isMatch_existingNull() { Assert.assertFalse(discoveryTree.isMatch(null, null)); }
protected boolean isMatch(VersionedCache existing, VersionedCache inputCache) { return existing != null && existing.isSameVersion(inputCache); }
DiscoveryTree { protected boolean isMatch(VersionedCache existing, VersionedCache inputCache) { return existing != null && existing.isSameVersion(inputCache); } }
DiscoveryTree { protected boolean isMatch(VersionedCache existing, VersionedCache inputCache) { return existing != null && existing.isSameVersion(inputCache); } }
DiscoveryTree { protected boolean isMatch(VersionedCache existing, VersionedCache inputCache) { return existing != null && existing.isSameVersion(inputCache); } void loadFromSPI(Class<? extends DiscoveryFilter> cls); void addFilter(DiscoveryFilter filter); void sort(); DiscoveryTreeNode discovery(DiscoveryContext cont...
DiscoveryTree { protected boolean isMatch(VersionedCache existing, VersionedCache inputCache) { return existing != null && existing.isSameVersion(inputCache); } void loadFromSPI(Class<? extends DiscoveryFilter> cls); void addFilter(DiscoveryFilter filter); void sort(); DiscoveryTreeNode discovery(DiscoveryContext cont...
@Test public void isMatch_yes() { parent.cacheVersion(1); Assert.assertTrue(discoveryTree.isMatch(new DiscoveryTreeNode().cacheVersion(1), parent)); }
protected boolean isMatch(VersionedCache existing, VersionedCache inputCache) { return existing != null && existing.isSameVersion(inputCache); }
DiscoveryTree { protected boolean isMatch(VersionedCache existing, VersionedCache inputCache) { return existing != null && existing.isSameVersion(inputCache); } }
DiscoveryTree { protected boolean isMatch(VersionedCache existing, VersionedCache inputCache) { return existing != null && existing.isSameVersion(inputCache); } }
DiscoveryTree { protected boolean isMatch(VersionedCache existing, VersionedCache inputCache) { return existing != null && existing.isSameVersion(inputCache); } void loadFromSPI(Class<? extends DiscoveryFilter> cls); void addFilter(DiscoveryFilter filter); void sort(); DiscoveryTreeNode discovery(DiscoveryContext cont...
DiscoveryTree { protected boolean isMatch(VersionedCache existing, VersionedCache inputCache) { return existing != null && existing.isSameVersion(inputCache); } void loadFromSPI(Class<? extends DiscoveryFilter> cls); void addFilter(DiscoveryFilter filter); void sort(); DiscoveryTreeNode discovery(DiscoveryContext cont...
@Test public void isMatch_no() { parent.cacheVersion(0); Assert.assertFalse(discoveryTree.isExpired(new DiscoveryTreeNode().cacheVersion(1), parent)); }
protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); }
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } }
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } }
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } void loadFromSPI(Class<? extends DiscoveryFilter> cls); void addFilter(DiscoveryFilter filter); void sort(); DiscoveryTreeNode discovery(DiscoveryContext contex...
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } void loadFromSPI(Class<? extends DiscoveryFilter> cls); void addFilter(DiscoveryFilter filter); void sort(); DiscoveryTreeNode discovery(DiscoveryContext contex...
@Test public void isExpired_existingNull() { Assert.assertTrue(discoveryTree.isExpired(null, null)); }
protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); }
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } }
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } }
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } void loadFromSPI(Class<? extends DiscoveryFilter> cls); void addFilter(DiscoveryFilter filter); void sort(); DiscoveryTreeNode discovery(DiscoveryContext contex...
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } void loadFromSPI(Class<? extends DiscoveryFilter> cls); void addFilter(DiscoveryFilter filter); void sort(); DiscoveryTreeNode discovery(DiscoveryContext contex...
@Test public void isExpired_yes() { parent.cacheVersion(1); Assert.assertTrue(discoveryTree.isExpired(new DiscoveryTreeNode().cacheVersion(0), parent)); }
protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); }
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } }
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } }
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } void loadFromSPI(Class<? extends DiscoveryFilter> cls); void addFilter(DiscoveryFilter filter); void sort(); DiscoveryTreeNode discovery(DiscoveryContext contex...
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } void loadFromSPI(Class<? extends DiscoveryFilter> cls); void addFilter(DiscoveryFilter filter); void sort(); DiscoveryTreeNode discovery(DiscoveryContext contex...
@Test public void isExpired_no() { parent.cacheVersion(0); Assert.assertFalse(discoveryTree.isExpired(new DiscoveryTreeNode().cacheVersion(0), parent)); }
protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); }
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } }
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } }
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } void loadFromSPI(Class<? extends DiscoveryFilter> cls); void addFilter(DiscoveryFilter filter); void sort(); DiscoveryTreeNode discovery(DiscoveryContext contex...
DiscoveryTree { protected boolean isExpired(VersionedCache existing, VersionedCache inputCache) { return existing == null || existing.isExpired(inputCache); } void loadFromSPI(Class<? extends DiscoveryFilter> cls); void addFilter(DiscoveryFilter filter); void sort(); DiscoveryTreeNode discovery(DiscoveryContext contex...
@Test public void getSchemas() { String microserviceId = "msId"; new MockUp<RestClientUtil>() { @Mock void httpDo(RequestContext requestContext, Handler<RestResponse> responseHandler) { Holder<GetSchemasResponse> holder = Deencapsulation.getField(responseHandler, "arg$4"); GetSchemasResponse schemasResp = Json.decodeVa...
@Override public Holder<List<GetSchemaResponse>> getSchemas(String microserviceId) { return getSchemas(microserviceId, false, false); }
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public Holder<List<GetSchemaResponse>> getSchemas(String microserviceId) { return getSchemas(microserviceId, false, false); } }
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public Holder<List<GetSchemaResponse>> getSchemas(String microserviceId) { return getSchemas(microserviceId, false, false); } ServiceRegistryClientImpl(ServiceRegistryConfig serviceRegistryConfig); }
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public Holder<List<GetSchemaResponse>> getSchemas(String microserviceId) { return getSchemas(microserviceId, false, false); } ServiceRegistryClientImpl(ServiceRegistryConfig serviceRegistryConfig); @Override void init(); @Override List<Microservice>...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public Holder<List<GetSchemaResponse>> getSchemas(String microserviceId) { return getSchemas(microserviceId, false, false); } ServiceRegistryClientImpl(ServiceRegistryConfig serviceRegistryConfig); @Override void init(); @Override List<Microservice>...
@Test public void easyDiscovery(@Mocked InstanceCacheManager instanceCacheManager) { new Expectations(DiscoveryManager.class) { { DiscoveryManager.INSTANCE.getInstanceCacheManager(); result = instanceCacheManager; instanceCacheManager.getOrCreateVersionedCache(anyString, anyString, anyString); result = parent; } }; res...
public DiscoveryTreeNode discovery(DiscoveryContext context, String appId, String microserviceName, String versionRule) { VersionedCache instanceVersionedCache = DiscoveryManager.INSTANCE .getInstanceCacheManager() .getOrCreateVersionedCache(appId, microserviceName, versionRule); return discovery(context, instanceVersi...
DiscoveryTree { public DiscoveryTreeNode discovery(DiscoveryContext context, String appId, String microserviceName, String versionRule) { VersionedCache instanceVersionedCache = DiscoveryManager.INSTANCE .getInstanceCacheManager() .getOrCreateVersionedCache(appId, microserviceName, versionRule); return discovery(contex...
DiscoveryTree { public DiscoveryTreeNode discovery(DiscoveryContext context, String appId, String microserviceName, String versionRule) { VersionedCache instanceVersionedCache = DiscoveryManager.INSTANCE .getInstanceCacheManager() .getOrCreateVersionedCache(appId, microserviceName, versionRule); return discovery(contex...
DiscoveryTree { public DiscoveryTreeNode discovery(DiscoveryContext context, String appId, String microserviceName, String versionRule) { VersionedCache instanceVersionedCache = DiscoveryManager.INSTANCE .getInstanceCacheManager() .getOrCreateVersionedCache(appId, microserviceName, versionRule); return discovery(contex...
DiscoveryTree { public DiscoveryTreeNode discovery(DiscoveryContext context, String appId, String microserviceName, String versionRule) { VersionedCache instanceVersionedCache = DiscoveryManager.INSTANCE .getInstanceCacheManager() .getOrCreateVersionedCache(appId, microserviceName, versionRule); return discovery(contex...
@Test public void avoidConcurrentProblem() { Deencapsulation.setField(discoveryTree, "root", parent.cacheVersion(1)); Assert.assertTrue(parent.children().isEmpty()); discoveryTree.discovery(context, new VersionedCache().cacheVersion(0).name("input")); Assert.assertTrue(parent.children().isEmpty()); }
public DiscoveryTreeNode discovery(DiscoveryContext context, String appId, String microserviceName, String versionRule) { VersionedCache instanceVersionedCache = DiscoveryManager.INSTANCE .getInstanceCacheManager() .getOrCreateVersionedCache(appId, microserviceName, versionRule); return discovery(context, instanceVersi...
DiscoveryTree { public DiscoveryTreeNode discovery(DiscoveryContext context, String appId, String microserviceName, String versionRule) { VersionedCache instanceVersionedCache = DiscoveryManager.INSTANCE .getInstanceCacheManager() .getOrCreateVersionedCache(appId, microserviceName, versionRule); return discovery(contex...
DiscoveryTree { public DiscoveryTreeNode discovery(DiscoveryContext context, String appId, String microserviceName, String versionRule) { VersionedCache instanceVersionedCache = DiscoveryManager.INSTANCE .getInstanceCacheManager() .getOrCreateVersionedCache(appId, microserviceName, versionRule); return discovery(contex...
DiscoveryTree { public DiscoveryTreeNode discovery(DiscoveryContext context, String appId, String microserviceName, String versionRule) { VersionedCache instanceVersionedCache = DiscoveryManager.INSTANCE .getInstanceCacheManager() .getOrCreateVersionedCache(appId, microserviceName, versionRule); return discovery(contex...
DiscoveryTree { public DiscoveryTreeNode discovery(DiscoveryContext context, String appId, String microserviceName, String versionRule) { VersionedCache instanceVersionedCache = DiscoveryManager.INSTANCE .getInstanceCacheManager() .getOrCreateVersionedCache(appId, microserviceName, versionRule); return discovery(contex...
@Test public void getOrCreateRoot_match() { Deencapsulation.setField(discoveryTree, "root", parent); DiscoveryTreeNode root = discoveryTree.getOrCreateRoot(parent); Assert.assertSame(parent, root); }
protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; } if (root.isSame...
DiscoveryTree { protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; }...
DiscoveryTree { protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; }...
DiscoveryTree { protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; }...
DiscoveryTree { protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; }...
@Test public void getOrCreateRoot_expired() { Deencapsulation.setField(discoveryTree, "root", parent); VersionedCache inputCache = new VersionedCache().cacheVersion(parent.cacheVersion() + 1); DiscoveryTreeNode root = discoveryTree.getOrCreateRoot(inputCache); Assert.assertEquals(inputCache.cacheVersion(), root.cacheVe...
protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; } if (root.isSame...
DiscoveryTree { protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; }...
DiscoveryTree { protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; }...
DiscoveryTree { protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; }...
DiscoveryTree { protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; }...
@Test public void getOrCreateRoot_tempRoot() { Deencapsulation.setField(discoveryTree, "root", parent); VersionedCache inputCache = new VersionedCache().cacheVersion(parent.cacheVersion() - 1); DiscoveryTreeNode root = discoveryTree.getOrCreateRoot(inputCache); Assert.assertEquals(inputCache.cacheVersion(), root.cacheV...
protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; } if (root.isSame...
DiscoveryTree { protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; }...
DiscoveryTree { protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; }...
DiscoveryTree { protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; }...
DiscoveryTree { protected DiscoveryTreeNode getOrCreateRoot(VersionedCache inputCache) { DiscoveryTreeNode tmpRoot = root; if (isMatch(tmpRoot, inputCache)) { return tmpRoot; } synchronized (lock) { if (isExpired(root, inputCache)) { root = new DiscoveryTreeNode().cacheVersion(inputCache.cacheVersion()); return root; }...
@Test public void childrenInited() { Assert.assertFalse(node.childrenInited()); node.childrenInited(true); Assert.assertTrue(node.childrenInited()); }
public boolean childrenInited() { return childrenInited; }
DiscoveryTreeNode extends VersionedCache { public boolean childrenInited() { return childrenInited; } }
DiscoveryTreeNode extends VersionedCache { public boolean childrenInited() { return childrenInited; } }
DiscoveryTreeNode extends VersionedCache { public boolean childrenInited() { return childrenInited; } boolean childrenInited(); DiscoveryTreeNode childrenInited(boolean childrenInited); int level(); DiscoveryTreeNode level(int level); @SuppressWarnings("unchecked") T attribute(String key); DiscoveryTreeNode attribute(...
DiscoveryTreeNode extends VersionedCache { public boolean childrenInited() { return childrenInited; } boolean childrenInited(); DiscoveryTreeNode childrenInited(boolean childrenInited); int level(); DiscoveryTreeNode level(int level); @SuppressWarnings("unchecked") T attribute(String key); DiscoveryTreeNode attribute(...
@Test public void level() { node.level(1); Assert.assertEquals(1, node.level()); }
public int level() { return level; }
DiscoveryTreeNode extends VersionedCache { public int level() { return level; } }
DiscoveryTreeNode extends VersionedCache { public int level() { return level; } }
DiscoveryTreeNode extends VersionedCache { public int level() { return level; } boolean childrenInited(); DiscoveryTreeNode childrenInited(boolean childrenInited); int level(); DiscoveryTreeNode level(int level); @SuppressWarnings("unchecked") T attribute(String key); DiscoveryTreeNode attribute(String key, Object val...
DiscoveryTreeNode extends VersionedCache { public int level() { return level; } boolean childrenInited(); DiscoveryTreeNode childrenInited(boolean childrenInited); int level(); DiscoveryTreeNode level(int level); @SuppressWarnings("unchecked") T attribute(String key); DiscoveryTreeNode attribute(String key, Object val...
@Test public void attribute() { node.attribute("k1", "v1"); Assert.assertEquals("v1", node.attribute("k1")); }
@SuppressWarnings("unchecked") public <T> T attribute(String key) { return (T) attributes.get(key); }
DiscoveryTreeNode extends VersionedCache { @SuppressWarnings("unchecked") public <T> T attribute(String key) { return (T) attributes.get(key); } }
DiscoveryTreeNode extends VersionedCache { @SuppressWarnings("unchecked") public <T> T attribute(String key) { return (T) attributes.get(key); } }
DiscoveryTreeNode extends VersionedCache { @SuppressWarnings("unchecked") public <T> T attribute(String key) { return (T) attributes.get(key); } boolean childrenInited(); DiscoveryTreeNode childrenInited(boolean childrenInited); int level(); DiscoveryTreeNode level(int level); @SuppressWarnings("unchecked") T attribut...
DiscoveryTreeNode extends VersionedCache { @SuppressWarnings("unchecked") public <T> T attribute(String key) { return (T) attributes.get(key); } boolean childrenInited(); DiscoveryTreeNode childrenInited(boolean childrenInited); int level(); DiscoveryTreeNode level(int level); @SuppressWarnings("unchecked") T attribut...
@Test public void children() { Map<String, DiscoveryTreeNode> children = new HashMap<>(); node.children(children); Assert.assertSame(children, node.children()); }
public Map<String, DiscoveryTreeNode> children() { return children; }
DiscoveryTreeNode extends VersionedCache { public Map<String, DiscoveryTreeNode> children() { return children; } }
DiscoveryTreeNode extends VersionedCache { public Map<String, DiscoveryTreeNode> children() { return children; } }
DiscoveryTreeNode extends VersionedCache { public Map<String, DiscoveryTreeNode> children() { return children; } boolean childrenInited(); DiscoveryTreeNode childrenInited(boolean childrenInited); int level(); DiscoveryTreeNode level(int level); @SuppressWarnings("unchecked") T attribute(String key); DiscoveryTreeNode...
DiscoveryTreeNode extends VersionedCache { public Map<String, DiscoveryTreeNode> children() { return children; } boolean childrenInited(); DiscoveryTreeNode childrenInited(boolean childrenInited); int level(); DiscoveryTreeNode level(int level); @SuppressWarnings("unchecked") T attribute(String key); DiscoveryTreeNode...
@Test public void child() { DiscoveryTreeNode child = new DiscoveryTreeNode().name("child"); node.child(child.name(), child); Assert.assertSame(child, node.child(child.name())); }
public DiscoveryTreeNode child(String childName) { return children.get(childName); }
DiscoveryTreeNode extends VersionedCache { public DiscoveryTreeNode child(String childName) { return children.get(childName); } }
DiscoveryTreeNode extends VersionedCache { public DiscoveryTreeNode child(String childName) { return children.get(childName); } }
DiscoveryTreeNode extends VersionedCache { public DiscoveryTreeNode child(String childName) { return children.get(childName); } boolean childrenInited(); DiscoveryTreeNode childrenInited(boolean childrenInited); int level(); DiscoveryTreeNode level(int level); @SuppressWarnings("unchecked") T attribute(String key); Di...
DiscoveryTreeNode extends VersionedCache { public DiscoveryTreeNode child(String childName) { return children.get(childName); } boolean childrenInited(); DiscoveryTreeNode childrenInited(boolean childrenInited); int level(); DiscoveryTreeNode level(int level); @SuppressWarnings("unchecked") T attribute(String key); Di...
@Test public void getSchemasForNew() { String microserviceId = "msId"; new MockUp<RestClientUtil>() { @Mock void httpDo(RequestContext requestContext, Handler<RestResponse> responseHandler) { Holder<GetSchemasResponse> holder = Deencapsulation.getField(responseHandler, "arg$4"); GetSchemasResponse schemasResp = Json.de...
@Override public Holder<List<GetSchemaResponse>> getSchemas(String microserviceId) { return getSchemas(microserviceId, false, false); }
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public Holder<List<GetSchemaResponse>> getSchemas(String microserviceId) { return getSchemas(microserviceId, false, false); } }
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public Holder<List<GetSchemaResponse>> getSchemas(String microserviceId) { return getSchemas(microserviceId, false, false); } ServiceRegistryClientImpl(ServiceRegistryConfig serviceRegistryConfig); }
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public Holder<List<GetSchemaResponse>> getSchemas(String microserviceId) { return getSchemas(microserviceId, false, false); } ServiceRegistryClientImpl(ServiceRegistryConfig serviceRegistryConfig); @Override void init(); @Override List<Microservice>...
ServiceRegistryClientImpl implements ServiceRegistryClient { @Override public Holder<List<GetSchemaResponse>> getSchemas(String microserviceId) { return getSchemas(microserviceId, false, false); } ServiceRegistryClientImpl(ServiceRegistryConfig serviceRegistryConfig); @Override void init(); @Override List<Microservice>...
@Test public void fromCache() { Object data = new Object(); VersionedCache other = new VersionedCache().cacheVersion(1).name("cache").data(data); node.fromCache(other); Assert.assertEquals(1, node.cacheVersion()); Assert.assertEquals("cache", node.name()); Assert.assertSame(data, node.data()); }
public DiscoveryTreeNode fromCache(VersionedCache other) { this.cacheVersion = other.cacheVersion(); this.name = other.name(); this.data(other.data()); return this; }
DiscoveryTreeNode extends VersionedCache { public DiscoveryTreeNode fromCache(VersionedCache other) { this.cacheVersion = other.cacheVersion(); this.name = other.name(); this.data(other.data()); return this; } }
DiscoveryTreeNode extends VersionedCache { public DiscoveryTreeNode fromCache(VersionedCache other) { this.cacheVersion = other.cacheVersion(); this.name = other.name(); this.data(other.data()); return this; } }
DiscoveryTreeNode extends VersionedCache { public DiscoveryTreeNode fromCache(VersionedCache other) { this.cacheVersion = other.cacheVersion(); this.name = other.name(); this.data(other.data()); return this; } boolean childrenInited(); DiscoveryTreeNode childrenInited(boolean childrenInited); int level(); DiscoveryTre...
DiscoveryTreeNode extends VersionedCache { public DiscoveryTreeNode fromCache(VersionedCache other) { this.cacheVersion = other.cacheVersion(); this.name = other.name(); this.data(other.data()); return this; } boolean childrenInited(); DiscoveryTreeNode childrenInited(boolean childrenInited); int level(); DiscoveryTre...