Skip to content

Commit

Permalink
Revert master to release-0.10 common ancestor
Browse files Browse the repository at this point in the history
  • Loading branch information
rasendubi committed Nov 7, 2016
1 parent 2cb584b commit e7a9473
Show file tree
Hide file tree
Showing 172 changed files with 735 additions and 4,876 deletions.
51 changes: 19 additions & 32 deletions .travis.yml
Expand Up @@ -14,38 +14,25 @@
# limitations under the License.
#

language: nix
sudo: false
matrix:
include:
# apache rat
- os: linux
install:
- travis_retry nix-shell -Q --packages pkgs.maven --pure --run true
script:
- nix-shell --pure --packages pkgs.maven --run 'mvn -q apache-rat:check'
language: python
python: "3.4"
sudo: required
dist: trusty
install:
- ./scripts/setup_nix.sh
- . $HOME/.nix-profile/etc/profile.d/nix.sh

# C SDK (Linux)
- os: linux
install:
- cd client/client-multi/client-c/
- travis_retry nix-shell -Q --pure --run true --arg cc3200Support false
script:
- nix-shell --arg cc3200Support false --pure --run ./scripts/build.sh
- cd client/client-multi/client-c/ && travis_retry nix-shell -Q --pure --run true --arg cc3200Support false && cd ../../..
- cd client/client-multi/client-cpp/ && travis_retry nix-shell -Q --pure --run true && cd ../../..
- travis_retry nix-shell -Q --packages pkgs.maven --pure --run true

# C SDK (macOS)
- os: osx
osx_image: xcode7.3
install:
- cd client/client-multi/client-c/
- travis_retry nix-shell -Q --pure --run true --arg cc3200Support false --arg raspberrypiSupport false --arg withValgrind false
script:
- nix-shell --arg cc3200Support false --arg raspberrypiSupport false --arg withValgrind false --pure --run 'NO_MEMCHECK=1 ./scripts/build.sh'
script:
- nix-shell --pure --packages pkgs.maven --run 'mvn -q apache-rat:check'

# C++ SDK (Linux)
- os: linux
install:
- cd client/client-multi/client-cpp/
- travis_retry nix-shell -Q --pure --run true
script:
- nix-shell --pure --run './build.sh test'
- cd client/client-multi/client-c
- nix-shell --arg cc3200Support false --pure --run ./scripts/build.sh
- cd ../../..

- cd client/client-multi/client-cpp
- nix-shell --pure --run './build.sh test'
- cd ../../..
2 changes: 1 addition & 1 deletion avrogen/pom.xml
Expand Up @@ -19,7 +19,7 @@ Copyright 2014-2016 CyberVision, Inc.
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kaaproject</groupId>
<version>0.11.0-SNAPSHOT</version>
<version>0.10.0-SNAPSHOT</version>
<artifactId>kaa</artifactId>
</parent>

Expand Down
6 changes: 0 additions & 6 deletions avrogen/src/main/resources/ObjC/enumObjC.h.vm
Expand Up @@ -22,9 +22,3 @@ typedef enum {
${ENUM_NAME}_$symbol,
#end
} $namespacePrefix${enum_name};

# define ${namespacePrefix}${enum_name}Array(enum) [@[ \
#foreach ($symbol in $schema.getEnumSymbols())
@"${ENUM_NAME}_$symbol", \
#end
[NSNull null]] objectAtIndex:enum]
34 changes: 2 additions & 32 deletions avrogen/src/main/resources/ObjC/recordObjC.m.vm
Expand Up @@ -52,7 +52,7 @@ $initstring {
if (self) {
#foreach ($field in $schema.getFields())
self.$field.name() = $field.name();
#end
#end
}
return self;
}
Expand All @@ -62,34 +62,6 @@ $initstring {
return @"$schema.getFullName()";
}

