Skip to content
Permalink
Browse files
Add missing @OverRide annotations
  • Loading branch information
Amichai Rothman committed May 28, 2019
1 parent 7cc135d commit 153eef0e679236a42f95e5d8e52c06aedbf1cb25
Showing 21 changed files with 58 additions and 1 deletion.
@@ -143,6 +143,7 @@ public String getAbsoluteAddress(String contextRoot, String endpointAddress) {

private final class UnregisterListener implements ServiceListener {

@Override
public void serviceChanged(ServiceEvent event) {
if (!(event.getType() == ServiceEvent.UNREGISTERING)) {
return;
@@ -64,14 +64,17 @@ class SecurityDelegatingHttpContext implements HttpContext {
requireFilter = Boolean.TRUE.toString().equalsIgnoreCase(bundleContext.getProperty(FILTER_REQUIRED_PROP));
}

@Override
public String getMimeType(String name) {
return delegate.getMimeType(name);
}

@Override
public URL getResource(String name) {
return delegate.getResource(name);
}

@Override
@SuppressWarnings({
"unchecked", "rawtypes"
})
@@ -123,6 +126,7 @@ class Chain implements FilterChain {
this.filters = filters;
}

@Override
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
if (current < filters.length && !response.isCommitted()) {
Filter filter = filters[current++];
@@ -96,6 +96,7 @@ public synchronized void removeIntent(Object intent, String intentName) {
intentMap.remove(intentName);
}

@Override
@SuppressWarnings("unchecked")
public synchronized List<Object> getRequiredIntents(Set<String> requiredIntents) {
String[] intentNames = assertAllIntentsSupported(requiredIntents);
@@ -124,6 +125,7 @@ public synchronized List<Object> getRequiredIntents(Set<String> requiredIntents)
return intents;
}

@Override
public <T> T getIntent(Class<? extends T> type, List<Object> intents) {
List<T> selectedIntents = getIntents(type, intents);
if (selectedIntents.isEmpty()) {
@@ -135,6 +137,7 @@ public <T> T getIntent(Class<? extends T> type, List<Object> intents) {
return (T)selectedIntents.iterator().next();
}

@Override
public <T> List<T> getIntents(Class<? extends T> type, List<Object> intents) {
List<T> result = new ArrayList<T>();
for (Object intent : intents) {
@@ -189,6 +192,7 @@ private synchronized Set<String> getMissingIntents(Collection<String> requiredIn
return unsupportedIntents;
}

@Override
public Set<String> getExported(Map<String, Object> sd) {
Set<String> allIntents = new HashSet<String>();
Collection<String> intents = PropertyHelper
@@ -200,6 +204,7 @@ public Set<String> getExported(Map<String, Object> sd) {
return allIntents;
}

@Override
public List<Object> getIntentsFromService(Object serviceBean) {
List<Object> intents = new ArrayList<>();
if (serviceBean instanceof IntentsProvider) {
@@ -218,6 +223,7 @@ public List<Object> getIntentsFromService(Object serviceBean) {
return intents;
}

@Override
public Set<String> getImported(Map<String, Object> sd) {
Collection<String> intents = PropertyHelper.getMultiValueProperty(sd.get(RemoteConstants.SERVICE_INTENTS));
return new HashSet<String>(intents);
@@ -37,6 +37,7 @@ public class ServiceInvocationHandler implements InvocationHandler {

}

@Override
public Object invoke(Object proxy, final Method m, Object[] params) throws Throwable {
if (OBJECT_METHODS.contains(m)) {
if (m.getName().equals("equals")) {
@@ -50,6 +51,7 @@ public Object invoke(Object proxy, final Method m, Object[] params) throws Throw
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
final Object[] paramsFinal = params;
return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
return m.invoke(serviceObject, paramsFinal);
}
@@ -95,20 +95,24 @@ static class DummyHttpService implements HttpService {
this.config = config;
}

@Override
@SuppressWarnings("rawtypes")
public void registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context)
throws ServletException {
Assert.assertEquals("/myService", alias);
servlet.init(config);
}

@Override
public void registerResources(String alias, String name, HttpContext context) {
throw new RuntimeException("This method should not be called");
}

@Override
public void unregister(String alias) {
}

@Override
public HttpContext createDefaultHttpContext() {
return EasyMock.createNiceMock(HttpContext.class);
}
@@ -50,6 +50,7 @@ public class SecurityDelegatingHttpContextTest extends TestCase {
protected String mimeType;
protected URL url; // does not need to exist

@Override
public void setUp() throws Exception {
mimeType = "text/xml";
url = new URL("file:test.xml"); // does not need to exist
@@ -212,12 +213,15 @@ class CommitResponseFilter implements Filter {

boolean called;

@Override
public void init(FilterConfig filterConfig) {
}

@Override
public void destroy() {
}

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws java.io.IOException {
called = true;
@@ -229,12 +233,15 @@ class DoNothingFilter implements Filter {

boolean called;

@Override
public void init(FilterConfig filterConfig) {
}

@Override
public void destroy() {
}

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws java.io.IOException, javax.servlet.ServletException {
called = true;
@@ -246,12 +253,15 @@ class AccessDeniedFilter implements Filter {

boolean called;

@Override
public void init(FilterConfig filterConfig) {
}

@Override
public void destroy() {
}

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws java.io.IOException {
called = true;
@@ -50,16 +50,19 @@ public void testInvoke() throws Throwable {
public void testInvokeObjectMethod() throws Throwable {
final List<String> called = new ArrayList<String>();
ServiceInvocationHandler sih = new ServiceInvocationHandler("hi", String.class) {
@Override
public boolean equals(Object obj) {
called.add("equals");
return super.equals(obj);
}

@Override
public int hashCode() {
called.add("hashCode");
return super.hashCode();
}

@Override
public String toString() {
called.add("toString");
return "somestring";
@@ -27,13 +27,15 @@ public class Activator implements BundleActivator {
private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
private ServiceDecoratorBundleListener bundleListener;

@Override
public void start(BundleContext context) {
ServiceDecoratorImpl serviceDecorator = new ServiceDecoratorImpl();
bundleListener = new ServiceDecoratorBundleListener(serviceDecorator);
context.addBundleListener(bundleListener);
context.registerService(ServiceDecorator.class.getName(), serviceDecorator, null);
}

@Override
public void stop(BundleContext context) {
LOG.debug("RemoteServiceAdmin Implementation is shutting down now");
if (bundleListener != null) {
@@ -66,6 +66,7 @@ public synchronized void addProperty(String name, String value, String type) {
addProps.put(name, obj);
}

@Override
public synchronized void apply(ServiceReference<?> sref, Map<String, Object> target) {
String[] objectClass = (String[]) sref.getProperty(Constants.OBJECTCLASS);
boolean matches = false;
@@ -90,6 +91,7 @@ public synchronized void apply(ServiceReference<?> sref, Map<String, Object> tar
target.putAll(addProps);
}

@Override
public Bundle getBundle() {
return bundle;
}
@@ -34,6 +34,7 @@ public ServiceDecoratorBundleListener(ServiceDecoratorImpl serviceDecorator) {
this.serviceDecorator = serviceDecorator;
}

@Override
public void bundleChanged(BundleEvent be) {
switch(be.getType()) {
case BundleEvent.STARTED:
@@ -45,4 +46,4 @@ public void bundleChanged(BundleEvent be) {
default:
}
}
}
}
@@ -45,6 +45,7 @@ public ServiceDecoratorImpl() {
parser = new DecorationParser();
}

@Override
public void decorate(ServiceReference<?> sref, Map<String, Object> target) {
for (Rule matcher : decorations) {
matcher.apply(sref, target);
@@ -150,6 +150,7 @@ public void testInterfaceRule6() {
private ServiceReference mockServiceReference(final Map<String, Object> serviceProps) {
ServiceReference sref = EasyMock.createMock(ServiceReference.class);
EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
@Override
public Object answer() {
return serviceProps.get(EasyMock.getCurrentArguments()[0]);
}
@@ -56,6 +56,7 @@ public void testAddRemoveDecorations() {
Map<String, Object> target = new HashMap<String, Object>();
ServiceReference sref = EasyMock.createMock(ServiceReference.class);
EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
@Override
public Object answer() {
return serviceProps.get(EasyMock.getCurrentArguments()[0]);
}
@@ -160,6 +161,7 @@ private Map<String, Object> testDecorate(final Map<String, Object> serviceProps,
Map<String, Object> target = new HashMap<String, Object>();
ServiceReference sref = EasyMock.createMock(ServiceReference.class);
EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
@Override
public Object answer() {
return serviceProps.get(EasyMock.getCurrentArguments()[0]);
}
@@ -57,6 +57,7 @@ public void testCustomIntent() throws Exception {
String serviceUri = HTTP_BASE_URI + "/cxf/taskservice";
final TaskService taskService = TaskServiceProxyFactory.create(serviceUri);
Task task = tryTo("Call TaskService", new Callable<Task>() {
@Override
public Task call() {
return taskService.get(1);
}
@@ -84,6 +84,7 @@ public void testRESTCall() throws Exception {
client.accept(MediaType.APPLICATION_XML_TYPE);
org.apache.cxf.dosgi.samples.rest.Task task = tryTo("Call REST Resource",
new Callable<org.apache.cxf.dosgi.samples.rest.Task>() {
@Override
public org.apache.cxf.dosgi.samples.rest.Task call() {
return client.get(org.apache.cxf.dosgi.samples.rest.Task.class);
}
@@ -108,6 +109,7 @@ private void checkWsdl(final URL wsdlURL) throws Exception {
dbf.setValidating(false);
final DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = tryTo("Parse WSDL", new Callable<Document>() {
@Override
public Document call() throws Exception {
return db.parse(wsdlURL.openStream());
}
@@ -36,6 +36,7 @@ public final class ChangeTitleInterceptor extends AbstractPhaseInterceptor<Messa
super(Phase.USER_LOGICAL);
}

@Override
public void handleMessage(Message message) throws Fault {
try {
MessageContentsList contents = MessageContentsList.getContentsList(message);
@@ -29,6 +29,7 @@

public class CustomIntentActivator implements BundleActivator {

@Override
public void start(BundleContext context) {
Dictionary<String, String> props = new Hashtable<String, String>();
props.put("org.apache.cxf.dosgi.IntentName", "myIntent");
@@ -42,6 +43,7 @@ public void start(BundleContext context) {
context.registerService(TaskService.class, new DummyTaskServiceImpl(), props2);
}

@Override
public void stop(BundleContext context) {
}
}
@@ -80,10 +80,12 @@ public void setIntentManager(IntentManager intentManager) {
this.intentManager = intentManager;
}

@Override
public String[] getSupportedTypes() {
return new String[] {RsConstants.RS_CONFIG_TYPE};
}

@Override
@SuppressWarnings("rawtypes")
public Object importEndpoint(ClassLoader consumerLoader,
BundleContext consumerContext,
@@ -119,6 +121,7 @@ private Object createJaxrsProxy(String address,
return ProxyFactory.create(factory.create(), iClass);
}

@Override
@SuppressWarnings("rawtypes")
public Endpoint exportService(Object serviceBean,
BundleContext callingContext,
@@ -85,10 +85,12 @@ public void activate(BundleContext context) {
this.bundleContext = context;
}

@Override
public String[] getSupportedTypes() {
return new String[] {WsConstants.WS_CONFIG_TYPE};
}

@Override
@SuppressWarnings("rawtypes")
public Object importEndpoint(ClassLoader consumerLoader,
BundleContext consumerContext,
@@ -153,6 +155,7 @@ private SoapBindingConfiguration copy(SoapBindingConfiguration intent) {
return bindingCfg;
}

@Override
@SuppressWarnings("rawtypes")
public Endpoint exportService(Object serviceO,
BundleContext serviceContext,
@@ -277,13 +277,15 @@ private ServerFactoryBean createMockServerFactoryBean() {
EasyMock.expect(sfb.create()).andReturn(server);
sfb.setAddress((String)EasyMock.anyObject());
EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
@Override
public Object answer() {
serverURI.setLength(0);
serverURI.append(EasyMock.getCurrentArguments()[0]);
return null;
}
});
EasyMock.expect(sfb.getAddress()).andAnswer(new IAnswer<String>() {
@Override
public String answer() {
return serverURI.toString();
}
@@ -295,6 +297,7 @@ public String answer() {
private Server createMockServer(final ServerFactoryBean sfb) {
AttributedURIType addr = EasyMock.createMock(AttributedURIType.class);
EasyMock.expect(addr.getValue()).andAnswer(new IAnswer<String>() {
@Override
public String answer() {
return sfb.getAddress();
}

0 comments on commit 153eef0

Please sign in to comment.