Search in sources :

Example 56 with Supplier

use of java.util.function.Supplier in project pravega by pravega.

the class LogMetadataTests method testLedgerOperations.

/**
 * Tests addLedger(), truncate(), getLedger().
 */
@Test(timeout = 5000)
public void testLedgerOperations() {
    Supplier<Long> nextLedgerId = new AtomicLong()::incrementAndGet;
    LogMetadata metadata = null;
    long expectedEpoch = 0;
    val expectedLedgerIds = new ArrayList<Long>();
    for (int i = 0; i < LEDGER_COUNT; i++) {
        expectedEpoch++;
        long ledgerId = nextLedgerId.get() * 2;
        expectedLedgerIds.add(ledgerId);
        if (metadata == null) {
            metadata = new LogMetadata(ledgerId).withUpdateVersion(i);
        } else {
            metadata.withUpdateVersion(i);
            metadata = metadata.addLedger(ledgerId);
        }
        Assert.assertEquals("Unexpected epoch.", expectedEpoch, metadata.getEpoch());
        Assert.assertEquals("Unexpected update version.", i, metadata.getUpdateVersion());
        checkLedgerIds(expectedLedgerIds, metadata);
    }
    // Verify that sequence numbers are assigned incrementally.
    for (int i = 1; i < metadata.getLedgers().size(); i++) {
        Assert.assertEquals("Sequence is not incremented.", metadata.getLedgers().get(i - 1).getSequence() + 1, metadata.getLedgers().get(i).getSequence());
    }
    // Test the getLedger method.
    long maxLedgerId = expectedLedgerIds.get(expectedLedgerIds.size() - 1);
    for (long ledgerId = 0; ledgerId < maxLedgerId; ledgerId++) {
        val lm = metadata.getLedger(ledgerId);
        if (expectedLedgerIds.contains(ledgerId)) {
            Assert.assertNotNull("Existing LedgerMetadata was not found.", lm);
            Assert.assertEquals("Unexpected ledger id returned.", ledgerId, lm.getLedgerId());
        } else {
            Assert.assertNull("A LedgerMetadata that did not exist was returned.", lm);
        }
    }
    // Test truncate.
    val truncatedLedgerIds = new ArrayList<Long>();
    for (long ledgerId : expectedLedgerIds) {
        val truncatedMetadata = metadata.truncate(new LedgerAddress(0, ledgerId, 123));
        // Verify truncated metadata only contains those ledger ids that haven't been truncated out.
        val expectedRemainingLedgerIds = expectedLedgerIds.stream().filter(o -> !truncatedLedgerIds.contains(o)).collect(Collectors.toList());
        checkLedgerIds(expectedRemainingLedgerIds, truncatedMetadata);
        // Verify original metadata contains all ledger ids.
        checkLedgerIds(expectedLedgerIds, metadata);
        // Only add this after we did all checks, since the currently truncated ledger is still active.
        truncatedLedgerIds.add(ledgerId);
    }
    // Test markEmptyLedgers.
    val lacs = expectedLedgerIds.stream().filter(i -> i % 3 > 0).collect(Collectors.toMap(i -> i, i -> i % 3 == 1 ? Ledgers.NO_ENTRY_ID : 1000));
    val m = metadata.updateLedgerStatus(lacs);
    for (long ledgerId : expectedLedgerIds) {
        Assert.assertEquals("markEmptyLedgers modified base metadata", LedgerMetadata.Status.Unknown, metadata.getLedger(ledgerId).getStatus());
        long lac = lacs.getOrDefault(ledgerId, Long.MIN_VALUE);
        LedgerMetadata.Status expectedStatus = lac == Long.MIN_VALUE ? LedgerMetadata.Status.Unknown : (lac == -1 ? LedgerMetadata.Status.Empty : LedgerMetadata.Status.NotEmpty);
        Assert.assertEquals("markEmptyLedgers did not return an updated metadata.", expectedStatus, m.getLedger(ledgerId).getStatus());
    }
    // Test removeEmptyLedgers.
    final int skipCount = 3;
    val m2 = m.removeEmptyLedgers(skipCount);
    checkLedgerIds(expectedLedgerIds, m);
    expectedLedgerIds.clear();
    // We rebuild expectedLedgerIds based on the previous metadata. We filter out the Empty Ledgers and add the ones
    // we were asked for from the end.
    m.getLedgers().stream().filter(lm -> lm.getStatus() != LedgerMetadata.Status.Empty).map(LedgerMetadata::getLedgerId).forEach(expectedLedgerIds::add);
    for (int i = m.getLedgers().size() - skipCount; i < m.getLedgers().size(); i++) {
        long ledgerId = m.getLedgers().get(i).getLedgerId();
        if (!expectedLedgerIds.contains(ledgerId)) {
            expectedLedgerIds.add(ledgerId);
        }
    }
    // The expected list may not be sorted; do it now.
    expectedLedgerIds.sort(Long::compare);
    checkLedgerIds(expectedLedgerIds, m2);
}
Also used : lombok.val(lombok.val) AtomicLong(java.util.concurrent.atomic.AtomicLong) List(java.util.List) AssertExtensions(io.pravega.test.common.AssertExtensions) lombok.val(lombok.val) HashMap(java.util.HashMap) Test(org.junit.Test) Assert(org.junit.Assert) Supplier(java.util.function.Supplier) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) AtomicLong(java.util.concurrent.atomic.AtomicLong) AtomicLong(java.util.concurrent.atomic.AtomicLong) Test(org.junit.Test)

