dcapwell commented on code in PR #2310:
URL: https://github.com/apache/cassandra/pull/2310#discussion_r1194161180


##########
test/unit/org/apache/cassandra/db/marshal/AbstractTypeTest.java:
##########
@@ -0,0 +1,439 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.db.marshal;
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.lang.reflect.Modifier;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import com.google.common.collect.Sets;
+import org.junit.Test;
+
+import org.apache.cassandra.config.CassandraRelevantProperties;
+import org.apache.cassandra.cql3.AssignmentTestable;
+import org.apache.cassandra.cql3.ColumnIdentifier;
+import org.apache.cassandra.cql3.ColumnSpecification;
+import org.apache.cassandra.cql3.Constants;
+import org.apache.cassandra.cql3.Json;
+import org.apache.cassandra.cql3.QueryOptions;
+import org.apache.cassandra.cql3.Term;
+import org.apache.cassandra.cql3.VariableSpecifications;
+import org.apache.cassandra.io.util.DataInputBuffer;
+import org.apache.cassandra.io.util.DataInputPlus;
+import org.apache.cassandra.io.util.DataOutputBuffer;
+import org.apache.cassandra.io.util.File;
+import org.apache.cassandra.schema.CQLTypeParser;
+import org.apache.cassandra.schema.ColumnMetadata;
+import org.apache.cassandra.schema.Types;
+import org.apache.cassandra.transport.ProtocolVersion;
+import org.apache.cassandra.utils.AbstractTypeGenerators;
+import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.FastByteOperations;
+import org.apache.cassandra.utils.bytecomparable.ByteComparable;
+import org.apache.cassandra.utils.bytecomparable.ByteSource;
+import org.apache.cassandra.utils.bytecomparable.ByteSourceInverse;
+import org.quicktheories.core.Gen;
+import org.reflections.Reflections;
+import org.reflections.scanners.Scanners;
+import org.reflections.util.ConfigurationBuilder;
+
+import static org.apache.cassandra.utils.AbstractTypeGenerators.TypeKind.*;
+import static org.apache.cassandra.utils.AbstractTypeGenerators.extractUDTs;
+import static org.apache.cassandra.utils.AbstractTypeGenerators.typeTree;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.quicktheories.QuickTheory.qt;
+
+public class AbstractTypeTest
+{
+    static
+    {
+        // make sure blob is always the same
+        CassandraRelevantProperties.TEST_BLOB_SHARED_SEED.setInt(42);
+    }
+
+    //TODO
+    // isCompatibleWith/isValueCompatibleWith/isSerializationCompatibleWith,
+    // withUpdatedUserType/expandUserTypes/referencesDuration - types that 
recursive check types
+    // getMaskedValue
+
+    @Test
+    public void allTypesCovered()
+    {
+        // this test just makes sure that all types are covered and no new 
type is left out
+        Reflections reflections = new Reflections(new ConfigurationBuilder()
+                                                  
.forPackage("org.apache.cassandra")
+                                                  
.setScanners(Scanners.SubTypes)
+                                                  .setExpandSuperTypes(true)
+                                                  .setParallel(true));
+        Set<Class<? extends AbstractType>> subTypes = 
reflections.getSubTypesOf(AbstractType.class);
+        Set<Class<? extends AbstractType>> coverage = 
AbstractTypeGenerators.knownTypes();
+        StringBuilder sb = new StringBuilder();
+        for (Class<? extends AbstractType> klass : Sets.difference(subTypes, 
coverage))
+        {
+            if (Modifier.isAbstract(klass.getModifiers()))
+                continue;
+            if ("test".equals(new 
File(klass.getProtectionDomain().getCodeSource().getLocation().getPath()).name()))

Review Comment:
   if a test creates a type, doesn't matter if its *valid* as the test is 
likely testing its own internal logic.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to