Skip to content

Commit

Permalink
GEODE-9758: Move SanctionedSerializables to filter package (#7165)
Browse files Browse the repository at this point in the history
Move SanctionedSerializables to new package
org.apache.geode.internal.serialization.filter.
  • Loading branch information
kirklund committed Dec 9, 2021
1 parent 68b9080 commit db64b49
Show file tree
Hide file tree
Showing 56 changed files with 745 additions and 59 deletions.
3 changes: 2 additions & 1 deletion geode-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ dependencies {

// test
testImplementation('junit:junit')
testRuntimeOnly('org.junit.vintage:junit-vintage-engine')
testImplementation('org.apache.commons:commons-lang3')
testImplementation('org.assertj:assertj-core')
testImplementation('org.mockito:mockito-core')
testRuntimeOnly('org.junit.vintage:junit-vintage-engine')


// jmhTest
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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.geode.connectors.jdbc.internal;

import org.junit.experimental.categories.Category;

import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;

@Category({SerializationTest.class, SanctionedSerializablesTest.class})
public class ConnectorsSanctionedSerializablesServiceIntegrationTest
extends SanctionedSerializablesServiceIntegrationTestBase {

private final SanctionedSerializablesService service =
new ConnectorsSanctionedSerializablesService();

@Override
protected SanctionedSerializablesService getService() {
return service;
}

@Override
protected ServiceResourceExpectation getServiceResourceExpectation() {
return ServiceResourceExpectation.NON_EMPTY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import java.net.URL;

import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;

public class ConnectorsSanctionedSerializablesService implements SanctionedSerializablesService {

Expand Down
2 changes: 2 additions & 0 deletions geode-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ dependencies {
exclude module: 'geode-core'
}
testImplementation(project(':geode-concurrency-test'))
testImplementation(project(':geode-serialization'))
testImplementation('org.apache.bcel:bcel')
testImplementation('org.assertj:assertj-core')
testImplementation('org.mockito:mockito-core')
Expand All @@ -354,6 +355,7 @@ dependencies {
integrationTestImplementation(project(':geode-dunit'))
integrationTestImplementation(project(':geode-log4j'))
integrationTestImplementation(project(':geode-concurrency-test'))
integrationTestImplementation(project(':geode-serialization'))
integrationTestImplementation('org.apache.bcel:bcel')
integrationTestImplementation('org.apache.logging.log4j:log4j-core')
integrationTestImplementation('pl.pragmatists:JUnitParams')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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.geode.internal;

import org.junit.experimental.categories.Category;

import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;

@Category({SerializationTest.class, SanctionedSerializablesTest.class})
public class CoreSanctionedSerializablesServiceIntegrationTest
extends SanctionedSerializablesServiceIntegrationTestBase {

private final SanctionedSerializablesService service = new CoreSanctionedSerializablesService();

@Override
protected SanctionedSerializablesService getService() {
return service;
}

@Override
protected ServiceResourceExpectation getServiceResourceExpectation() {
return ServiceResourceExpectation.NON_EMPTY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import java.net.URL;

import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;

public class CoreSanctionedSerializablesService implements SanctionedSerializablesService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
package org.apache.geode.internal;

import static org.apache.geode.internal.serialization.SanctionedSerializables.loadSanctionedSerializablesServices;
import static org.apache.geode.internal.serialization.filter.SanctionedSerializables.loadSanctionedSerializablesServices;

import java.io.DataInput;
import java.io.DataOutput;
Expand Down Expand Up @@ -118,11 +118,11 @@
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.internal.serialization.ObjectDeserializer;
import org.apache.geode.internal.serialization.ObjectSerializer;
import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.internal.serialization.SerializationContext;
import org.apache.geode.internal.serialization.SerializationVersions;
import org.apache.geode.internal.serialization.StaticSerialization;
import org.apache.geode.internal.serialization.VersionedDataStream;
import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
import org.apache.geode.internal.util.concurrent.CopyOnWriteHashMap;
import org.apache.geode.logging.internal.log4j.api.LogService;
import org.apache.geode.pdx.NonPortableClassException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.apache.geode.InternalGemFireError;
import org.apache.geode.InternalGemFireException;
import org.apache.geode.internal.classloader.ClassPathLoader;
import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
import org.apache.geode.logging.internal.log4j.api.LogService;


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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.geode.cache.query.cq.internal;

import org.junit.experimental.categories.Category;

import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;

@Category({SerializationTest.class, SanctionedSerializablesTest.class})
public class CQSanctionedSerializablesServiceIntegrationTest
extends SanctionedSerializablesServiceIntegrationTestBase {

private final SanctionedSerializablesService service = new CQSanctionedSerializablesService();

@Override
protected SanctionedSerializablesService getService() {
return service;
}

@Override
protected ServiceResourceExpectation getServiceResourceExpectation() {
return ServiceResourceExpectation.NON_EMPTY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import java.net.URL;

import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;

public class CQSanctionedSerializablesService implements SanctionedSerializablesService {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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.geode.test.dunit.internal;

import org.junit.experimental.categories.Category;

import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;

@Category({SerializationTest.class, SanctionedSerializablesTest.class})
public class DUnitSanctionedSerializablesServiceIntegrationTest
extends SanctionedSerializablesServiceIntegrationTestBase {

private final SanctionedSerializablesService service = new DUnitSanctionedSerializablesService();

@Override
protected SanctionedSerializablesService getService() {
return service;
}

@Override
protected ServiceResourceExpectation getServiceResourceExpectation() {
return ServiceResourceExpectation.NON_EMPTY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import java.net.URL;

import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;

public class DUnitSanctionedSerializablesService implements SanctionedSerializablesService {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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.geode.redis.internal;

import org.junit.experimental.categories.Category;

import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
import org.apache.geode.redis.internal.services.RedisSanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;

@Category({SerializationTest.class, SanctionedSerializablesTest.class})
public class RedisSanctionedSerializablesServiceIntegrationTest
extends SanctionedSerializablesServiceIntegrationTestBase {

private final SanctionedSerializablesService service = new RedisSanctionedSerializablesService();

@Override
public SanctionedSerializablesService getService() {
return service;
}

@Override
protected ServiceResourceExpectation getServiceResourceExpectation() {
return ServiceResourceExpectation.NON_EMPTY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import java.net.URL;

import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;

public class RedisSanctionedSerializablesService implements SanctionedSerializablesService {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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.geode.gfsh.internal.management;

import static org.assertj.core.api.Assertions.assertThat;

import java.io.IOException;
import java.util.Collection;

import org.junit.Test;
import org.junit.experimental.categories.Category;

import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
import org.apache.geode.management.cli.CommandProcessingException;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;

@Category({SerializationTest.class, SanctionedSerializablesTest.class})
public class GfshSanctionedSerializablesServiceIntegrationTest
extends SanctionedSerializablesServiceIntegrationTestBase {

private final SanctionedSerializablesService service = new GfshSanctionedSerializablesService();

@Override
protected SanctionedSerializablesService getService() {
return service;
}

@Override
protected ServiceResourceExpectation getServiceResourceExpectation() {
return ServiceResourceExpectation.NON_EMPTY;
}

@Test
public void acceptListContainsCommandProcessingException() throws IOException {
SanctionedSerializablesService service = getService();

Collection<String> serializables = service.getSerializationAcceptlist();

assertThat(serializables)
.contains(CommandProcessingException.class.getName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import java.net.URL;

import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;

public class GfshSanctionedSerializablesService implements SanctionedSerializablesService {

Expand Down
Loading

0 comments on commit db64b49

Please sign in to comment.