Example 57 with Supplier

use of java.util.function.Supplier in project riposte by Nike-Inc.

the class ParserTest method test_match7_works.

@Test
public void test_match7_works() throws ParserFailure {
    final Pattern numberPattern = Pattern.compile("([0-9])");
    final Pattern booleanPattern = Pattern.compile("(true|false)");
    final Supplier<Parser<Integer>> number = () -> regex(numberPattern).map(m -> new Integer(m.group(1)));
    final Supplier<Parser<Boolean>> bool = () -> regex(booleanPattern).map(m -> new Boolean(m.group(1)));
    Parser<String> parser = number.get().thenParse(string("A")).thenParse(bool).thenParse(number).thenParse(string("B")).thenParse(bool).thenParse(number).map(match((first, second, third, fourth, fifth, sixth, seventh) -> {
        return first.toString() + "+" + second.toString() + "+" + third.toString() + "+" + fourth.toString() + "+" + fifth.toString() + "+" + sixth.toString() + "+" + seventh.toString();
    }));
    Optional<String> oResult = parser.tryParse("1Atrue2Bfalse3");
    assertThat(oResult.isPresent()).isTrue();
    assertThat(oResult.get()).isNotNull();
    assertThat(oResult.get()).isEqualTo("1+A+true+2+B+false+3");
}
Also used : Parsers.string(com.nike.riposte.util.text.parsercombinator.Parser.Parsers.string) Parsers.then(com.nike.riposte.util.text.parsercombinator.Parser.Parsers.then) Parsers.skip(com.nike.riposte.util.text.parsercombinator.Parser.Parsers.skip) ParserFailure(com.nike.riposte.util.text.parsercombinator.Parser.ParserFailure) Parsers.begin(com.nike.riposte.util.text.parsercombinator.Parser.Parsers.begin) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) MatchResult(java.util.regex.MatchResult) Parsers.regex(com.nike.riposte.util.text.parsercombinator.Parser.Parsers.regex) Test(org.junit.Test) Supplier(java.util.function.Supplier) Parsers.zeroOrMore(com.nike.riposte.util.text.parsercombinator.Parser.Parsers.zeroOrMore) List(java.util.List) ParserInput(com.nike.riposte.util.text.parsercombinator.Parser.ParserInput) Apply.test(com.nike.riposte.util.text.parsercombinator.Parser.Apply.test) Optional(java.util.Optional) Assertions.catchThrowable(org.assertj.core.api.Assertions.catchThrowable) Pattern(java.util.regex.Pattern) Pair(com.nike.internal.util.Pair) Apply.match(com.nike.riposte.util.text.parsercombinator.Parser.Apply.match) Parsers.oneOrMore(com.nike.riposte.util.text.parsercombinator.Parser.Parsers.oneOrMore) Pattern(java.util.regex.Pattern) Test(org.junit.Test)

