Search in sources :

Example 21 with Entity

use of com.google.cloud.videointelligence.v1p3beta1.Entity in project entity-service by hypertrace.

the class EntityNormalizerTest method throwsOnV1EntityTypeMissingIdAttr.

@Test
void throwsOnV1EntityTypeMissingIdAttr() {
    when(this.mockIdAttrCache.getIdentifyingAttributes(TENANT_ID, V1_ENTITY_TYPE)).thenReturn(List.of(V1_ID_ATTR));
    when(this.mockEntityTypeClient.get(V1_ENTITY_TYPE)).thenReturn(Single.error(new RuntimeException()));
    Entity inputEntity = Entity.newBuilder().setEntityType(V1_ENTITY_TYPE).build();
    Exception exception = assertThrows(IllegalArgumentException.class, () -> this.normalizer.normalize(TENANT_ID, inputEntity));
    assertEquals("Received and expected identifying attributes differ. Received: [] . Expected: [required-attr]", exception.getMessage());
}
Also used : Entity(org.hypertrace.entity.data.service.v1.Entity) Test(org.junit.jupiter.api.Test)

Example 22 with Entity

use of com.google.cloud.videointelligence.v1p3beta1.Entity in project entity-service by hypertrace.

the class EntityNormalizerTest method throwsOnV2EntityMissingId.

@Test
void throwsOnV2EntityMissingId() {
    when(this.mockEntityTypeClient.get(V2_ENTITY_TYPE)).thenReturn(Single.just(EntityType.getDefaultInstance()));
    Entity inputEntity = Entity.newBuilder().setEntityType(V2_ENTITY_TYPE).build();
    Exception exception = assertThrows(IllegalArgumentException.class, () -> this.normalizer.normalize(TENANT_ID, inputEntity));
    assertEquals("Entity ID is empty", exception.getMessage());
}
Also used : Entity(org.hypertrace.entity.data.service.v1.Entity) Test(org.junit.jupiter.api.Test)

Example 23 with Entity

use of com.google.cloud.videointelligence.v1p3beta1.Entity in project entity-service by hypertrace.

the class DocStoreConverterTest method entityToJSONDocumentConversion64BitNumberFixup.

@Test
public void entityToJSONDocumentConversion64BitNumberFixup() throws IOException {
    // Verify that timestamp attribute which is a long number won't get
    // converted to string
    Entity testEntity = Entity.newBuilder().setTenantId("tenant1").setEntityName("myentity1").putIdentifyingAttributes("entity_id", AttributeValue.newBuilder().setValue(Value.newBuilder().setString("my-entity-id-1")).build()).putAttributes("timestamp", AttributeValue.newBuilder().setValue(Value.newBuilder().setLong(1584055141072L)).build()).build();
    JSONDocument jsonDocument = DocStoreConverter.transform(testEntity);
    Assertions.assertEquals("{\"tenantId\":\"tenant1\",\"entityName\":\"myentity1\",\"identifyingAttributes\":{\"entity_id\":{\"value\":{\"string\":\"my-entity-id-1\"}}},\"attributes\":{\"timestamp\":{\"value\":{\"long\":1584055141072}}}}", jsonDocument.toJson());
}
Also used : Entity(org.hypertrace.entity.data.service.v1.Entity) JSONDocument(org.hypertrace.core.documentstore.JSONDocument) Test(org.junit.jupiter.api.Test)

Example 24 with Entity

use of com.google.cloud.videointelligence.v1p3beta1.Entity in project osmosis by openstreetmap.

the class EntityProgressLogger method process.

/**
 * {@inheritDoc}
 */
public void process(EntityContainer entityContainer) {
    Entity entity;
    entity = entityContainer.getEntity();
    if (progressTracker.updateRequired()) {
        LOG.info(prefix + "Processing " + entity.getType() + " " + entity.getId() + ", " + progressTracker.getObjectsPerSecond() + " objects/second.");
    }
    sink.process(entityContainer);
}
Also used : Entity(org.openstreetmap.osmosis.core.domain.v0_6.Entity)

Example 25 with Entity

use of com.google.cloud.videointelligence.v1p3beta1.Entity in project osmosis by openstreetmap.

the class TagSorter method process.

/**
 * {@inheritDoc}
 */
public void process(EntityContainer entityContainer) {
    EntityContainer writeableContainer;
    Entity entity;
    Collection<Tag> sortedTags;
    writeableContainer = entityContainer.getWriteableInstance();
    entity = writeableContainer.getEntity();
    sortedTags = sortTags(entity.getTags());
    entity.getTags().clear();
    entity.getTags().addAll(sortedTags);
    sink.process(writeableContainer);
}
Also used : Entity(org.openstreetmap.osmosis.core.domain.v0_6.Entity) EntityContainer(org.openstreetmap.osmosis.core.container.v0_6.EntityContainer) Tag(org.openstreetmap.osmosis.core.domain.v0_6.Tag)

Aggregations

Entity (org.hypertrace.entity.data.service.v1.Entity)110 LivingEntity (org.bukkit.entity.LivingEntity)95 Test (org.junit.jupiter.api.Test)95 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)88 net.minecraft.world.entity (net.minecraft.world.entity)40 org.bukkit.entity (org.bukkit.entity)40 Entity (com.google.datastore.v1.Entity)33 ArrayList (java.util.ArrayList)33 Location (org.bukkit.Location)33 EnrichedEntity (org.hypertrace.entity.data.service.v1.EnrichedEntity)32 Event (org.hypertrace.core.datamodel.Event)27 AttributeValue (org.hypertrace.core.datamodel.AttributeValue)22 BackendInfo (org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo)21 Mob (net.minecraft.world.entity.Mob)20 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)18 Entity (net.minecraft.server.v1_8_R3.Entity)18 AnnotateVideoProgress (com.google.cloud.videointelligence.v1.AnnotateVideoProgress)17 AnnotateVideoRequest (com.google.cloud.videointelligence.v1.AnnotateVideoRequest)17 AnnotateVideoResponse (com.google.cloud.videointelligence.v1.AnnotateVideoResponse)17 Entity (com.google.cloud.videointelligence.v1.Entity)17