@Test public void testLocateDatabaseURI() throws Exception { String jdbcUri = "jdbc:foobar: String toHash = "foobar" + "" + "" + "huh" + 8080; Operation op = createJdbcOperation(jdbcUri); Frame frame = createJdbcFrame(op); Trace trace = createJdbcTrace(frame); List<ExternalResourceDescriptor> descList = (List<ExternalResourceDescriptor>) dbAnalyzer.locateExternalResourceName(trace); assertEquals("Mismatched num of descriptors", 1, descList.size()); ExternalResourceDescriptor externalResourceDescriptor = descList.get(0); assertEquals("Mismatched extracted frame", frame, externalResourceDescriptor.getFrame()); assertEquals("Mismatched resource type", ExternalResourceType.DATABASE.name(), externalResourceDescriptor.getType()); assertEquals("Mismatched resource name", "foobar:1:" + MD5NameGenerator.getName(toHash), externalResourceDescriptor.getName()); assertEquals("Mismatched incoming value", Boolean.FALSE, Boolean.valueOf(externalResourceDescriptor.isIncoming())); }
public Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace, Collection<Frame> dbFrames) { if (ListUtil.size(dbFrames) <= 0) { return Collections.emptyList(); } List<ExternalResourceDescriptor> dbDescriptors = new ArrayList<ExternalResourceDescriptor>(dbFrames.size()); for (Frame dbFrame : dbFrames) { Operation op = dbFrame.getOperation(); String uri = op.get(OperationFields.CONNECTION_URL, String.class); if (StringUtil.isEmpty(uri)) { continue; } dbDescriptors.addAll(extractMeaningfulNames(dbFrame, uri)); } return dbDescriptors; }
DatabaseJDBCURIAnalyzer extends AbstractExternalResourceAnalyzer { public Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace, Collection<Frame> dbFrames) { if (ListUtil.size(dbFrames) <= 0) { return Collections.emptyList(); } List<ExternalResourceDescriptor> dbDescriptors = new ArrayList<ExternalResourceDescriptor>(dbFrames.size()); for (Frame dbFrame : dbFrames) { Operation op = dbFrame.getOperation(); String uri = op.get(OperationFields.CONNECTION_URL, String.class); if (StringUtil.isEmpty(uri)) { continue; } dbDescriptors.addAll(extractMeaningfulNames(dbFrame, uri)); } return dbDescriptors; } }
DatabaseJDBCURIAnalyzer extends AbstractExternalResourceAnalyzer { public Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace, Collection<Frame> dbFrames) { if (ListUtil.size(dbFrames) <= 0) { return Collections.emptyList(); } List<ExternalResourceDescriptor> dbDescriptors = new ArrayList<ExternalResourceDescriptor>(dbFrames.size()); for (Frame dbFrame : dbFrames) { Operation op = dbFrame.getOperation(); String uri = op.get(OperationFields.CONNECTION_URL, String.class); if (StringUtil.isEmpty(uri)) { continue; } dbDescriptors.addAll(extractMeaningfulNames(dbFrame, uri)); } return dbDescriptors; } protected  DatabaseJDBCURIAnalyzer(OperationType type); }
DatabaseJDBCURIAnalyzer extends AbstractExternalResourceAnalyzer { public Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace, Collection<Frame> dbFrames) { if (ListUtil.size(dbFrames) <= 0) { return Collections.emptyList(); } List<ExternalResourceDescriptor> dbDescriptors = new ArrayList<ExternalResourceDescriptor>(dbFrames.size()); for (Frame dbFrame : dbFrames) { Operation op = dbFrame.getOperation(); String uri = op.get(OperationFields.CONNECTION_URL, String.class); if (StringUtil.isEmpty(uri)) { continue; } dbDescriptors.addAll(extractMeaningfulNames(dbFrame, uri)); } return dbDescriptors; } protected  DatabaseJDBCURIAnalyzer(OperationType type); Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace, Collection<Frame> dbFrames); List<ExternalResourceDescriptor> extractMeaningfulNames(Frame frame, String connectionString); }
DatabaseJDBCURIAnalyzer extends AbstractExternalResourceAnalyzer { public Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace, Collection<Frame> dbFrames) { if (ListUtil.size(dbFrames) <= 0) { return Collections.emptyList(); } List<ExternalResourceDescriptor> dbDescriptors = new ArrayList<ExternalResourceDescriptor>(dbFrames.size()); for (Frame dbFrame : dbFrames) { Operation op = dbFrame.getOperation(); String uri = op.get(OperationFields.CONNECTION_URL, String.class); if (StringUtil.isEmpty(uri)) { continue; } dbDescriptors.addAll(extractMeaningfulNames(dbFrame, uri)); } return dbDescriptors; } protected  DatabaseJDBCURIAnalyzer(OperationType type); Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace, Collection<Frame> dbFrames); List<ExternalResourceDescriptor> extractMeaningfulNames(Frame frame, String connectionString);  }