Example 58 with Supplier

use of java.util.function.Supplier in project opennms by OpenNMS.

the class WSManCollectorTest method canCollectFromMultipleRecordsUsingFilter.

@Test
public void canCollectFromMultipleRecordsUsingFilter() {
    Group group = new Group();
    group.setName("DCIM_NumericSensor");
    Attrib attr = new Attrib();
    attr.setName("CurrentReading");
    attr.setAlias("sysBoardInletTemp");
    attr.setFilter("#ElementName == 'System Board Inlet Temp'");
    attr.setType(AttributeType.GAUGE);
    group.addAttrib(attr);
    attr = new Attrib();
    attr.setName("CurrentReading");
    attr.setAlias("sysBoardExhaustTemp");
    attr.setFilter("#ElementName == 'System Board Exhaust Temp'");
    attr.setType(AttributeType.GAUGE);
    group.addAttrib(attr);
    CollectionAgent agent = mock(CollectionAgent.class);
    when(agent.getStorageResourcePath()).thenReturn(ResourcePath.get());
    CollectionSetBuilder builder = new CollectionSetBuilder(agent);
    Supplier<Resource> resourceSupplier = () -> mock(NodeLevelResource.class);
    XMLTag xmlTag = XMLDoc.newDocument(true).addRoot("body").addTag("DCIM_NumericSensor").addTag("CurrentReading").setText("260").addTag("ElementName").setText("System Board Inlet Temp").gotoRoot().addTag("DCIM_NumericSensor").addTag("CurrentReading").setText("370").addTag("ElementName").setText("System Board Exhaust Temp");
    List<Node> nodes = xmlTag.gotoRoot().getChildElement().stream().map(el -> (Node) el).collect(Collectors.toList());
    WsManCollector.processEnumerationResults(group, builder, resourceSupplier, nodes);
    // Verify
    Map<String, CollectionAttribute> attributesByName = CollectionSetUtils.getAttributesByName(builder.build());
    assertEquals(Double.valueOf(260), attributesByName.get("sysBoardInletTemp").getNumericValue());
    assertEquals(Double.valueOf(370), attributesByName.get("sysBoardExhaustTemp").getNumericValue());
}
Also used : StorageStrategy(org.opennms.netmgt.config.datacollection.StorageStrategy) CollectionAgent(org.opennms.netmgt.collection.api.CollectionAgent) WSManDataCollectionConfigDao(org.opennms.netmgt.dao.WSManDataCollectionConfigDao) Arrays(java.util.Arrays) CollectionStatus(org.opennms.netmgt.collection.api.CollectionStatus) ResourceType(org.opennms.netmgt.config.datacollection.ResourceType) WSManConfigDao(org.opennms.netmgt.dao.WSManConfigDao) Supplier(java.util.function.Supplier) CollectionSetBuilder(org.opennms.netmgt.collection.support.builder.CollectionSetBuilder) XMLDoc(com.mycila.xmltool.XMLDoc) SiblingColumnStorageStrategy(org.opennms.netmgt.dao.support.SiblingColumnStorageStrategy) CollectionException(org.opennms.netmgt.collection.api.CollectionException) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) Node(org.w3c.dom.Node) AttributeType(org.opennms.netmgt.collection.api.AttributeType) GenericTypeResource(org.opennms.netmgt.collection.support.builder.GenericTypeResource) Collection(org.opennms.netmgt.config.wsman.Collection) Attrib(org.opennms.netmgt.config.wsman.Attrib) OnmsNode(org.opennms.netmgt.model.OnmsNode) Resource(org.opennms.netmgt.collection.support.builder.Resource) NodeDao(org.opennms.netmgt.dao.api.NodeDao) InetAddressUtils(org.opennms.core.utils.InetAddressUtils) CollectionAttribute(org.opennms.netmgt.collection.api.CollectionAttribute) WSManClientFactory(org.opennms.core.wsman.WSManClientFactory) XMLTag(com.mycila.xmltool.XMLTag) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) Group(org.opennms.netmgt.config.wsman.Group) Collectors(java.util.stream.Collectors) Maps(com.google.common.collect.Maps) NodeLevelResource(org.opennms.netmgt.collection.support.builder.NodeLevelResource) Sets(com.google.common.collect.Sets) Definition(org.opennms.netmgt.config.wsman.Definition) Matchers.any(org.mockito.Matchers.any) PersistenceSelectorStrategy(org.opennms.netmgt.config.datacollection.PersistenceSelectorStrategy) CollectionInitializationException(org.opennms.netmgt.collection.api.CollectionInitializationException) List(java.util.List) PersistAllSelectorStrategy(org.opennms.netmgt.collection.support.PersistAllSelectorStrategy) Assert.assertFalse(org.junit.Assert.assertFalse) CollectionSetUtils(org.opennms.core.collection.test.CollectionSetUtils) ResourcePath(org.opennms.netmgt.model.ResourcePath) CollectionSet(org.opennms.netmgt.collection.api.CollectionSet) Parameter(org.opennms.netmgt.config.datacollection.Parameter) Assert.assertEquals(org.junit.Assert.assertEquals) Mockito.mock(org.mockito.Mockito.mock) Group(org.opennms.netmgt.config.wsman.Group) CollectionSetBuilder(org.opennms.netmgt.collection.support.builder.CollectionSetBuilder) Node(org.w3c.dom.Node) OnmsNode(org.opennms.netmgt.model.OnmsNode) GenericTypeResource(org.opennms.netmgt.collection.support.builder.GenericTypeResource) Resource(org.opennms.netmgt.collection.support.builder.Resource) NodeLevelResource(org.opennms.netmgt.collection.support.builder.NodeLevelResource) XMLTag(com.mycila.xmltool.XMLTag) Attrib(org.opennms.netmgt.config.wsman.Attrib) CollectionAttribute(org.opennms.netmgt.collection.api.CollectionAttribute) CollectionAgent(org.opennms.netmgt.collection.api.CollectionAgent) Test(org.junit.Test)

