You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sirona.apache.org by rm...@apache.org on 2013/11/25 15:41:12 UTC

svn commit: r1545303 - /incubator/sirona/trunk/agent/javaagent/src/test/java/org/apache/test/sirona/javaagent/AgentPerfInterceptorAgentContractTest.java

Author: rmannibucau
Date: Mon Nov 25 14:41:12 2013
New Revision: 1545303

URL: http://svn.apache.org/r1545303
Log:
adding a unit test to test Agent interceptor contract

Added:
    incubator/sirona/trunk/agent/javaagent/src/test/java/org/apache/test/sirona/javaagent/AgentPerfInterceptorAgentContractTest.java

Added: incubator/sirona/trunk/agent/javaagent/src/test/java/org/apache/test/sirona/javaagent/AgentPerfInterceptorAgentContractTest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/javaagent/src/test/java/org/apache/test/sirona/javaagent/AgentPerfInterceptorAgentContractTest.java?rev=1545303&view=auto
==============================================================================
--- incubator/sirona/trunk/agent/javaagent/src/test/java/org/apache/test/sirona/javaagent/AgentPerfInterceptorAgentContractTest.java (added)
+++ incubator/sirona/trunk/agent/javaagent/src/test/java/org/apache/test/sirona/javaagent/AgentPerfInterceptorAgentContractTest.java Mon Nov 25 14:41:12 2013
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.test.sirona.javaagent;
+
+import org.apache.sirona.Role;
+import org.apache.sirona.counters.Counter;
+import org.apache.sirona.javaagent.AgentPerformanceInterceptor;
+import org.apache.sirona.repositories.Repository;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class AgentPerfInterceptorAgentContractTest {
+    @Test
+    public void key() {
+        final Counter.Key key = AgentPerformanceInterceptor.key("key");
+        assertEquals(Role.PERFORMANCES, key.getRole());
+        assertEquals("key", key.getName());
+    }
+
+    @Test
+    public void start() {
+        final Counter.Key key = AgentPerformanceInterceptor.key("start");
+        AgentPerformanceInterceptor.start(key).stop();
+        assertEquals(1, Repository.INSTANCE.getCounter(key).getHits());
+    }
+}