Permalink
Browse files

test revert

  • Loading branch information...
1 parent e462c45 commit 416df5d2492b95ed946e1400e2c86c29f555ad3d @talya talya committed Feb 19, 2012
Showing with 26 additions and 446 deletions.
  1. +0 −70 ...lugins/mongodb/src/main/java/com/springsource/insight/plugin/mongodb/AbstractMongoDBAnalyzer.java
  2. +0 −37 ...ongodb/src/main/java/com/springsource/insight/plugin/mongodb/AbstractMongoDBMetricsGenerator.java
  3. +3 −9 ...src/main/java/com/springsource/insight/plugin/mongodb/MongoCollectionOperationCollectionAspect.aj
  4. +0 −30 ...odb/src/main/java/com/springsource/insight/plugin/mongodb/MongoDBCollectionOperationAnalyzer.java
  5. +0 −26 ...main/java/com/springsource/insight/plugin/mongodb/MongoDBCollectionOperationMetricsGenerator.java
  6. +0 −30 ...ugins/mongodb/src/main/java/com/springsource/insight/plugin/mongodb/MongoDBOperationAnalyzer.java
  7. +0 −26 ...ngodb/src/main/java/com/springsource/insight/plugin/mongodb/MongoDBOperationMetricsGenerator.java
  8. +9 −15 ...mongodb/src/main/java/com/springsource/insight/plugin/mongodb/MongoDbOperationCollectionAspect.aj
  9. +0 −6 collection-plugins/mongodb/src/main/resources/META-INF/insight-plugin-mongodb.xml
  10. +0 −131 ...ns/mongodb/src/test/java/com/springsource/insight/plugin/mongodb/AbstractMongoDBAnalyzerTest.java
  11. +1 −1 ...st/java/com/springsource/insight/plugin/mongodb/MongoCollectionOperationCollectionAspectTest.java
  12. +0 −32 ...src/test/java/com/springsource/insight/plugin/mongodb/MongoDBCollectionOperationAnalyzerTest.java
  13. +0 −32 ...s/mongodb/src/test/java/com/springsource/insight/plugin/mongodb/MongoDBOperationAnalyzerTest.java
  14. +12 −0 ...b/src/test/java/com/springsource/insight/plugin/mongodb/MongoDbOperationCollectionAspectTest.java
  15. +1 −1 ...ction-plugins/mongodb/src/test/java/com/springsource/insight/plugin/mongodb/OperationFTLTest.java