- (NSString *)description {
NSMutableString *fieldsDescription = [NSMutableString new];

#foreach($field in $schema.getFields())
#set ($field_name = $StyleUtils.fixCamelHumps($field.name()))
#set ($field_type = $TypeConverter.convertToObjCType($field.schema()))
#set ($field_schema = $field.schema())
#if ($TypeConverter.isAvroBoolean($field_schema))
NSString *fieldBoolVal = ($field_name == true) ? @"true" : @"false";
[fieldsDescription appendString:[NSString stringWithFormat:@"%@: %@\n", @"$field_name", fieldBoolVal]];
#elseif ($TypeConverter.isAvroInt($field_schema))
[fieldsDescription appendString:[NSString stringWithFormat:@"%@: %d\n", @"$field_name", self.$field.name()]];
#elseif ($TypeConverter.isAvroLong($field_schema))
[fieldsDescription appendString:[NSString stringWithFormat:@"%@: %lld\n", @"$field_name", self.$field.name()]];
#elseif ($TypeConverter.isAvroFloat($field_schema))
[fieldsDescription appendString:[NSString stringWithFormat:@"%@: %f\n", @"$field_name", self.$field.name()]];
#elseif ($TypeConverter.isAvroDouble($field_schema))
[fieldsDescription appendString:[NSString stringWithFormat:@"%@: %f\n", @"$field_name", self.$field.name()]];
#elseif ($TypeConverter.isAvroEnum($field_schema))
[fieldsDescription appendString:[NSString stringWithFormat:@"%@: %@\n", @"$field_name", $namespacePrefix${field_type}Array(self.$field.name())]];
#else
[fieldsDescription appendString:[NSString stringWithFormat:@"%@: %@\n", @"$field_name", self.$field.name()]];
#end
#end

return fieldsDescription;
}

