@Test(expected = IllegalArgumentException.class) public void testDataSupplierExpPipeNotFound() { SpdzStorageDataSupplier supplier = new SpdzStorageDataSupplier(new FilebasedStreamedStorageImpl(new InMemoryStorage()), "invalid", 2); supplier.getNextExpPipe(); }
@Test(expected = IllegalArgumentException.class) public void testDataSupplierNextBitNotFound() { SpdzStorageDataSupplier supplier = new SpdzStorageDataSupplier(new FilebasedStreamedStorageImpl(new InMemoryStorage()), "invalid", 2); supplier.getNextBit(); }
@Test(expected = IllegalArgumentException.class) public void testDataSupplierModNotFound() { SpdzStorageDataSupplier supplier = new SpdzStorageDataSupplier(new FilebasedStreamedStorageImpl(new InMemoryStorage()), "invalid", 2); supplier.getFieldDefinition(); }
@Test(expected = IllegalArgumentException.class) public void testDataSupplierInputMaskNotFound() { SpdzStorageDataSupplier supplier = new SpdzStorageDataSupplier(new FilebasedStreamedStorageImpl(new InMemoryStorage()), "invalid", 2); supplier.getNextInputMask(1); }
@Test(expected = IllegalArgumentException.class) public void testDataSupplierSskNotFound() { SpdzStorageDataSupplier supplier = new SpdzStorageDataSupplier(new FilebasedStreamedStorageImpl(new InMemoryStorage()), "invalid", 2); supplier.getSecretSharedKey(); }
@Test(expected = IllegalArgumentException.class) public void testDataSupplierTripleNotFound() { SpdzStorageDataSupplier supplier = new SpdzStorageDataSupplier(new FilebasedStreamedStorageImpl(new InMemoryStorage()), "invalid", 2); supplier.getNextTriple(); }
@Test(expected = IllegalArgumentException.class) public void testDataSupplierRandomElmNotFound() { SpdzStorageDataSupplier supplier = new SpdzStorageDataSupplier(new FilebasedStreamedStorageImpl(new InMemoryStorage()), "invalid", 2); supplier.getNextRandomFieldElement(); } }
@Before public void setup() { storage = new FilebasedStreamedStorageImpl(new InMemoryStorage()); }
private SpdzResourcePool createSpdzResourcePool(Properties properties) { String strat = properties.getProperty("spdz.preprocessingStrategy"); final PreprocessingStrategy strategy = PreprocessingStrategy.valueOf(strat); SpdzDataSupplier supplier = null; if (strategy == PreprocessingStrategy.DUMMY) { BigInteger modulus = ModulusFinder.findSuitableModulus(512); supplier = new SpdzDummyDataSupplier(myId, noOfPlayers, new BigIntegerFieldDefinition(modulus), modulus); } if (strategy == PreprocessingStrategy.STATIC) { int noOfThreadsUsed = 1; String storageName = SpdzStorageDataSupplier.STORAGE_NAME_PREFIX + noOfThreadsUsed + "_" + myId + "_" + 0 + "_"; supplier = new SpdzStorageDataSupplier( new FilebasedStreamedStorageImpl(new InMemoryStorage()), storageName, noOfPlayers); } return new SpdzResourcePoolImpl(myId, noOfPlayers, new SpdzOpenedValueStoreImpl(), supplier, new AesCtrDrbg(new byte[32])); }
@Test public void testNoIoExceptionOnClose() { HashMap<String, ObjectInputStream> inputs = new HashMap<>(); HashMap<String, ObjectOutputStream> outputs = new HashMap<>(); try { FileOutputStream fos = new FileOutputStream("foo"); ObjectOutputStream oos = new ObjectOutputStream(fos) { @Override public void close() throws IOException { throw new IOException("Mock Exception"); } }; outputs.put("bad-store", oos); FileInputStream fis = new FileInputStream("foo"); ObjectInputStream ois = new ObjectInputStream(fis) { @Override public void close() throws IOException { throw new IOException("Mock Exception"); } }; inputs.put("bad-store", ois); } catch (IOException e) { fail("Should not be reachable."); } FilebasedStreamedStorageImpl badStore = new FilebasedStreamedStorageImpl(new InMemoryStorage(), inputs, outputs); badStore.shutdown(); assertTrue("Should be reachable. Shutdown should handle the exceptions for us.", true); }
@Test public void testDataSupplierModFoundTwice() { FilebasedStreamedStorageImpl storage = new FilebasedStreamedStorageImpl(new InMemoryStorage()); storage.putNext("valid" + SpdzStorageDataSupplier.MODULUS_KEY, BigInteger.ONE); SpdzStorageDataSupplier supplier = new SpdzStorageDataSupplier(storage, "valid", 2); supplier.getFieldDefinition(); supplier.getFieldDefinition(); }
+ myId + "_" + 0 + "_"; FilebasedStreamedStorageImpl storage = new FilebasedStreamedStorageImpl(new InMemoryStorage()); supplier = new SpdzStorageDataSupplier(storage, storageName, numberOfParties);
@Test @Ignore("This is not tested on windows and does not work here") public void test_compareLT_Sequential_static() throws Exception { int noOfThreads = 1; try { InitializeStorage.initStreamedStorage(new FilebasedStreamedStorageImpl(new InMemoryStorage()), 2, noOfThreads, 1000, 100, 10000, 100); runTest(new CompareTests.TestCompareLT<>(), PreprocessingStrategy.STATIC, 2); } catch (Exception e) { //Should not fail Assert.fail(); } finally { InitializeStorage.cleanup(); } }