Search in sources :

Example 1 with FossologyFingerPrintRepository

use of org.eclipse.sw360.fossology.db.FossologyFingerPrintRepository in project sw360portal by sw360.

the class RealSshConnectionUtils method getTrustingJSchSessionFactory.

static JSchSessionProvider getTrustingJSchSessionFactory() {
    FossologyFingerPrintRepository keyConnector = mock(FossologyFingerPrintRepository.class);
    FossologyHostKeyRepository hostKeyRepository = spy(new FossologyHostKeyRepository(keyConnector));
    doReturn(HostKeyRepository.OK).when(hostKeyRepository).check(anyString(), any(byte[].class));
    return new JSchSessionProvider(new FossologySettings(), hostKeyRepository);
}
Also used : FossologyFingerPrintRepository(org.eclipse.sw360.fossology.db.FossologyFingerPrintRepository) FossologyHostKeyRepository(org.eclipse.sw360.fossology.ssh.keyrepo.FossologyHostKeyRepository) FossologySettings(org.eclipse.sw360.fossology.config.FossologySettings)

Example 2 with FossologyFingerPrintRepository

use of org.eclipse.sw360.fossology.db.FossologyFingerPrintRepository in project sw360portal by sw360.

the class FossologyUploaderFunctionalTest method setUpAutoTrustOnSecondTry.

private void setUpAutoTrustOnSecondTry() {
    final FossologyFingerPrintRepository fossologyFingerPrintRepository = appContext.getBean(FossologyFingerPrintRepository.class);
    doAnswer(new Answer<Void>() {

        @Override
        public Void answer(InvocationOnMock invocation) throws Throwable {
            final FossologyHostFingerPrint finger = (FossologyHostFingerPrint) invocation.getArguments()[0];
            FossologyHostFingerPrint trustedFingerPrint = finger.deepCopy().setTrusted(true);
            doReturn(ImmutableList.of(trustedFingerPrint)).when(fossologyFingerPrintRepository).getAll();
            return null;
        }
    }).when(fossologyFingerPrintRepository).add(any(FossologyHostFingerPrint.class));
}
Also used : FossologyFingerPrintRepository(org.eclipse.sw360.fossology.db.FossologyFingerPrintRepository) InvocationOnMock(org.mockito.invocation.InvocationOnMock) FossologyHostFingerPrint(org.eclipse.sw360.datahandler.thrift.fossology.FossologyHostFingerPrint)

Aggregations

FossologyFingerPrintRepository (org.eclipse.sw360.fossology.db.FossologyFingerPrintRepository)2 FossologyHostFingerPrint (org.eclipse.sw360.datahandler.thrift.fossology.FossologyHostFingerPrint)1 FossologySettings (org.eclipse.sw360.fossology.config.FossologySettings)1 FossologyHostKeyRepository (org.eclipse.sw360.fossology.ssh.keyrepo.FossologyHostKeyRepository)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1