Search in sources :

Example 1 with PriorityPropertyView

use of org.apache.servicecomb.inspector.internal.model.PriorityPropertyView in project java-chassis by ServiceComb.

the class InspectorImpl method createPriorityPropertyView.

private PriorityPropertyView createPriorityPropertyView(PriorityProperty<?> priorityProperty) {
    PriorityPropertyView view = new PriorityPropertyView();
    view.setDynamicProperties(new ArrayList<>());
    for (DynamicProperty property : priorityProperty.getProperties()) {
        view.getDynamicProperties().add(createDynamicPropertyView(property));
    }
    view.setDefaultValue(String.valueOf(priorityProperty.getDefaultValue()));
    view.setValue(String.valueOf(priorityProperty.getValue()));
    return view;
}
Also used : DynamicProperty(com.netflix.config.DynamicProperty) PriorityPropertyView(org.apache.servicecomb.inspector.internal.model.PriorityPropertyView)

Example 2 with PriorityPropertyView

use of org.apache.servicecomb.inspector.internal.model.PriorityPropertyView in project java-chassis by ServiceComb.

the class TestInspectorImpl method priorityProperties.

@Test
public void priorityProperties() {
    PriorityPropertyFactory propertyFactory = new PriorityPropertyFactory();
    inspector.setPropertyFactory(propertyFactory);
    propertyFactory.getOrCreate(int.class, 0, 0, "high", "low");
    List<PriorityPropertyView> views = inspector.priorityProperties();
    Assert.assertEquals(1, views.size());
    Assert.assertThat(views.get(0).getDynamicProperties().stream().map(DynamicPropertyView::getKey).collect(Collectors.toList()), Matchers.contains("high", "low"));
}
Also used : PriorityPropertyFactory(org.apache.servicecomb.config.priority.PriorityPropertyFactory) DynamicPropertyView(org.apache.servicecomb.inspector.internal.model.DynamicPropertyView) PriorityPropertyView(org.apache.servicecomb.inspector.internal.model.PriorityPropertyView) Test(org.junit.Test)

Aggregations

PriorityPropertyView (org.apache.servicecomb.inspector.internal.model.PriorityPropertyView)2 DynamicProperty (com.netflix.config.DynamicProperty)1 PriorityPropertyFactory (org.apache.servicecomb.config.priority.PriorityPropertyFactory)1 DynamicPropertyView (org.apache.servicecomb.inspector.internal.model.DynamicPropertyView)1 Test (org.junit.Test)1