public static BySuffixFilter newFilter(final String suffix) { return new BySuffixFilter(suffix); }
@PostConstruct protected void init() { initializeRegistryRoot(); initializeRegistry(); }
@PostConstruct public void init() { initializeRegistryRoot(); initializeRegistry(); }
@Test public void testReadEntryWhenMarshallerNotExists() throws Exception { when(ioService.readAllString(path)).thenReturn(MARSHALLED_ENTRY); when(entryMarshaller.unmarshal(MARSHALLED_ENTRY)).thenReturn(entry); when(entry.getContentType()).thenReturn(Object.class.getName()); when(marshallerRegistry.get(Object.class.getClass())).thenReturn(null); expectedException.expectMessage("No marshaller was found for class: " + entry.getContentType()); registryHelper.readEntry(path); }
@Test @Override public void testDeregisterProvider() { prepareProviderTargetPath(); runtimeRegistry.registerProvider(provider); verifyProviderIsRegistered(provider); runtimeRegistry.deregisterProvider(provider); verify(registryHelper, times(1)).deleteBatch(providerTargetPath); verifyProviderIsNotRegistered(provider); }
@Test @Override public void testDeregisterRuntime() { prepareRuntimeTargetPath(); runtimeRegistry.registerRuntime(runtime); verifyRuntimeIsRegistered(runtime); runtimeRegistry.deregisterRuntime(runtime); verify(registryHelper, times(1)).deleteBatch(runtimeTargetPath); verifyRuntimeIsNotRegistered(runtime); }
@Test public void testReadEntries() throws Exception { prepareReadEntries(); List<Object> result = registryHelper.readEntries(rootPath, filter); assertEquals(expectedObjects, result); for (Path path : entryPaths) { verify(registryHelper, times(1)).readEntry(path); } }
@Override public void deregister(final String taskId) { checkNotNull("taskId", taskId); final Path path = buildTracePath(taskId); registryHelper.deleteBatch(path); super.deregister(taskId); }
@Override public void deregisterProvider(final String providerId) { checkNotNull("providerId", providerId); final Path path = buildProviderPath(providerId); registryHelper.deleteBatch(path); super.deregisterProvider(providerId); }
@Override public void deregisterRuntime(final RuntimeId runtimeId) { checkNotNull("runtimeId", runtimeId); final Path path = buildRuntimePath(runtimeId.getId()); registryHelper.deleteBatch(path); super.deregisterRuntime(runtimeId); }
private Path buildTracePath(final String pipelineExecutionTraceId) { return registryRoot.resolve(registryHelper.md5Hex(pipelineExecutionTraceId) + TRACE_SUFFIX); } }
@Override public VFSRegistryEntry getValue() { return new VFSRegistryEntry(VFSRuntimeRegistry.class.getName(), ENTRY_CONTENT); }
@Override public Marshaller<VFSRegistryEntry> createMarshaller() { return new VFSRegistryEntryMarshaller(); }
private void prepareProviderTargetPath() { providerTargetPath = prepareTargetPath(provider.getId(), PROVIDER_SUFFIX); }
@Test public void testReadEntryWhenMarshallerNotExists() throws Exception { when(ioService.readAllString(path)).thenReturn(MARSHALLED_ENTRY); when(entryMarshaller.unmarshal(MARSHALLED_ENTRY)).thenReturn(entry); when(entry.getContentType()).thenReturn(Object.class.getName()); when(marshallerRegistry.get(Object.class.getClass())).thenReturn(null); expectedException.expectMessage("No marshaller was found for class: " + entry.getContentType()); registryHelper.readEntry(path); }
@Test @Override public void testDeregisterProvider() { prepareProviderTargetPath(); runtimeRegistry.registerProvider(provider); verifyProviderIsRegistered(provider); runtimeRegistry.deregisterProvider(provider); verify(registryHelper, times(1)).deleteBatch(providerTargetPath); verifyProviderIsNotRegistered(provider); }
@Test @Override public void testDeregisterRuntime() { prepareRuntimeTargetPath(); runtimeRegistry.registerRuntime(runtime); verifyRuntimeIsRegistered(runtime); runtimeRegistry.deregisterRuntime(runtime); verify(registryHelper, times(1)).deleteBatch(runtimeTargetPath); verifyRuntimeIsNotRegistered(runtime); }
@Test public void testReadEntries() throws Exception { prepareReadEntries(); List<Object> result = registryHelper.readEntries(rootPath, filter); assertEquals(expectedObjects, result); for (Path path : entryPaths) { verify(registryHelper, times(1)).readEntry(path); } }
@Override public Marshaller<VFSRegistryEntry> createMarshaller() { return new VFSRegistryEntryMarshaller(); }
private void prepareProviderTargetPath() { providerTargetPath = prepareTargetPath(provider.getId(), PROVIDER_SUFFIX); }