Example 59 with Supplier

use of java.util.function.Supplier in project opennms by OpenNMS.

the class WSManCollectorTest method canProcessEnumerationResults.

@Test
public void canProcessEnumerationResults() {
    Group group = new Group();
    group.setName("ComputerSystem");
    addAttribute(group, "PrimaryStatus", "GaugeWithValue", AttributeType.GAUGE);
    addAttribute(group, "!PrimaryStatus!", "GaugeWithoutValue", AttributeType.GAUGE);
    addAttribute(group, "ElementName", "StringWithValue", AttributeType.STRING);
    addAttribute(group, "!ElementName!", "StringWithoutValue", AttributeType.STRING);
    CollectionAgent agent = mock(CollectionAgent.class);
    when(agent.getStorageResourcePath()).thenReturn(ResourcePath.get());
    CollectionSetBuilder builder = new CollectionSetBuilder(agent);
    Supplier<Resource> resourceSupplier = () -> mock(NodeLevelResource.class);
    XMLTag xmlTag = XMLDoc.newDocument(true).addRoot("body").addTag("DCIM_ComputerSystem").addTag("ElementName").setText("Computer System").addTag("PrimaryStatus").setText("42.1").addTag("OtherIdentifyingInfo").setText("ANONYMIZED01").addTag("OtherIdentifyingInfo").setText("mainsystemchassis").addTag("OtherIdentifyingInfo").setText("ANONYMIZED02");
    List<Node> nodes = xmlTag.gotoRoot().getChildElement().stream().map(el -> (Node) el).collect(Collectors.toList());
    WsManCollector.processEnumerationResults(group, builder, resourceSupplier, nodes);
    // Verify
    Map<String, CollectionAttribute> attributesByName = CollectionSetUtils.getAttributesByName(builder.build());
    assertFalse("The CollectionSet should not contain attributes for missing values.", attributesByName.containsKey("GaugeWithoutValue"));
    assertFalse("The CollectionSet should not contain attributes for missing values.", attributesByName.containsKey("StringWithoutValue"));
    assertEquals(42.1, attributesByName.get("GaugeWithValue").getNumericValue().doubleValue(), 2);
    assertEquals("Computer System", attributesByName.get("StringWithValue").getStringValue());
}
Also used : StorageStrategy(org.opennms.netmgt.config.datacollection.StorageStrategy) CollectionAgent(org.opennms.netmgt.collection.api.CollectionAgent) WSManDataCollectionConfigDao(org.opennms.netmgt.dao.WSManDataCollectionConfigDao) Arrays(java.util.Arrays) CollectionStatus(org.opennms.netmgt.collection.api.CollectionStatus) ResourceType(org.opennms.netmgt.config.datacollection.ResourceType) WSManConfigDao(org.opennms.netmgt.dao.WSManConfigDao) Supplier(java.util.function.Supplier) CollectionSetBuilder(org.opennms.netmgt.collection.support.builder.CollectionSetBuilder) XMLDoc(com.mycila.xmltool.XMLDoc) SiblingColumnStorageStrategy(org.opennms.netmgt.dao.support.SiblingColumnStorageStrategy) CollectionException(org.opennms.netmgt.collection.api.CollectionException) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) Node(org.w3c.dom.Node) AttributeType(org.opennms.netmgt.collection.api.AttributeType) GenericTypeResource(org.opennms.netmgt.collection.support.builder.GenericTypeResource) Collection(org.opennms.netmgt.config.wsman.Collection) Attrib(org.opennms.netmgt.config.wsman.Attrib) OnmsNode(org.opennms.netmgt.model.OnmsNode) Resource(org.opennms.netmgt.collection.support.builder.Resource) NodeDao(org.opennms.netmgt.dao.api.NodeDao) InetAddressUtils(org.opennms.core.utils.InetAddressUtils) CollectionAttribute(org.opennms.netmgt.collection.api.CollectionAttribute) WSManClientFactory(org.opennms.core.wsman.WSManClientFactory) XMLTag(com.mycila.xmltool.XMLTag) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) Group(org.opennms.netmgt.config.wsman.Group) Collectors(java.util.stream.Collectors) Maps(com.google.common.collect.Maps) NodeLevelResource(org.opennms.netmgt.collection.support.builder.NodeLevelResource) Sets(com.google.common.collect.Sets) Definition(org.opennms.netmgt.config.wsman.Definition) Matchers.any(org.mockito.Matchers.any) PersistenceSelectorStrategy(org.opennms.netmgt.config.datacollection.PersistenceSelectorStrategy) CollectionInitializationException(org.opennms.netmgt.collection.api.CollectionInitializationException) List(java.util.List) PersistAllSelectorStrategy(org.opennms.netmgt.collection.support.PersistAllSelectorStrategy) Assert.assertFalse(org.junit.Assert.assertFalse) CollectionSetUtils(org.opennms.core.collection.test.CollectionSetUtils) ResourcePath(org.opennms.netmgt.model.ResourcePath) CollectionSet(org.opennms.netmgt.collection.api.CollectionSet) Parameter(org.opennms.netmgt.config.datacollection.Parameter) Assert.assertEquals(org.junit.Assert.assertEquals) Mockito.mock(org.mockito.Mockito.mock) Group(org.opennms.netmgt.config.wsman.Group) CollectionAttribute(org.opennms.netmgt.collection.api.CollectionAttribute) CollectionSetBuilder(org.opennms.netmgt.collection.support.builder.CollectionSetBuilder) Node(org.w3c.dom.Node) OnmsNode(org.opennms.netmgt.model.OnmsNode) GenericTypeResource(org.opennms.netmgt.collection.support.builder.GenericTypeResource) Resource(org.opennms.netmgt.collection.support.builder.Resource) NodeLevelResource(org.opennms.netmgt.collection.support.builder.NodeLevelResource) XMLTag(com.mycila.xmltool.XMLTag) CollectionAgent(org.opennms.netmgt.collection.api.CollectionAgent) Test(org.junit.Test)

