Search in sources :

Example 1 with Label

use of io.mantisrx.common.Label in project mantis by Netflix.

the class LabelUtilsTest method testSomePairsPresent3.

@Test
public void testSomePairsPresent3() {
    String tagQuery = "";
    List<Label> expectedPairs = LabelUtils.generatePairs(tagQuery);
    List<Label> actualPairs = new ArrayList<>();
    actualPairs.add(new Label("k4", "v1"));
    actualPairs.add(new Label("k5", "v2"));
    assertFalse(LabelUtils.somePairsPresent(expectedPairs, actualPairs));
}
Also used : Label(io.mantisrx.common.Label) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 2 with Label

use of io.mantisrx.common.Label in project mantis by Netflix.

the class LabelUtilsTest method testSerDe.

@Test
public void testSerDe() {
    Label l = new Label("k1", "v1");
    ObjectMapper mapper = new ObjectMapper();
    try {
        System.out.println(mapper.writeValueAsString(l));
    } catch (JsonProcessingException e) {
        fail();
    }
}
Also used : Label(io.mantisrx.common.Label) JsonProcessingException(io.mantisrx.shaded.com.fasterxml.jackson.core.JsonProcessingException) ObjectMapper(io.mantisrx.shaded.com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 3 with Label

use of io.mantisrx.common.Label in project mantis by Netflix.

the class LabelUtilsTest method testAllPairsPresent.

@Test
public void testAllPairsPresent() {
    String tagQuery = "k1=v1,k2=v2,k3=v3";
    List<Label> expectedPairs = LabelUtils.generatePairs(tagQuery);
    List<Label> actualPairs = new ArrayList<>();
    actualPairs.add(new Label("k1", "v1"));
    actualPairs.add(new Label("k2", "v2"));
    actualPairs.add(new Label("k3", "v3"));
    assertTrue(LabelUtils.allPairsPresent(expectedPairs, actualPairs));
}
Also used : Label(io.mantisrx.common.Label) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 4 with Label

use of io.mantisrx.common.Label in project mantis by Netflix.

the class LabelUtilsTest method testGeneratePairPartialMalformed.

@Test
public void testGeneratePairPartialMalformed() {
    String tagQuery = "k1=,k2=v2";
    List<Label> pairs = LabelUtils.generatePairs(tagQuery);
    assertEquals(1, pairs.size());
    assertEquals(new Label("k2", "v2"), pairs.get(0));
}
Also used : Label(io.mantisrx.common.Label) Test(org.junit.Test)

Example 5 with Label

use of io.mantisrx.common.Label in project mantis by Netflix.

the class LabelUtilsTest method testSomePairsPresent2.

@Test
public void testSomePairsPresent2() {
    String tagQuery = "k1=v1,k2=v2,k3=v3";
    List<Label> expectedPairs = LabelUtils.generatePairs(tagQuery);
    List<Label> actualPairs = new ArrayList<>();
    actualPairs.add(new Label("k4", "v1"));
    actualPairs.add(new Label("k5", "v2"));
    assertFalse(LabelUtils.somePairsPresent(expectedPairs, actualPairs));
}
Also used : Label(io.mantisrx.common.Label) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

Label (io.mantisrx.common.Label)47 Test (org.junit.Test)43 ArrayList (java.util.ArrayList)30 JobDefinition (io.mantisrx.server.master.domain.JobDefinition)15 TestKit (akka.testkit.javadsl.TestKit)14 JobClusterDefinitionImpl (io.mantisrx.server.master.domain.JobClusterDefinitionImpl)13 InvalidJobException (io.mantisrx.runtime.command.InvalidJobException)11 GetJobClusterRequest (io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobClusterRequest)8 GetJobClusterResponse (io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobClusterResponse)8 Parameter (io.mantisrx.runtime.parameter.Parameter)8 ActorRef (akka.actor.ActorRef)7 JobClusterManagerProto (io.mantisrx.master.jobcluster.proto.JobClusterManagerProto)7 JobClusterProto (io.mantisrx.master.jobcluster.proto.JobClusterProto)7 MantisJobStore (io.mantisrx.server.master.persistence.MantisJobStore)7 MantisScheduler (io.mantisrx.server.master.scheduler.MantisScheduler)7 Matchers.anyString (org.mockito.Matchers.anyString)7 JobId (io.mantisrx.server.master.domain.JobId)6 SchedulingInfo (io.mantisrx.runtime.descriptor.SchedulingInfo)4 DisableJobClusterRequest (io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.DisableJobClusterRequest)3 JobSla (io.mantisrx.runtime.JobSla)3