use of com.tangosol.io.Serializer in project coherence-spring by coherence-community.
the class GrpcSessionConfigurationBean method getConfiguration.
@Override
public Optional<SessionConfiguration> getConfiguration() {
if (this.getType() != SessionType.GRPC) {
// TODO
return Optional.empty();
}
GrpcSessionConfiguration.Builder builder;
if (this.channelName == null || this.channelName.trim().isEmpty()) {
// TODO builder = GrpcSessionConfiguration.builder(GrpcSessionConfiguration.DEFAULT_HOST);
builder = GrpcSessionConfiguration.builder();
} else {
try {
final Channel bean = BeanFactoryAnnotationUtils.qualifiedBeanOfType(this.ctx.getBeanFactory(), Channel.class, this.channelName);
builder = GrpcSessionConfiguration.builder(bean);
} catch (NoSuchBeanDefinitionException ex) {
builder = GrpcSessionConfiguration.builder(this.channelName);
}
}
builder = builder.named(getName()).withScopeName(getScopeName()).withTracing(this.tracingEnabled).withPriority(getPriority());
if (this.serializer != null && this.serializer.trim().isEmpty()) {
try {
final Serializer bean = BeanFactoryAnnotationUtils.qualifiedBeanOfType(this.ctx.getBeanFactory(), Serializer.class, this.serializer);
builder.withSerializer(bean, this.serializer);
} catch (NoSuchBeanDefinitionException ex) {
builder.withSerializerFormat(this.serializer);
}
}
return Optional.of(builder.build());
}
use of com.tangosol.io.Serializer in project micronaut-coherence by micronaut-projects.
the class ExtractorFactoriesTest method setup.
@BeforeEach
void setup() {
phoneNumber = new PhoneNumber(44, "04242424242");
person = new Person("Arthur", "Dent", LocalDate.of(1978, 3, 8), phoneNumber);
binaryKey = ExternalizableHelper.toBinary("AD", pofContext);
binaryPerson = ExternalizableHelper.toBinary(person, pofContext);
BackingMapContext ctx = mock(BackingMapContext.class);
Map<ValueExtractor, MapIndex> index = new HashMap<>();
when(ctx.getIndexMap()).thenReturn(index);
entry = new BackingMapBinaryEntry(binaryKey, binaryPerson, binaryPerson, null) {
@Override
public Object getKey() {
return "AD";
}
@Override
public Object getValue() {
return person;
}
@Override
public BackingMapContext getBackingMapContext() {
return ctx;
}
@Override
public Serializer getSerializer() {
return pofContext;
}
};
}
use of com.tangosol.io.Serializer in project coherence-spring by coherence-community.
the class ExtractorConfigurationTests method setup.
@BeforeEach
void setup() {
this.phoneNumber = new PhoneNumber(44, "04242424242");
this.person = new Person("Arthur", "Dent", LocalDate.of(1978, 3, 8), this.phoneNumber);
this.binaryKey = ExternalizableHelper.toBinary("AD", this.pofContext);
this.binaryPerson = ExternalizableHelper.toBinary(this.person, this.pofContext);
BackingMapContext ctx = mock(BackingMapContext.class);
Map<ValueExtractor, MapIndex> index = new HashMap<>();
when(ctx.getIndexMap()).thenReturn(index);
this.entry = new BackingMapBinaryEntry(this.binaryKey, this.binaryPerson, this.binaryPerson, null) {
@Override
public Object getKey() {
return "AD";
}
@Override
public Object getValue() {
return ExtractorConfigurationTests.this.person;
}
@Override
public BackingMapContext getBackingMapContext() {
return ctx;
}
@Override
public Serializer getSerializer() {
return ExtractorConfigurationTests.this.pofContext;
}
};
}
use of com.tangosol.io.Serializer in project coherence-spring by coherence-community.
the class SerializerConfigurationTests method shouldGetPofSerializer.
@Test
void shouldGetPofSerializer() {
final Serializer serializer = BeanFactoryAnnotationUtils.qualifiedBeanOfType(this.context.getBeanFactory(), Serializer.class, "pof");
assertThat(serializer).isNotNull();
assertThat(serializer).isInstanceOf(ConfigurablePofContext.class);
}
use of com.tangosol.io.Serializer in project coherence-spring by coherence-community.
the class SerializerConfigurationTests method shouldGetJavaSerializer.
@Test
void shouldGetJavaSerializer() {
final Serializer serializer = BeanFactoryAnnotationUtils.qualifiedBeanOfType(this.context.getBeanFactory(), Serializer.class, "java");
assertThat(serializer).isNotNull();
assertThat(serializer).isInstanceOf(DefaultSerializer.class);
}
Aggregations