@Test public void testValidData() throws Exception { Operation op = new Operation(); op.type(GemFireDefenitions.TYPE_REMOTE.getType()); String host = "localhost"; int port = 12345; op.put(GemFireDefenitions.FIELD_HOST, host); op.put(GemFireDefenitions.FIELD_PORT, 12345); Frame frame = new SimpleFrame(FrameId.valueOf("0"), null, op, TimeRange.milliTimeRange(0, 1), Collections.<Frame>emptyList()); Trace trace = new Trace(ServerName.valueOf("fake-server"), ApplicationName.valueOf("fake-app"), new Date(), TraceId.valueOf("fake-id"), frame); Collection<ExternalResourceDescriptor> res = analyzer.locateExternalResourceName(trace); assertEquals("Mismatched number of results", 1, res.size()); ExternalResourceDescriptor externalResourceDescriptor = res.iterator().next(); assertEquals("Gemfire source frame", frame, externalResourceDescriptor.getFrame()); assertEquals("Gemfire external resource host", host, externalResourceDescriptor.getHost()); assertEquals("Gemfire external resource port", port, externalResourceDescriptor.getPort()); assertEquals("Gemfire external resource type", ExternalResourceType.KVSTORE.name(), externalResourceDescriptor.getType()); assertEquals("Gemfire external resource type", ExternalResourceType.KVSTORE.name(), externalResourceDescriptor.getType()); assertEquals("Gemfire external resource name", AbstractGemFireExternalResourceAnalyzer.createName(host, port), externalResourceDescriptor.getName()); assertEquals("Gemfire external resource vendor", GemFireDefenitions.GEMFIRE, externalResourceDescriptor.getVendor()); assertEquals("Gemfire external resource label", AbstractGemFireExternalResourceAnalyzer.createLabel(host, port), externalResourceDescriptor.getLabel()); assertEquals("Gemfire external incoming", Boolean.FALSE, Boolean.valueOf(externalResourceDescriptor.isIncoming())); }
@Override protected int getPort(Operation op) { Number portObj = op.get(GemFireDefenitions.FIELD_PORT, Number.class); int port = portObj != null ? portObj.intValue() : EMPTY_PORT; return port; }
GemFireRemoteExternalResourceAnalyzer extends AbstractGemFireExternalResourceAnalyzer { @Override protected int getPort(Operation op) { Number portObj = op.get(GemFireDefenitions.FIELD_PORT, Number.class); int port = portObj != null ? portObj.intValue() : EMPTY_PORT; return port; } }
GemFireRemoteExternalResourceAnalyzer extends AbstractGemFireExternalResourceAnalyzer { @Override protected int getPort(Operation op) { Number portObj = op.get(GemFireDefenitions.FIELD_PORT, Number.class); int port = portObj != null ? portObj.intValue() : EMPTY_PORT; return port; } private  GemFireRemoteExternalResourceAnalyzer(); }
GemFireRemoteExternalResourceAnalyzer extends AbstractGemFireExternalResourceAnalyzer { @Override protected int getPort(Operation op) { Number portObj = op.get(GemFireDefenitions.FIELD_PORT, Number.class); int port = portObj != null ? portObj.intValue() : EMPTY_PORT; return port; } private  GemFireRemoteExternalResourceAnalyzer(); static final GemFireRemoteExternalResourceAnalyzer getInstance(); }
GemFireRemoteExternalResourceAnalyzer extends AbstractGemFireExternalResourceAnalyzer { @Override protected int getPort(Operation op) { Number portObj = op.get(GemFireDefenitions.FIELD_PORT, Number.class); int port = portObj != null ? portObj.intValue() : EMPTY_PORT; return port; } private  GemFireRemoteExternalResourceAnalyzer(); static final GemFireRemoteExternalResourceAnalyzer getInstance();  }