###if ($TypeConverter.isTypeOut($schema))
- (void)serialize:(avro_writer_t)writer {
#foreach ($field in $schema.getFields())
Expand Down Expand Up @@ -278,8 +250,6 @@ $initstring {
#end
}



## Generating serialize/deserialize/getSize methods for Unions

#if ($schema.getFields().size() > 0)
Expand Down Expand Up @@ -521,4 +491,4 @@ $initstring {
#end
#end
@end
###end
###end
2 changes: 1 addition & 1 deletion client/client-multi/client-c/pom.xml
Expand Up @@ -19,7 +19,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kaaproject.kaa.client</groupId>
<version>0.11.0-SNAPSHOT</version>
<version>0.10.0-SNAPSHOT</version>
<artifactId>client-multi</artifactId>
</parent>
<artifactId>client-c</artifactId>
Expand Down
4 changes: 1 addition & 3 deletions client/client-multi/client-c/scripts/build.sh
Expand Up @@ -22,9 +22,7 @@ make

cd build-posix
ctest -T test
if [ -z ${NO_MEMCHECK+x} ]; then # if unset
ctest -T memcheck
fi
ctest -T memcheck
ctest -T coverage
cd ..

Expand Down
Expand Up @@ -645,7 +645,6 @@ void test_max_parallel_uploads_with_log_sync(void **state)
/*
* Ensure the first request is allowed.
*/
// cppcheck-suppress redundantAssignment
strategy.max_parallel_uploads = 1;
error_code = kaa_logging_add_record(log_collector, test_log_record, NULL);
ASSERT_EQUAL(error_code, KAA_ERR_NONE);
Expand Down Expand Up @@ -731,7 +730,6 @@ void test_max_parallel_uploads_with_sync_all(void **state)
/*
* Ensure the first request is allowed.
*/
// cppcheck-suppress redundantAssignment
strategy.max_parallel_uploads = 1;
error_code = kaa_logging_add_record(log_collector, test_log_record, NULL);
ASSERT_EQUAL(error_code, KAA_ERR_NONE);
Expand Down Expand Up @@ -780,6 +778,7 @@ void test_max_parallel_uploads_with_sync_all(void **state)
struct response_chunk {
uint8_t bucket_id[2]; /* 16 bits for bucket ID */
uint8_t resp_code; /* 8 bits for response code. 0 == SUCCESS, 1 == FAILURE */
// cppcheck-suppress unusedStructMember
uint8_t reserved; /* Should be 0 */
};

Expand Down
Expand Up @@ -16,22 +16,26 @@

#include <inttypes.h>



uint64_t __ashldi3(uint64_t a, int b)
{
if (b <= 0) {
if (b <= 0 ) {
return a;
}
if (b >= 64) {
return 0;
}
uint32_t aLow = (uint32_t)a;
uint32_t aHigh = (uint32_t)(a >> 32);
uint32_t aLow = (uint32_t) a;
uint32_t aHigh = (uint32_t) (a >> 32);
if (b >= 32) {
aHigh = (aLow << (b - 32));
aHigh = (aLow << b);
aLow = 0;
} else {
aHigh = (aHigh << b) + (aLow >> (32 - b));
aLow = (aLow << b);
}
return ((uint64_t) aHigh << 32) + aLow;
}


2 changes: 1 addition & 1 deletion client/client-multi/client-cpp/pom.xml
Expand Up @@ -19,7 +19,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kaaproject.kaa.client</groupId>
<version>0.11.0-SNAPSHOT</version>
<version>0.10.0-SNAPSHOT</version>
<artifactId>client-multi</artifactId>
</parent>
<artifactId>client-cpp</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client/client-multi/client-java-android/pom.xml
Expand Up @@ -19,7 +19,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kaaproject.kaa.client</groupId>
<version>0.11.0-SNAPSHOT</version>
<version>0.10.0-SNAPSHOT</version>
<artifactId>client-multi</artifactId>
</parent>
<artifactId>client-java-android</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client/client-multi/client-java-core/pom.xml
Expand Up @@ -19,7 +19,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kaaproject.kaa.client</groupId>
<version>0.11.0-SNAPSHOT</version>
<version>0.10.0-SNAPSHOT</version>
<artifactId>client-multi</artifactId>
</parent>
<artifactId>client-java-core</artifactId>
Expand Down
Expand Up @@ -43,7 +43,7 @@ public class DefaultUserTransport extends AbstractKaaTransport implements
private static final Logger LOG = LoggerFactory.getLogger(DefaultUserTransport.class);

private EndpointRegistrationProcessor processor;
private Map<EndpointAccessToken, EndpointKeyHash> attachedEndpoints = new HashMap<EndpointAccessToken, EndpointKeyHash>();
private final Map<EndpointAccessToken, EndpointKeyHash> attachedEndpoints = new HashMap<EndpointAccessToken, EndpointKeyHash>();

@Override
public UserSyncRequest createUserRequest() {
Expand Down Expand Up @@ -74,23 +74,16 @@ public UserSyncRequest createUserRequest() {
public void onUserResponse(UserSyncResponse response) throws IOException {
if (processor != null) {
boolean hasChanges = false;
if (clientState != null) {
attachedEndpoints = clientState.getAttachedEndpointsList();
}
Map<Integer, EndpointAccessToken> attachEndpointRequests = processor.getAttachEndpointRequests();
if (response.getEndpointAttachResponses() != null && !response.getEndpointAttachResponses().isEmpty()) {
for (EndpointAttachResponse attached : response.getEndpointAttachResponses()) {
EndpointAccessToken attachedToken = attachEndpointRequests.remove(attached.getRequestId());
if (attached.getResult() == SyncResponseResultType.SUCCESS) {
if (attachedToken != null) {
LOG.info("Token {}", attachedToken);
attachedEndpoints.put(attachedToken, new EndpointKeyHash(attached.getEndpointKeyHash()));
hasChanges = true;
} else {
LOG.warn("Endpoint {} is already attached!", attached.getEndpointKeyHash());
}
LOG.info("Token {}", attachedToken);
attachedEndpoints.put(attachedToken, new EndpointKeyHash(attached.getEndpointKeyHash()));
hasChanges = true;
} else {
LOG.error("Failed to attach endpoint {}. Attach endpoint request id: {}", attached.getEndpointKeyHash(), attached.getRequestId());
LOG.error("Failed to attach endpoint. Attach endpoint request id: {}", attached.getRequestId());
}
}
}
Expand Down
Expand Up @@ -103,7 +103,6 @@ public void onUserResponse() throws Exception {
dettachingEPs.put(REQUEST_ID_2, new EndpointKeyHash("keyhash2"));

KaaClientState clientState = Mockito.mock(KaaClientState.class);

EndpointRegistrationProcessor processor = Mockito.mock(EndpointRegistrationProcessor.class);

Mockito.when(processor.getAttachEndpointRequests()).thenReturn(attachingEPs);
Expand All @@ -121,43 +120,20 @@ public void onUserResponse() throws Exception {
new EndpointDetachResponse(REQUEST_ID_1, SyncResponseResultType.SUCCESS),
new EndpointDetachResponse(REQUEST_ID_1 + 2, SyncResponseResultType.FAILURE)));

transport.onUserResponse(response1);
transport.setEndpointRegistrationProcessor(processor);
transport.setClientState(clientState);
transport.onUserResponse(response1);

Mockito.verify(processor, Mockito.times(1)).onUpdate(Mockito.anyListOf(EndpointAttachResponse.class), Mockito.anyListOf(EndpointDetachResponse.class), Mockito.any(UserAttachResponse.class), Mockito.any(UserAttachNotification.class), Mockito.any(UserDetachNotification.class));

Mockito.verify(clientState, Mockito.times(1)).setAttachedEndpointsList(Mockito.anyMap());
}

@Test
public void onDuplicateUserAttachResponse() throws Exception {
KaaClientState clientState = Mockito.mock(KaaClientState.class);
EndpointRegistrationProcessor processor = Mockito.mock(EndpointRegistrationProcessor.class);

Map<Integer, EndpointAccessToken> attachingEPs = new HashMap<>();
attachingEPs.put(REQUEST_ID_1, new EndpointAccessToken("token1"));


Mockito.when(processor.getAttachEndpointRequests()).thenReturn(attachingEPs);

UserTransport transport = new DefaultUserTransport();
UserSyncResponse response1 = new UserSyncResponse();

response1.setEndpointAttachResponses(Arrays.asList(
new EndpointAttachResponse(REQUEST_ID_1, "keyhash1", SyncResponseResultType.SUCCESS)));
UserSyncResponse response2 = new UserSyncResponse();

transport.setClientState(clientState);
transport.setEndpointRegistrationProcessor(processor);

Map<EndpointAccessToken, EndpointKeyHash> map = new HashMap<>();
map.put(new EndpointAccessToken("token1"), new EndpointKeyHash("keyhash1"));
response2.setEndpointDetachResponses(Arrays.asList(
new EndpointDetachResponse(REQUEST_ID_2, SyncResponseResultType.SUCCESS)));

transport.onUserResponse(response1);
Mockito.verify(clientState, Mockito.times(1)).setAttachedEndpointsList(map);
transport.onUserResponse(response2);

transport.onUserResponse(response1);
Mockito.verify(clientState, Mockito.times(1)).setAttachedEndpointsList(map);
Mockito.verify(clientState, Mockito.times(2)).setAttachedEndpointsList(Mockito.anyMap());
}

}
2 changes: 1 addition & 1 deletion client/client-multi/client-java-desktop/pom.xml
Expand Up @@ -19,7 +19,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kaaproject.kaa.client</groupId>
<version>0.11.0-SNAPSHOT</version>
<version>0.10.0-SNAPSHOT</version>
<artifactId>client-multi</artifactId>
</parent>
<artifactId>client-java-desktop</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client/client-multi/client-objective-c/Kaa.podspec
Expand Up @@ -59,7 +59,7 @@ s.license = {

# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

s.dependency "CocoaLumberjack", "2.3"
s.dependency "CocoaLumberjack"
s.dependency "AFNetworking", "~> 3.x"
s.dependency "sqlite3"

Expand Down

0 comments on commit e7a9473

Please sign in to comment.