http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java ---------------------------------------------------------------------- diff --git a/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java b/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java deleted file mode 100644 index 8e28370..0000000 --- a/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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.polygene.library.metrics; - -import org.apache.polygene.api.common.Optional; -import org.apache.polygene.api.composite.TransientComposite; -import org.apache.polygene.api.mixin.Mixins; -import org.apache.polygene.api.property.Property; -import org.apache.polygene.bootstrap.Assembler; -import org.apache.polygene.bootstrap.Assemblers; -import org.apache.polygene.bootstrap.AssemblyException; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; -import org.apache.polygene.test.metrics.MetricValuesProvider; -import org.junit.Test; - -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - -abstract class AbstractTimingCaptureTest extends AbstractPolygeneTest -{ - - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.layer().application().setName( "SomeApplication" ); - module.transients( Country1.class ); - module.transients( Country2.class ).withConcerns( TimingCaptureAllConcern.class ); - module.transients( Country3.class ).withConcerns( TimingCaptureConcern.class ); - metricsAssembler().assemble( module ); - } - - protected abstract Assemblers.Visible<? extends Assembler> metricsAssembler(); - - protected abstract MetricValuesProvider metricValuesProvider(); - - @Test - public void givenNonInstrumentedCompositeExpectNoTimers() - { - Country underTest = transientBuilderFactory.newTransient( Country1.class ); - updateName( underTest, 10 ); - assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.name" ), is( 0L ) ); - assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.updateName" ), is( 0L ) ); - } - - @Test - public void givenInstrumentedWithAllCompositeWhenCallingUpdateNameExpectTimers() - { - Country underTest = transientBuilderFactory.newTransient( Country2.class ); - updateName( underTest, 10 ); - assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.name" ), is( 10L ) ); - assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.updateName" ), is( 10L ) ); - } - - @Test - public void givenOneMethodAnnotatedWhenCallingUpdateNameExpectTimerForThatMethodOnly() - { - Country underTest = transientBuilderFactory.newTransient( Country3.class ); - updateName( underTest, 10 ); - assertThat( metricValuesProvider().timerCount( "Layer 1.Module 1.AbstractTimingCaptureTest.Country.name" ), is( 0L ) ); - assertThat( metricValuesProvider().timerCount( "Country3.updateName" ), is( 10L ) ); - } - - private void updateName( Country underTest, int times ) - { - for( int i = 0; i < times; i++ ) - { - underTest.updateName( "Name" + i ); - } - } - - // START SNIPPET: complex-capture - public interface Country extends TransientComposite - { - @Optional - Property<String> name(); - - void updateName( String newName ); - } - - @Mixins( Country1Mixin.class ) - public interface Country1 extends Country - { - } - - public static abstract class Country1Mixin - implements Country1 - { - @Override - public void updateName( String newName ) - { - name().set( newName ); - } - } - - @Mixins( Country2Mixin.class ) - public interface Country2 extends Country - { - } - - public static abstract class Country2Mixin - implements Country2 - { - @Override - public void updateName( String newName ) - { - name().set( newName ); - } - } - - @Mixins( Country3Mixin.class ) - public interface Country3 extends Country - { - @TimingCapture( "Country3.updateName" ) - @Override - void updateName(String newName); - } - - public static abstract class Country3Mixin - implements Country3 - { - @Override - public void updateName( String newName ) - { - name().set( newName ); - } - } - // END SNIPPET: complex-capture -}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/CodahaleTimingCaptureTest.java ---------------------------------------------------------------------- diff --git a/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/CodahaleTimingCaptureTest.java b/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/CodahaleTimingCaptureTest.java deleted file mode 100644 index 9fcd003..0000000 --- a/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/CodahaleTimingCaptureTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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.polygene.library.metrics; - -import com.codahale.metrics.MetricRegistry; -import org.apache.polygene.bootstrap.Assembler; -import org.apache.polygene.bootstrap.Assemblers; -import org.apache.polygene.metrics.codahale.CodahaleMetricsAssembler; -import org.apache.polygene.metrics.codahale.CodahaleMetricsProvider; -import org.apache.polygene.test.metrics.MetricValuesProvider; - -import java.util.Collection; - -public class CodahaleTimingCaptureTest extends AbstractTimingCaptureTest -{ - @Override - protected Assemblers.Visible<? extends Assembler> metricsAssembler() - { - return new CodahaleMetricsAssembler(); - } - - @Override - protected MetricValuesProvider metricValuesProvider() - { - CodahaleMetricsProvider metricsProvider = serviceFinder.findService( CodahaleMetricsProvider.class ).get(); - MetricRegistry metricRegistry = metricsProvider.metricRegistry(); - return new MetricValuesProvider() - { - @Override - public Collection<String> registeredMetricNames() - { - return metricRegistry.getNames(); - } - - @Override - public long timerCount( String timerName ) - { - return metricRegistry.timer( application.name() + '.' + timerName ).getCount(); - } - }; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/DocumentationSupport.java ---------------------------------------------------------------------- diff --git a/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/DocumentationSupport.java b/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/DocumentationSupport.java deleted file mode 100644 index 0297906..0000000 --- a/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/DocumentationSupport.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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.polygene.library.metrics; - - -import java.util.List; -import org.apache.polygene.bootstrap.Assembler; -import org.apache.polygene.bootstrap.AssemblyException; -import org.apache.polygene.bootstrap.ModuleAssembly; - -public class DocumentationSupport -{ -// START SNIPPET: capture - public interface Router - { - @TimingCapture - List<Coordinate> route( String source, String destination ); - } - - public class RouterAlgorithm1 - implements Router - { - @Override - public List<Coordinate> route( String source, String destination ) - { -// END SNIPPET: capture - return null; -// START SNIPPET: capture - } - } - - public class RouterAlgorithm2 - implements Router - { - @Override - public List<Coordinate> route( String source, String destination ) - { -// END SNIPPET: capture - return null; -// START SNIPPET: capture - } - -// END SNIPPET: capture - public class MyAssembler implements Assembler - { -// START SNIPPET: capture - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.addServices( Router.class ).identifiedBy( "router1" ).withMixins( RouterAlgorithm1.class ); - module.addServices( Router.class ).identifiedBy( "router2" ).withMixins( RouterAlgorithm2.class ); -// END SNIPPET: capture -// START SNIPPET: capture - } - } - } -// END SNIPPET: capture - - public class Coordinate - { - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/manual/src/docs/userguide/libraries.txt ---------------------------------------------------------------------- diff --git a/manual/src/docs/userguide/libraries.txt b/manual/src/docs/userguide/libraries.txt index 737c1a1..585ab3f 100644 --- a/manual/src/docs/userguide/libraries.txt +++ b/manual/src/docs/userguide/libraries.txt @@ -75,10 +75,6 @@ include::../../../../libraries/logging/src/docs/logging.txt[] :leveloffset: 2 -include::../../../../libraries/metrics/src/docs/metrics.txt[] - -:leveloffset: 2 - include::../../../../libraries/osgi/src/docs/osgi.txt[] :leveloffset: 2 http://git-wip-us.apache.org/repos/asf/polygene-java/blob/5b90154d/settings.gradle ---------------------------------------------------------------------- diff --git a/settings.gradle b/settings.gradle index 67ec7c4..a982fbb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -36,7 +36,6 @@ include 'core:api', 'libraries:jmx', 'libraries:locking', 'libraries:logging', - 'libraries:metrics', 'libraries:osgi', 'libraries:rdf', 'libraries:rest',