Example 60 with Supplier

use of java.util.function.Supplier in project opennms by OpenNMS.

the class WSManCollectorTest method canCollectFromMultivaluedKeyUsingIndexOf.

@Test
public void canCollectFromMultivaluedKeyUsingIndexOf() {
    /* The iDrac provides the following keys in the DCIM_ComputerSystem entry:
         *  <n1:IdentifyingDescriptions>CIM:GUID</n1:IdentifyingDescriptions>
         *  <n1:IdentifyingDescriptions>CIM:Tag</n1:IdentifyingDescriptions>
         *  <n1:IdentifyingDescriptions>DCIM:ServiceTag</n1:IdentifyingDescriptions>
         *  <n1:OtherIdentifyingInfo>44454C4C-3700-104A-8052-C3C04BB25031</n1:OtherIdentifyingInfo>
         *  <n1:OtherIdentifyingInfo>mainsystemchassis</n1:OtherIdentifyingInfo>
         *  <n1:OtherIdentifyingInfo>C7BBBP1</n1:OtherIdentifyingInfo>
         *
         * We want to be able to collect the value of 'OtherIdentifyingInfo' at the same
         * index where 'IdentifyingDescriptions' has the value of 'DCIM:ServiceTag'.
         */
    Group group = new Group();
    group.setName("DCIM_ComputerSystem");
    Attrib attr = new Attrib();
    attr.setName("OtherIdentifyingInfo");
    attr.setAlias("ServiceTag");
    attr.setIndexOf("#IdentifyingDescriptions matches '.*ServiceTag'");
    attr.setType(AttributeType.STRING);
    group.addAttrib(attr);
    CollectionAgent agent = mock(CollectionAgent.class);
    when(agent.getStorageResourcePath()).thenReturn(ResourcePath.get());
    CollectionSetBuilder builder = new CollectionSetBuilder(agent);
    Supplier<Resource> resourceSupplier = () -> mock(NodeLevelResource.class);
    XMLTag xmlTag = XMLDoc.newDocument(true).addRoot("body").addTag("DCIM_ComputerSystem").addTag("IdentifyingDescriptions").setText("CIM:GUID").addTag("IdentifyingDescriptions").setText("DCIM:ServiceTag").addTag("IdentifyingDescriptions").setText("CIM:Tag").addTag("OtherIdentifyingInfo").setText("44454C4C-3700-104A-8052-C3C04BB25031").addTag("OtherIdentifyingInfo").setText("C7BBBP1").addTag("OtherIdentifyingInfo").setText("mainsystemchassis");
    List<Node> nodes = xmlTag.gotoRoot().getChildElement().stream().map(el -> (Node) el).collect(Collectors.toList());
    WsManCollector.processEnumerationResults(group, builder, resourceSupplier, nodes);
    // Verify
    Map<String, CollectionAttribute> attributesByName = CollectionSetUtils.getAttributesByName(builder.build());
    assertEquals("C7BBBP1", attributesByName.get("ServiceTag").getStringValue());
}
Also used : StorageStrategy(org.opennms.netmgt.config.datacollection.StorageStrategy) CollectionAgent(org.opennms.netmgt.collection.api.CollectionAgent) WSManDataCollectionConfigDao(org.opennms.netmgt.dao.WSManDataCollectionConfigDao) Arrays(java.util.Arrays) CollectionStatus(org.opennms.netmgt.collection.api.CollectionStatus) ResourceType(org.opennms.netmgt.config.datacollection.ResourceType) WSManConfigDao(org.opennms.netmgt.dao.WSManConfigDao) Supplier(java.util.function.Supplier) CollectionSetBuilder(org.opennms.netmgt.collection.support.builder.CollectionSetBuilder) XMLDoc(com.mycila.xmltool.XMLDoc) SiblingColumnStorageStrategy(org.opennms.netmgt.dao.support.SiblingColumnStorageStrategy) CollectionException(org.opennms.netmgt.collection.api.CollectionException) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) Node(org.w3c.dom.Node) AttributeType(org.opennms.netmgt.collection.api.AttributeType) GenericTypeResource(org.opennms.netmgt.collection.support.builder.GenericTypeResource) Collection(org.opennms.netmgt.config.wsman.Collection) Attrib(org.opennms.netmgt.config.wsman.Attrib) OnmsNode(org.opennms.netmgt.model.OnmsNode) Resource(org.opennms.netmgt.collection.support.builder.Resource) NodeDao(org.opennms.netmgt.dao.api.NodeDao) InetAddressUtils(org.opennms.core.utils.InetAddressUtils) CollectionAttribute(org.opennms.netmgt.collection.api.CollectionAttribute) WSManClientFactory(org.opennms.core.wsman.WSManClientFactory) XMLTag(com.mycila.xmltool.XMLTag) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) Group(org.opennms.netmgt.config.wsman.Group) Collectors(java.util.stream.Collectors) Maps(com.google.common.collect.Maps) NodeLevelResource(org.opennms.netmgt.collection.support.builder.NodeLevelResource) Sets(com.google.common.collect.Sets) Definition(org.opennms.netmgt.config.wsman.Definition) Matchers.any(org.mockito.Matchers.any) PersistenceSelectorStrategy(org.opennms.netmgt.config.datacollection.PersistenceSelectorStrategy) CollectionInitializationException(org.opennms.netmgt.collection.api.CollectionInitializationException) List(java.util.List) PersistAllSelectorStrategy(org.opennms.netmgt.collection.support.PersistAllSelectorStrategy) Assert.assertFalse(org.junit.Assert.assertFalse) CollectionSetUtils(org.opennms.core.collection.test.CollectionSetUtils) ResourcePath(org.opennms.netmgt.model.ResourcePath) CollectionSet(org.opennms.netmgt.collection.api.CollectionSet) Parameter(org.opennms.netmgt.config.datacollection.Parameter) Assert.assertEquals(org.junit.Assert.assertEquals) Mockito.mock(org.mockito.Mockito.mock) Group(org.opennms.netmgt.config.wsman.Group) CollectionSetBuilder(org.opennms.netmgt.collection.support.builder.CollectionSetBuilder) Node(org.w3c.dom.Node) OnmsNode(org.opennms.netmgt.model.OnmsNode) GenericTypeResource(org.opennms.netmgt.collection.support.builder.GenericTypeResource) Resource(org.opennms.netmgt.collection.support.builder.Resource) NodeLevelResource(org.opennms.netmgt.collection.support.builder.NodeLevelResource) XMLTag(com.mycila.xmltool.XMLTag) Attrib(org.opennms.netmgt.config.wsman.Attrib) CollectionAttribute(org.opennms.netmgt.collection.api.CollectionAttribute) CollectionAgent(org.opennms.netmgt.collection.api.CollectionAgent) Test(org.junit.Test)

Aggregations

Supplier (java.util.function.Supplier)104 Test (org.junit.Test)43 List (java.util.List)41 ArrayList (java.util.ArrayList)28 Map (java.util.Map)24 Collectors (java.util.stream.Collectors)23 HashMap (java.util.HashMap)21 Function (java.util.function.Function)20 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)19 IOException (java.io.IOException)17 Arrays (java.util.Arrays)16 TimeUnit (java.util.concurrent.TimeUnit)14 Consumer (java.util.function.Consumer)14 Assert (org.junit.Assert)14 Collections (java.util.Collections)13 CompletableFuture (java.util.concurrent.CompletableFuture)13 Rule (org.junit.Rule)13 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)12 Cleanup (lombok.Cleanup)12 Timeout (org.junit.rules.Timeout)11