This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Ignore @Test | |
public void canCreateIntegerPropertyAndValidate() { | |
Property prop = | |
new IntegerProperty("productRating", "Rating", false, 1, 10); | |
/*************************************************************** | |
* The following assertions will fail if executed. Remove this * | |
* comment and the @Ignore annotation once refactoring of the * | |
* PropertyFactory is complete. * | |
***************************************************************/ | |
assertFalse("Property value should be invalid", prop.isValid(0)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test(timeout=3000) | |
public void canGetListOfAllPastAuctions() throws ServiceException { | |
AuctionService service = new BaseAuctionService(); | |
service.loadAuctionHistory(); | |
Collection<Auction> pastAuctions = service.getPastAuctions(); | |
assertNotNull("unable to get past auctions", pastAuctions); | |
assertTrue("no past auctions", pastAuctions.size() > 0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test(expected=ServiceException.class) | |
public void cannotCreateUserWithSameUsername() throws ServiceException { | |
User user1 = new User("Jane", "Smith", "jsmith", "venus"); | |
User user2 = new User("John", "Smith", "jsmith", "mars"); | |
AuctionService service = null; | |
try { | |
service = new BaseAuctionService(); | |
service.saveUser(user1); | |
} catch (ServiceException e) { | |
fail( e.getMessage() ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void canGetAuctionsForUsername() throws ServiceException { | |
String username = "tpiazza"; | |
Auction[] auctions = new Auction[5 + new Random().nextInt(16)]; | |
for(int i = 0; i < auctions.length; i++) { | |
Auction auction = createDummyAuction( username ); | |
auctions[i] = auction; | |
service.saveAuction( auction ); | |
} | |
assertThat( service.getAuctions(username), hasItems(auctions) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(Suite.class) | |
@Suite.SuiteClasses({AuctionTest.class, BidTest.class, UserTest.class}) | |
public class CoreAuctionDomainSuite { | |
// empty class | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.piazzaconsulting.aspect; | |
import org.apache.log4j.Logger; | |
import org.aspectj.lang.JoinPoint; | |
import org.aspectj.lang.annotation.After; | |
import org.aspectj.lang.annotation.Before; | |
import org.aspectj.lang.reflect.MemberSignature; | |
public aspect LoggingAspect { | |
private static final String POINTCUT = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script written by Tony Piazza (https://gist.github.com/tonypiazza) | |
# make sure we have sufficient privileges | |
if [ $UID != 0 ] | |
then | |
echo -e "Insufficient privileges!" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script written by Tony Piazza (https://gist.github.com/tonypiazza) | |
# Privileges check | |
if [ $UID != 0 ] | |
then | |
echo -e "Insufficient privileges!" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Iterable<Playlist> findByUserName(String userName) { | |
return getBucketFactory() | |
.getAsyncBucket(Playlist.class) | |
.flatMap(bucket -> bucket | |
.get(USER_PREFIX + userName) | |
.flatMap(doc -> | |
Observable.from(doc.content().getArray(PLAYLISTS_PROPERTY)) | |
) | |
.flatMap(id -> bucket.get(id.toString())) | |
.map(doc -> fromJsonObject(doc.content(), Playlist.class)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2015 Piazza Software Consulting, LLC | |
* | |
* Licensed 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 |
OlderNewer