@@ -1,70 +0,0 @@
-/**
- * Copyright 2009-2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.springsource.insight.plugin.mongodb;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.springsource.insight.intercept.operation.Operation;
-import com.springsource.insight.intercept.operation.OperationType;
-import com.springsource.insight.intercept.topology.ExternalResourceAnalyzer;
-import com.springsource.insight.intercept.topology.ExternalResourceDescriptor;
-import com.springsource.insight.intercept.topology.ExternalResourceType;
-import com.springsource.insight.intercept.topology.MD5NameGenerator;
-import com.springsource.insight.intercept.trace.Frame;
-import com.springsource.insight.intercept.trace.Trace;
-
-/**
- *
- */
-public abstract class AbstractMongoDBAnalyzer implements ExternalResourceAnalyzer {
-
- private OperationType operationType;
-
- AbstractMongoDBAnalyzer(OperationType operationType) {
- super();
- this.operationType = operationType;
- }
-
- public List<ExternalResourceDescriptor> locateExternalResourceName(Trace trace) {
- List<Frame> dbFrames = trace.getLastFramesOfType(operationType);
-
- List<ExternalResourceDescriptor> dbDescriptors = new ArrayList<ExternalResourceDescriptor>();
-
- for (Frame dbFrame : dbFrames) {
- Operation op = dbFrame.getOperation();
- String host = op.get("host", String.class);
- Integer portProperty = op.get("port", Integer.class);
- int port = portProperty == null ? -1 : portProperty;
-
- String dbName = op.get("dbName", String.class);
-
- String mongoHash = MD5NameGenerator.getName(dbName+host+port);
-
- dbDescriptors.add(new ExternalResourceDescriptor(dbFrame,
- "mongo:" + mongoHash,
- dbName,
- ExternalResourceType.DATABASE.name(),
- "MongoDB",
- host,
- port) );
- }
-
- return dbDescriptors;
- }
-
-}
@@ -1,37 +0,0 @@
-/**
- * Copyright 2009-2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.springsource.insight.plugin.mongodb;
-
-import java.util.List;
-
-import com.springsource.insight.intercept.metrics.AbstractMetricsGenerator;
-import com.springsource.insight.intercept.operation.OperationType;
-import com.springsource.insight.intercept.trace.Frame;
-import com.springsource.insight.intercept.trace.Trace;
-
-public abstract class AbstractMongoDBMetricsGenerator extends AbstractMetricsGenerator {
-
- AbstractMongoDBMetricsGenerator(OperationType operationType) {
- super(operationType);
- }
-
-
- @Override
- protected List<Frame> getExternalFramesForMetricGeneration(Trace trace) {
- return trace.getLastFramesOfType(opType);
- }
-}
@@ -28,8 +28,9 @@ import com.springsource.insight.intercept.operation.Operation;
public aspect MongoCollectionOperationCollectionAspect extends
AbstractOperationCollectionAspect {
+ public static final OperationType TYPE = OperationType.valueOf("mongo_collection_operation");
- public pointcut insertExecute():
+ public pointcut insertExecute():
execution(WriteResult DBCollection.insert(DBObject[], WriteConcern));
public pointcut updateExecute():
@@ -81,20 +82,13 @@ public aspect MongoCollectionOperationCollectionAspect extends
final DBCollection collection = (DBCollection) joinPoint.getThis();
Operation op = new Operation()
.label("MongoDB: " + collection + "." + signature.getName())
- .type(MongoDBCollectionOperationAnalyzer.TYPE)
+ .type(TYPE)
.put("collection", collection.getFullName());
OperationList opList = op.createList("args");
List<String> args = MongoArgumentUtils.toString(joinPoint.getArgs());
for (String arg : args) {
opList.add(arg);
}
-
- DB db = collection.getDB();
- try {
- op.put("dbName", db.getName());
- op.put("host", db.getMongo().getAddress().getHost());
- op.put("port", db.getMongo().getAddress().getPort());
- } catch (Exception e) {}
return op;
}
@@ -1,30 +0,0 @@
-/**
- * Copyright 2009-2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.springsource.insight.plugin.mongodb;
-
-import com.springsource.insight.intercept.operation.OperationType;
-
-
-public class MongoDBCollectionOperationAnalyzer extends AbstractMongoDBAnalyzer {
-
- public static final OperationType TYPE = OperationType.valueOf("mongo_collection_operation");
-
- MongoDBCollectionOperationAnalyzer() {
- super(TYPE);
- }
-
-}
@@ -1,26 +0,0 @@
-/**
- * Copyright 2009-2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.springsource.insight.plugin.mongodb;
-
-
-public class MongoDBCollectionOperationMetricsGenerator extends AbstractMongoDBMetricsGenerator {
-
- MongoDBCollectionOperationMetricsGenerator() {
- super(MongoDBCollectionOperationAnalyzer.TYPE);
- }
-
-}
@@ -1,30 +0,0 @@
-/**
- * Copyright 2009-2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.springsource.insight.plugin.mongodb;
-
-import com.springsource.insight.intercept.operation.OperationType;
-
-
-public class MongoDBOperationAnalyzer extends AbstractMongoDBAnalyzer {
-
- public static final OperationType TYPE = OperationType.valueOf("mongo_db_operation");
-
- MongoDBOperationAnalyzer() {
- super(TYPE);
- }
-
-}
@@ -1,26 +0,0 @@
-/**
- * Copyright 2009-2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.springsource.insight.plugin.mongodb;
-
-
-public class MongoDBOperationMetricsGenerator extends AbstractMongoDBMetricsGenerator {
-
- MongoDBOperationMetricsGenerator() {
- super(MongoDBOperationAnalyzer.TYPE);
- }
-
-}
@@ -16,38 +16,32 @@
package com.springsource.insight.plugin.mongodb;
-import java.util.List;
-
+import com.springsource.insight.intercept.operation.OperationList;
+import com.springsource.insight.intercept.operation.OperationType;
import org.aspectj.lang.JoinPoint;
import com.mongodb.CommandResult;
import com.mongodb.DB;
import com.springsource.insight.collection.AbstractOperationCollectionAspect;
import com.springsource.insight.intercept.operation.Operation;
-import com.springsource.insight.intercept.operation.OperationList;
-import com.springsource.insight.intercept.operation.OperationType;
+
+import java.util.List;
public aspect MongoDbOperationCollectionAspect extends AbstractOperationCollectionAspect {
+ public static final OperationType TYPE = OperationType.valueOf("mongo_db_operation");
+
public pointcut collectionPoint(): execution(CommandResult DB.command(..));
@Override
- protected Operation createOperation(final JoinPoint jp) {
- Operation op = new Operation().label("MongoDB: DB." + jp.getSignature().getName() + "()").type(MongoDBOperationAnalyzer.TYPE);
+ protected Operation createOperation(final JoinPoint joinPoint) {
+ Operation op = new Operation().label("MongoDB: DB." + joinPoint.getSignature().getName() + "()").type(TYPE);
OperationList opList = op.createList("args");
- List<String> args = MongoArgumentUtils.toString(jp.getArgs());
+ List<String> args = MongoArgumentUtils.toString(joinPoint.getArgs());
for (String arg : args) {
opList.add(arg);
}
-
- DB db = (DB) jp.getTarget();
- try {
- op.put("dbName", db.getName());
- op.put("host", db.getMongo().getAddress().getHost());
- op.put("port", db.getMongo().getAddress().getPort());
- } catch (Exception e) {}
-
return op;
}
}
@@ -21,10 +21,4 @@
template="com/springsource/insight/plugin/mongodb/mongo_db_operation.ftl" />
<insight:operation-group operation="mongo_db_operation"
group="MongoDB" />
-
- <bean class="com.springsource.insight.plugin.mongodb.MongoDBCollectionOperationAnalyzer" />
- <bean class="com.springsource.insight.plugin.mongodb.MongoDBOperationAnalyzer" />
-
- <bean class="com.springsource.insight.plugin.mongodb.MongoDBCollectionOperationMetricsGenerator" />
- <bean class="com.springsource.insight.plugin.mongodb.MongoDBOperationMetricsGenerator" />
</beans>
Oops, something went wrong.

0 comments on commit 416df5d

Please sign in to comment.