forked from apache/camel-quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Micrometer: Router policy should be disabled by default (to be consi…
…stent with Camel) apache#5028
- Loading branch information
1 parent
93057f1
commit 1386d42
Showing
6 changed files
with
93 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...camel/quarkus/component/micrometer/deployment/MicrometerMetricsConfigRoutePolicyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* 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.camel.quarkus.component.micrometer.deployment; | ||
|
||
import java.io.IOException; | ||
import java.io.StringWriter; | ||
import java.io.Writer; | ||
import java.util.List; | ||
import java.util.Properties; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import jakarta.inject.Inject; | ||
import org.apache.camel.CamelContext; | ||
import org.apache.camel.component.micrometer.routepolicy.MicrometerRoutePolicyFactory; | ||
import org.apache.camel.spi.RoutePolicyFactory; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.Asset; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class MicrometerMetricsConfigRoutePolicyTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest CONFIG = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addAsResource(applicationProperties(), "application.properties")); | ||
|
||
@Inject | ||
CamelContext context; | ||
|
||
@Test | ||
public void testRouteConfigEnabledConfiguration() { | ||
List<RoutePolicyFactory> routePolicyFactories = context.getRoutePolicyFactories(); | ||
assertEquals(1, routePolicyFactories.size()); | ||
assertTrue(routePolicyFactories.get(0) instanceof MicrometerRoutePolicyFactory); | ||
} | ||
|
||
public static final Asset applicationProperties() { | ||
Writer writer = new StringWriter(); | ||
|
||
Properties props = new Properties(); | ||
props.setProperty("quarkus.camel.metrics.enable-route-policy", "true"); | ||
|
||
try { | ||
props.store(writer, ""); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
return new StringAsset(writer.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters