gesterzhou commented on a change in pull request #6878:
URL: https://github.com/apache/geode/pull/6878#discussion_r712514481



##########
File path: geode-serialization/ANALYZE_SERIALIZABLES.md
##########
@@ -0,0 +1,116 @@
+# Analyze Serializables
+
+## Adding AnalyzeSerializables test to a new geode module
+
+If you've created a new geode module, then add an integration test to detect 
any additions or changes to serializable classes in the module.
+
+Change the module's `build.gradle` to add a dependency on geode-serialization:
+```
+integrationTestImplementation(project(':geode-serialization'))
+```
+
+Create `AnalyzeModuleSerializablesIntegrationTest` that extends 
`AnalyzeSerializablesJUnitTestBase`. It needs to be in package 
`org.apache.geode.codeAnalysis`.
+
+## Implementing SanctionedSerializablesService
+
+If you've changed or added any serializable classes to a geode module, the 
previously added integration test should fail. You'll need to implement 
`SanctionedSerializablesService` for the geode module.
+
+Change the module's `build.gradle` to add a dependency on geode-serialization:
+```
+implementation(project(':geode-serialization'))
+```
+
+Create a new `ModuleSanctionedSerializablesService` that implements 
`SanctionedSerializablesService`:
+```
+geode-module/src/main/java/org/apache/geode/module/internal/ModuleSanctionedSerializablesService.java
+```
+
+Add a service file for `SanctionedSerializablesService`:
+```
+geode-module/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
+```
+
+Add a line to the service file specifying the fully qualified name of the 
service implementation:
+```
+org.apache.geode.module.internal.ModuleSanctionedSerializablesService
+```
+
+Update `AnalyzeModuleSerializablesIntegrationTest` to return the new 
`SanctionedSerializablesService` implementation from `getModuleClass`: 
+```java
+@Override
+protected Optional<Class<?>> getModuleClass() {
+  return Optional.of(ModuleSanctionedSerializablesService.class);
+}
+```
+
+## Fixing failures in AnalyzeModuleSerializablesIntegrationTest
+
+`AnalyzeModuleSerializablesIntegrationTest` analyzes serializable classes in a 
module. It fails if either:
+- a new serializable class is added to the main src
+- an existing serializable class in main src is modified
+
+The content of the failure message depends on whether the module implements 
`SanctionedSerializablesService`.
+
+If it implements `SanctionedSerializablesService`, the failure message looks 
like:
+```
+New or moved classes----------------------------------------
+org/apache/geode/CancelException,true,3215578659523282642
+
+If the class is not persisted or sent over the wire, add it to the file
+    
/path/to/geode/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
+Otherwise, if this doesn't break backward compatibility, copy the file

Review comment:
       "doesn't"?
   
   I wonder if it's typo. Should it be "does" here?




-- 
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]


Reply via email to