Search in sources :

Example 16 with Container

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

the class TestListSquashing method testUserOrderedList.

@Test
public void testUserOrderedList() {
    final Keyed keyed = new KeyedBuilder().withKey(new KeyedKey("a")).build();
    final Unkeyed unkeyed = new UnkeyedBuilder().build();
    final Container cont = new ContainerBuilder().setKeyed(List.of(keyed)).setUnkeyed(List.of(unkeyed)).build();
    // Non-empty Lists should be retained
    assertEquals(List.of(keyed), cont.getKeyed());
    assertEquals(List.of(unkeyed), cont.getUnkeyed());
}
Also used : Container(org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.Container) KeyedBuilder(org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.container.KeyedBuilder) ContainerBuilder(org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.ContainerBuilder) KeyedKey(org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.container.KeyedKey) UnkeyedBuilder(org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.container.UnkeyedBuilder) Keyed(org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.container.Keyed) Unkeyed(org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.container.Unkeyed) Test(org.junit.Test)

Example 17 with Container

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

the class NormalizedNodeSerializeDeserializeTest method augmentMultipleChoices.

@Test
public void augmentMultipleChoices() {
    final QName augmentChoice1QName = AugmentChoice1.QNAME;
    final QName augmentChoice2QName = QName.create(augmentChoice1QName, "augment-choice2");
    final QName containerQName = QName.create(augmentChoice1QName, "case11-choice-case-container");
    final QName leafQName = QName.create(augmentChoice1QName, "case11-choice-case-leaf");
    final AugmentationIdentifier aug1Id = new AugmentationIdentifier(Set.of(augmentChoice1QName));
    final AugmentationIdentifier aug2Id = new AugmentationIdentifier(Set.of(augmentChoice2QName));
    final NodeIdentifier augmentChoice1Id = new NodeIdentifier(augmentChoice1QName);
    final NodeIdentifier augmentChoice2Id = new NodeIdentifier(augmentChoice2QName);
    final NodeIdentifier containerId = new NodeIdentifier(containerQName);
    final TopBuilder tBuilder = new TopBuilder();
    final TopChoiceAugment1Builder tca1Builder = new TopChoiceAugment1Builder();
    final Case1Builder c1Builder = new Case1Builder();
    final TopChoiceAugment2Builder tca2Builder = new TopChoiceAugment2Builder();
    final Case11Builder c11Builder = new Case11Builder();
    final Case11ChoiceCaseContainerBuilder cccc1Builder = new Case11ChoiceCaseContainerBuilder();
    cccc1Builder.setCase11ChoiceCaseLeaf("leaf-value");
    c11Builder.setCase11ChoiceCaseContainer(cccc1Builder.build());
    tca2Builder.setAugmentChoice2(c11Builder.build());
    c1Builder.addAugmentation(tca2Builder.build());
    tca1Builder.setAugmentChoice1(c1Builder.build());
    tBuilder.addAugmentation(tca1Builder.build());
    final Top top = tBuilder.build();
    final Entry<YangInstanceIdentifier, NormalizedNode> biResult = codecContext.toNormalizedNode(InstanceIdentifier.create(Top.class), top);
    final NormalizedNode topNormalized = containerBuilder().withNodeIdentifier(new NodeIdentifier(TOP_QNAME)).withChild(augmentationBuilder().withNodeIdentifier(aug1Id).withChild(choiceBuilder().withNodeIdentifier(augmentChoice1Id).withChild(augmentationBuilder().withNodeIdentifier(aug2Id).withChild(choiceBuilder().withNodeIdentifier(augmentChoice2Id).withChild(containerBuilder().withNodeIdentifier(containerId).withChild(leafNode(leafQName, "leaf-value")).build()).build()).build()).build()).build()).build();
    assertEquals(BI_TOP_PATH, biResult.getKey());
    assertEquals(topNormalized, biResult.getValue());
    final Entry<InstanceIdentifier<?>, DataObject> baResult = codecContext.fromNormalizedNode(BI_TOP_PATH, topNormalized);
    assertEquals(InstanceIdentifier.create(Top.class), baResult.getKey());
    assertEquals(top, baResult.getValue());
}
Also used : AugmentationIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier) TopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.TopBuilder) Case1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.top.choice.augment1.augment.choice1.Case1Builder) QName(org.opendaylight.yangtools.yang.common.QName) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) DataObject(org.opendaylight.yangtools.yang.binding.DataObject) Case11Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.top.choice.augment2.augment.choice2.Case11Builder) Top(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.Top) TopChoiceAugment1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TopChoiceAugment1Builder) TopChoiceAugment2Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TopChoiceAugment2Builder) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) Case11ChoiceCaseContainerBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.top.choice.augment2.augment.choice2.case11.Case11ChoiceCaseContainerBuilder) NormalizedNode(org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode) Test(org.junit.Test)

Example 18 with Container

use of org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.Container in project WildChests by BG-Software-LLC.

the class NMSInventory_v1_16_R3 method openPage.

@Override
public void openPage(Player player, com.bgsoftware.wildchests.objects.inventory.CraftWildInventory inventory) {
    EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
    String title = inventory.getTitle();
    Container container = createContainer(entityPlayer.nextContainerCounter(), entityPlayer.inventory, inventory);
    container.setTitle(new ChatComponentText(title));
    entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, container.getType(), container.getTitle()));
    entityPlayer.activeContainer = container;
    entityPlayer.activeContainer.addSlotListener(entityPlayer);
}
Also used : Container(net.minecraft.server.v1_16_R3.Container) TileEntityContainer(com.bgsoftware.wildchests.objects.containers.TileEntityContainer) EntityPlayer(net.minecraft.server.v1_16_R3.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer) PacketPlayOutOpenWindow(net.minecraft.server.v1_16_R3.PacketPlayOutOpenWindow) ChatComponentText(net.minecraft.server.v1_16_R3.ChatComponentText)

Example 19 with Container

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

the class CustomInventoryCrafting method setItem.

@Override
public void setItem(int index, ItemStack item) {
    // Instead of updating one container, update all the containers
    // That are looking at the table, basically the viewers
    items.set(index, item == null ? ItemStack.a : item);
    for (Container container : containers) {
        container.a(this);
    }
    // Update the armorstand grid
    display.update();
}
Also used : SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_11_R1.ContainerManager_v1_11_R1.SelfContainer) Container(net.minecraft.server.v1_11_R1.Container)

Example 20 with Container

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

the class CustomInventoryCrafting method splitStack.

@Override
public ItemStack splitStack(int i, int j) {
    ItemStack itemstack = ContainerUtil.a(items, i, j);
    if (!itemstack.isEmpty()) {
        for (Container container : containers) {
            container.a(this);
        }
    }
    // Update the armorstand grid
    display.update();
    return itemstack;
}
Also used : SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_11_R1.ContainerManager_v1_11_R1.SelfContainer) Container(net.minecraft.server.v1_11_R1.Container) CraftItemStack(org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack) ItemStack(net.minecraft.server.v1_11_R1.ItemStack)

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