Search in sources :

Example 76 with Container

use of org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.Container in project neo4j-ogm by neo4j.

the class HierarchyRelsTest method relationshipsToSubclassesShouldBeClearedAsWell.

// GH-806
@Test
public void relationshipsToSubclassesShouldBeClearedAsWell() {
    inheritanceImpl(s -> new Element(s), Container::setElement);
    inheritanceImpl(s -> new ConcreteElement(s), Container::setElement);
    inheritanceImpl(s -> new VeryConcreteElementA(s), Container::setElement);
    inheritanceImpl(s -> new EvenMoreConcreteElement(s), Container::setElement);
    inheritanceImpl(s -> new IElementImpl1(s), Container::setElement2);
    inheritanceImpl(s -> new IElementImpl1A(s), Container::setElement2);
}
Also used : Container(org.neo4j.ogm.domain.gh806.Container) EvenMoreConcreteElement(org.neo4j.ogm.domain.gh806.EvenMoreConcreteElement) Element(org.neo4j.ogm.domain.gh806.Element) ConcreteElement(org.neo4j.ogm.domain.gh806.ConcreteElement) VeryConcreteElementA(org.neo4j.ogm.domain.gh806.VeryConcreteElementA) IElementImpl1A(org.neo4j.ogm.domain.gh806.IElementImpl1A) IElementImpl1(org.neo4j.ogm.domain.gh806.IElementImpl1) EvenMoreConcreteElement(org.neo4j.ogm.domain.gh806.EvenMoreConcreteElement) ConcreteElement(org.neo4j.ogm.domain.gh806.ConcreteElement) EvenMoreConcreteElement(org.neo4j.ogm.domain.gh806.EvenMoreConcreteElement) Test(org.junit.Test)

Example 77 with Container

use of org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.Container in project neo4j-ogm by neo4j.

the class HierarchyRelsTest method inheritanceImpl.

<T> void inheritanceImpl(Function<String, T> portProvider, BiConsumer<Container, Set<T>> elementConsumer) {
    session.query("MATCH (n) DETACH DELETE n", Collections.emptyMap());
    session.clear();
    // Setup initial relationships in one tx
    Container card = new Container("container");
    T port1 = portProvider.apply("e1");
    T port2 = portProvider.apply("e2");
    elementConsumer.accept(card, new HashSet<>(Arrays.asList(port1, port2)));
    card.setElementsOfAnotherRelationship(Collections.singleton(new ConcreteElement("oe")));
    session.save(card);
    session.clear();
    // Verify state
    String verificationQuery = "match (c:Container) <- [:RELATES_TO|RELATES_TO_TOO|RELATES_TO_AS_WELL] - (p) " + "where any (label in labels(p) where label in $expectedLabels) return c.name as c, p.name as p";
    Set<String> expectedLabels = new HashSet<>(Arrays.asList(ConcreteElement.class.getSimpleName(), port1.getClass().getSimpleName()));
    Map<String, Object> parameters = Collections.singletonMap("expectedLabels", expectedLabels);
    Result r;
    r = session.query(verificationQuery, parameters);
    assertThat(r.queryResults()).hasSize(3);
    assertThat(r.queryResults()).extracting(m -> m.get("p")).containsExactlyInAnyOrder("e1", "e2", "oe");
    // Reload in cleared session for fresh tx
    card = session.load(Container.class, card.getId());
    T port3 = portProvider.apply("e3");
    // Replace associations
    elementConsumer.accept(card, new HashSet<>(Arrays.asList(port3)));
    session.save(card);
    session.clear();
    r = session.query(verificationQuery, parameters);
    assertThat(r.queryResults()).hasSize(2);
    assertThat(r.queryResults()).extracting(m -> m.get("p")).containsExactlyInAnyOrder("e3", "oe");
}
Also used : Comment(org.neo4j.ogm.domain.forum.activity.Comment) Arrays(java.util.Arrays) IElementImpl1(org.neo4j.ogm.domain.gh806.IElementImpl1) Date(java.util.Date) Type1(org.neo4j.ogm.domain.hierarchy.relations.Type1) Function(java.util.function.Function) Type2(org.neo4j.ogm.domain.hierarchy.relations.Type2) Type3(org.neo4j.ogm.domain.hierarchy.relations.Type3) HashSet(java.util.HashSet) Map(java.util.Map) After(org.junit.After) BiConsumer(java.util.function.BiConsumer) Assertions(org.assertj.core.api.Assertions) VeryConcreteElementA(org.neo4j.ogm.domain.gh806.VeryConcreteElementA) Transaction(org.neo4j.ogm.transaction.Transaction) StreamSupport(java.util.stream.StreamSupport) EvenMoreConcreteElement(org.neo4j.ogm.domain.gh806.EvenMoreConcreteElement) Result(org.neo4j.ogm.model.Result) Before(org.junit.Before) Session(org.neo4j.ogm.session.Session) Member(org.neo4j.ogm.domain.forum.Member) BaseEntity(org.neo4j.ogm.domain.hierarchy.relations.BaseEntity) Container(org.neo4j.ogm.domain.gh806.Container) Set(java.util.Set) IOException(java.io.IOException) Test(org.junit.Test) IElementImpl1A(org.neo4j.ogm.domain.gh806.IElementImpl1A) List(java.util.List) Element(org.neo4j.ogm.domain.gh806.Element) Post(org.neo4j.ogm.domain.forum.activity.Post) SessionFactory(org.neo4j.ogm.session.SessionFactory) TestContainersTestBase(org.neo4j.ogm.testutil.TestContainersTestBase) Collections(java.util.Collections) ConcreteElement(org.neo4j.ogm.domain.gh806.ConcreteElement) Activity(org.neo4j.ogm.domain.forum.activity.Activity) Container(org.neo4j.ogm.domain.gh806.Container) EvenMoreConcreteElement(org.neo4j.ogm.domain.gh806.EvenMoreConcreteElement) ConcreteElement(org.neo4j.ogm.domain.gh806.ConcreteElement) HashSet(java.util.HashSet) Result(org.neo4j.ogm.model.Result)

