@Test public void testUdt() { UserType userType = Mockito.mock(UserType.class); Mockito.when(userType.getName()).thenReturn(DataType.Name.UDT); Mockito.when(userType.getTypeName()).thenReturn("FooType"); Mockito.when(userType.getKeyspace()).thenReturn("barspace"); List<String> fieldNames = new ArrayList<>(); fieldNames.add("asciiField"); fieldNames.add("doubleField"); Mockito.when(userType.getFieldNames()).thenReturn(fieldNames); Mockito.when(userType.getFieldType("asciiField")).thenReturn(DataType.ascii()); Mockito.when(userType.getFieldType("doubleField")).thenReturn(DataType.cdouble()); Mockito.when(userType.isFrozen()).thenReturn(false, true); ByteBuffer expectedTypeName = ByteBuffer.wrap("FooType".getBytes(Charset.defaultCharset())); List<FieldIdentifier> expectedFieldIdentifiers = new ArrayList<>(); expectedFieldIdentifiers.add(new FieldIdentifier(ByteBuffer.wrap("asciiField".getBytes(Charset.defaultCharset())))); expectedFieldIdentifiers.add(new FieldIdentifier(ByteBuffer.wrap("doubleField".getBytes(Charset.defaultCharset())))); List<AbstractType<?>> expectedFieldTypes = new ArrayList<>(); expectedFieldTypes.add(AsciiType.instance); expectedFieldTypes.add(DoubleType.instance); org.apache.cassandra.db.marshal.UserType expectedAbstractType = new org.apache.cassandra.db.marshal.UserType("barspace", expectedTypeName, expectedFieldIdentifiers, expectedFieldTypes, true); AbstractType<?> convertedType = CassandraTypeConverter.convert(userType); Assert.assertEquals(expectedAbstractType, convertedType); expectedAbstractType = new org.apache.cassandra.db.marshal.UserType("barspace", expectedTypeName, expectedFieldIdentifiers, expectedFieldTypes, false); convertedType = CassandraTypeConverter.convert(userType); Assert.assertEquals(expectedAbstractType, convertedType); }
public static AbstractType<?> convert(DataType type) { TypeConverter<?> typeConverter = typeMap.get(type.getName()); return typeConverter.convert(type); }
CassandraTypeConverter { public static AbstractType<?> convert(DataType type) { TypeConverter<?> typeConverter = typeMap.get(type.getName()); return typeConverter.convert(type); } }
CassandraTypeConverter { public static AbstractType<?> convert(DataType type) { TypeConverter<?> typeConverter = typeMap.get(type.getName()); return typeConverter.convert(type); } private  CassandraTypeConverter(); }
CassandraTypeConverter { public static AbstractType<?> convert(DataType type) { TypeConverter<?> typeConverter = typeMap.get(type.getName()); return typeConverter.convert(type); } private  CassandraTypeConverter(); static AbstractType<?> convert(DataType type); }
CassandraTypeConverter { public static AbstractType<?> convert(DataType type) { TypeConverter<?> typeConverter = typeMap.get(type.getName()); return typeConverter.convert(type); } private  CassandraTypeConverter(); static AbstractType<?> convert(DataType type);  }