Example 78 with Container

use of org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.Container in project neo4j-ogm by neo4j.

the class SingleUseEntityMapperTest method gh813.

@Test
public void gh813() {
    SingleUseEntityMapper entityMapper = new SingleUseEntityMapper(sessionFactory.metaData(), new ReflectionEntityInstantiator(sessionFactory.metaData()));
    Iterable<Map<String, Object>> results;
    results = sessionFactory.openSession().query("RETURN 'containerName' AS name, [i IN RANGE(0,3) | {a:{id: i, name:'a'+i}, b:{id: i, name:'b'+i}, c:{id: i, name:'c'+i}}] AS rows", EMPTY_MAP).queryResults();
    assertThat(results).hasSize(1);
    Container container = entityMapper.map(Container.class, results.iterator().next());
    assertContainer(container, 4);
    results = sessionFactory.openSession().query("WITH {a: {id: 0, name: 'a0'}, b: {id:0, name:'b0'}, c: {id:0, name: 'c0'}} AS i RETURN 'containerName' as name, collect(i) as rows", EMPTY_MAP).queryResults();
    assertThat(results).hasSize(1);
    container = entityMapper.map(Container.class, results.iterator().next());
    assertContainer(container, 1);
}
Also used : SomeContainer(org.neo4j.ogm.domain.gh391.SomeContainer) Container(org.neo4j.ogm.domain.gh813.Container) HashMap(java.util.HashMap) Map(java.util.Map) ReflectionEntityInstantiator(org.neo4j.ogm.metadata.reflect.ReflectionEntityInstantiator) Test(org.junit.Test)

Example 79 with Container

use of org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.Container in project pravega by pravega.

the class PravegaControllerService method createPravegaControllerApp.

/**
 * To configure the controller app.
 *
 * @return App instance of marathon app
 */
private App createPravegaControllerApp() {
    App app = new App();
    app.setId(this.id);
    app.setCpus(cpu);
    app.setMem(mem);
    app.setInstances(instances);
    app.setConstraints(setConstraint("hostname", "UNIQUE"));
    app.setContainer(new Container());
    app.getContainer().setType(CONTAINER_TYPE);
    app.getContainer().setDocker(new Docker());
    app.getContainer().getDocker().setImage(IMAGE_PATH + "/nautilus/pravega:" + PRAVEGA_VERSION);
    String zk = zkUri.getHost() + ":" + ZKSERVICE_ZKPORT;
    // set port
    app.setPortDefinitions(Arrays.asList(createPortDefinition(CONTROLLER_PORT), createPortDefinition(REST_PORT)));
    app.setRequirePorts(true);
    List<HealthCheck> healthCheckList = new ArrayList<HealthCheck>();
    healthCheckList.add(setHealthCheck(300, "TCP", false, 60, 20, 0, CONTROLLER_PORT));
    app.setHealthChecks(healthCheckList);
    String controllerSystemProperties = "-Xmx512m" + buildSystemProperty(propertyName("zk.connect.uri"), zk) + buildSystemProperty(propertyName("service.rpc.published.host.nameOrIp"), this.id + ".marathon.mesos") + buildSystemProperty(propertyName("service.rpc.published.port"), String.valueOf(CONTROLLER_PORT)) + buildSystemProperty(propertyName("service.rpc.listener.port"), String.valueOf(CONTROLLER_PORT)) + buildSystemProperty(propertyName("service.rest.listener.port"), String.valueOf(REST_PORT)) + buildSystemProperty("log.level", "DEBUG") + buildSystemProperty("log.dir", "$MESOS_SANDBOX/pravegaLogs") + buildSystemProperty("curator-default-session-timeout", String.valueOf(10 * 1000)) + buildSystemProperty(propertyName("transaction.lease.count.max"), String.valueOf(600 * 1000)) + buildSystemProperty(propertyName("retention.frequency.minutes"), String.valueOf(2));
    Map<String, Object> map = new HashMap<>();
    map.put("PRAVEGA_CONTROLLER_OPTS", controllerSystemProperties);
    app.setEnv(map);
    app.setArgs(Arrays.asList("controller"));
    return app;
}
Also used : App(mesosphere.marathon.client.model.v2.App) Container(mesosphere.marathon.client.model.v2.Container) Docker(mesosphere.marathon.client.model.v2.Docker) HashMap(java.util.HashMap) HealthCheck(mesosphere.marathon.client.model.v2.HealthCheck) ArrayList(java.util.ArrayList)

Example 80 with Container

use of org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.Container in project pravega by pravega.

the class PravegaSegmentStoreService method createPravegaSegmentStoreApp.

private App createPravegaSegmentStoreApp() {
    App app = new App();
    app.setId(this.id);
    app.setCpus(cpu);
    app.setMem(mem);
    app.setInstances(instances);
    // set constraints
    app.setConstraints(setConstraint("hostname", "UNIQUE"));
    // docker container
    app.setContainer(new Container());
    app.getContainer().setType(CONTAINER_TYPE);
    app.getContainer().setDocker(new Docker());
    // set the image and network
    app.getContainer().getDocker().setImage(IMAGE_PATH + "/nautilus/pravega:" + PRAVEGA_VERSION);
    // set port
    app.setPortDefinitions(Arrays.asList(createPortDefinition(SEGMENTSTORE_PORT)));
    app.setRequirePorts(true);
    // healthchecks
    List<HealthCheck> healthCheckList = new ArrayList<HealthCheck>();
    healthCheckList.add(setHealthCheck(300, "TCP", false, 60, 20, 0, SEGMENTSTORE_PORT));
    app.setHealthChecks(healthCheckList);
    // set env
    String zk = zkUri.getHost() + ":" + ZKSERVICE_ZKPORT;
    // Environment variables to configure SS service.
    Map<String, Object> map = new HashMap<>();
    map.put("ZK_URL", zk);
    map.put("BK_ZK_URL", zk);
    map.put("CONTROLLER_URL", conUri.toString());
    getCustomEnvVars(map, SEGMENTSTORE_EXTRA_ENV);
    // Properties set to override defaults for system tests
    String hostSystemProperties = "-Xmx1024m" + buildSystemProperty("autoScale.muteInSeconds", "120") + buildSystemProperty("autoScale.cooldownInSeconds", "120") + buildSystemProperty("autoScale.cacheExpiryInSeconds", "120") + buildSystemProperty("autoScale.cacheCleanUpInSeconds", "120") + buildSystemProperty("log.level", "DEBUG") + buildSystemProperty("log.dir", "$MESOS_SANDBOX/pravegaLogs") + buildSystemProperty("curator-default-session-timeout", String.valueOf(30 * 1000)) + buildSystemProperty("hdfs.replaceDataNodesOnFailure", "false");
    map.put("PRAVEGA_SEGMENTSTORE_OPTS", hostSystemProperties);
    app.setEnv(map);
    app.setArgs(Arrays.asList("segmentstore"));
    return app;
}
Also used : App(mesosphere.marathon.client.model.v2.App) Container(mesosphere.marathon.client.model.v2.Container) Docker(mesosphere.marathon.client.model.v2.Docker) HashMap(java.util.HashMap) HealthCheck(mesosphere.marathon.client.model.v2.HealthCheck) ArrayList(java.util.ArrayList)

Aggregations

ItemStack (org.bukkit.inventory.ItemStack)45 Test (org.junit.Test)16 HashMap (java.util.HashMap)10 Container (net.minecraft.server.v1_12_R1.Container)9 Container (net.minecraft.server.v1_16_R3.Container)9 Container (org.flyte.api.v1.Container)9 FailedNbt (com.ruinscraft.panilla.api.exception.FailedNbt)8 INbtTagCompound (com.ruinscraft.panilla.api.nbt.INbtTagCompound)8 Container (net.minecraft.server.v1_11_R1.Container)8 Container (net.minecraft.server.v1_14_R1.Container)8 Container (net.minecraft.server.v1_15_R1.Container)8 Container (net.minecraft.server.v1_16_R1.Container)8 Container (net.minecraft.server.v1_16_R2.Container)8 Container (net.minecraft.server.v1_8_R3.Container)8 ByteBuf (io.netty.buffer.ByteBuf)7 ArrayList (java.util.ArrayList)7 Container (net.minecraft.server.v1_13_R1.Container)7 Container (net.minecraft.server.v1_13_R2.Container)6 Container (net.minecraft.server.v1_10_R1.Container)5 EntityPlayer (net.minecraft.server.v1_8_R3.EntityPlayer)5