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. # limitations under the License.
# #


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


# C SDK (Linux) - cd client/client-multi/client-c/ && travis_retry nix-shell -Q --pure --run true --arg cc3200Support false && cd ../../..
- os: linux - cd client/client-multi/client-cpp/ && travis_retry nix-shell -Q --pure --run true && cd ../../..
install: - travis_retry nix-shell -Q --packages pkgs.maven --pure --run true
- 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


# C SDK (macOS) script:
- os: osx - nix-shell --pure --packages pkgs.maven --run 'mvn -q apache-rat:check'
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'


# C++ SDK (Linux) - cd client/client-multi/client-c
- os: linux - nix-shell --arg cc3200Support false --pure --run ./scripts/build.sh
install: - cd ../../..
- cd client/client-multi/client-cpp/
- travis_retry nix-shell -Q --pure --run true - cd client/client-multi/client-cpp
script: - nix-shell --pure --run './build.sh test'
- 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> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.kaaproject</groupId> <groupId>org.kaaproject</groupId>
<version>0.11.0-SNAPSHOT</version> <version>0.10.0-SNAPSHOT</version>
<artifactId>kaa</artifactId> <artifactId>kaa</artifactId>
</parent> </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, ${ENUM_NAME}_$symbol,
#end #end
} $namespacePrefix${enum_name}; } $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) { if (self) {
#foreach ($field in $schema.getFields()) #foreach ($field in $schema.getFields())
self.$field.name() = $field.name(); self.$field.name() = $field.name();
#end #end
} }
return self; return self;
} }
Expand All @@ -62,34 +62,6 @@ $initstring {
return @"$schema.getFullName()"; 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)) ###if ($TypeConverter.isTypeOut($schema))
- (void)serialize:(avro_writer_t)writer { - (void)serialize:(avro_writer_t)writer {
#foreach ($field in $schema.getFields()) #foreach ($field in $schema.getFields())
Expand Down Expand Up @@ -278,8 +250,6 @@ $initstring {
#end #end
} }




## Generating serialize/deserialize/getSize methods for Unions ## Generating serialize/deserialize/getSize methods for Unions


#if ($schema.getFields().size() > 0) #if ($schema.getFields().size() > 0)
Expand Down Expand Up @@ -521,4 +491,4 @@ $initstring {
#end #end
#end #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> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.kaaproject.kaa.client</groupId> <groupId>org.kaaproject.kaa.client</groupId>
<version>0.11.0-SNAPSHOT</version> <version>0.10.0-SNAPSHOT</version>
<artifactId>client-multi</artifactId> <artifactId>client-multi</artifactId>
</parent> </parent>
<artifactId>client-c</artifactId> <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 cd build-posix
ctest -T test ctest -T test
if [ -z ${NO_MEMCHECK+x} ]; then # if unset ctest -T memcheck
ctest -T memcheck
fi
ctest -T coverage ctest -T coverage
cd .. 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. * Ensure the first request is allowed.
*/ */
// cppcheck-suppress redundantAssignment
strategy.max_parallel_uploads = 1; strategy.max_parallel_uploads = 1;
error_code = kaa_logging_add_record(log_collector, test_log_record, NULL); error_code = kaa_logging_add_record(log_collector, test_log_record, NULL);
ASSERT_EQUAL(error_code, KAA_ERR_NONE); 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. * Ensure the first request is allowed.
*/ */
// cppcheck-suppress redundantAssignment
strategy.max_parallel_uploads = 1; strategy.max_parallel_uploads = 1;
error_code = kaa_logging_add_record(log_collector, test_log_record, NULL); error_code = kaa_logging_add_record(log_collector, test_log_record, NULL);
ASSERT_EQUAL(error_code, KAA_ERR_NONE); 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 { struct response_chunk {
uint8_t bucket_id[2]; /* 16 bits for bucket ID */ uint8_t bucket_id[2]; /* 16 bits for bucket ID */
uint8_t resp_code; /* 8 bits for response code. 0 == SUCCESS, 1 == FAILURE */ uint8_t resp_code; /* 8 bits for response code. 0 == SUCCESS, 1 == FAILURE */
// cppcheck-suppress unusedStructMember
uint8_t reserved; /* Should be 0 */ uint8_t reserved; /* Should be 0 */
}; };


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


#include <inttypes.h> #include <inttypes.h>




uint64_t __ashldi3(uint64_t a, int b) uint64_t __ashldi3(uint64_t a, int b)
{ {
if (b <= 0) { if (b <= 0 ) {
return a; return a;
} }
if (b >= 64) { if (b >= 64) {
return 0; return 0;
} }
uint32_t aLow = (uint32_t)a; uint32_t aLow = (uint32_t) a;
uint32_t aHigh = (uint32_t)(a >> 32); uint32_t aHigh = (uint32_t) (a >> 32);
if (b >= 32) { if (b >= 32) {
aHigh = (aLow << (b - 32)); aHigh = (aLow << b);
aLow = 0; aLow = 0;
} else { } else {
aHigh = (aHigh << b) + (aLow >> (32 - b)); aHigh = (aHigh << b) + (aLow >> (32 - b));
aLow = (aLow << b); aLow = (aLow << b);
} }
return ((uint64_t) aHigh << 32) + aLow; 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> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.kaaproject.kaa.client</groupId> <groupId>org.kaaproject.kaa.client</groupId>
<version>0.11.0-SNAPSHOT</version> <version>0.10.0-SNAPSHOT</version>
<artifactId>client-multi</artifactId> <artifactId>client-multi</artifactId>
</parent> </parent>
<artifactId>client-cpp</artifactId> <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> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.kaaproject.kaa.client</groupId> <groupId>org.kaaproject.kaa.client</groupId>
<version>0.11.0-SNAPSHOT</version> <version>0.10.0-SNAPSHOT</version>
<artifactId>client-multi</artifactId> <artifactId>client-multi</artifactId>
</parent> </parent>
<artifactId>client-java-android</artifactId> <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> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.kaaproject.kaa.client</groupId> <groupId>org.kaaproject.kaa.client</groupId>
<version>0.11.0-SNAPSHOT</version> <version>0.10.0-SNAPSHOT</version>
<artifactId>client-multi</artifactId> <artifactId>client-multi</artifactId>
</parent> </parent>
<artifactId>client-java-core</artifactId> <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 static final Logger LOG = LoggerFactory.getLogger(DefaultUserTransport.class);


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


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


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

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


Mockito.when(processor.getAttachEndpointRequests()).thenReturn(attachingEPs); 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, SyncResponseResultType.SUCCESS),
new EndpointDetachResponse(REQUEST_ID_1 + 2, SyncResponseResultType.FAILURE))); new EndpointDetachResponse(REQUEST_ID_1 + 2, SyncResponseResultType.FAILURE)));


transport.onUserResponse(response1);
transport.setEndpointRegistrationProcessor(processor); transport.setEndpointRegistrationProcessor(processor);
transport.setClientState(clientState); transport.setClientState(clientState);
transport.onUserResponse(response1); 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(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()); UserSyncResponse response2 = new UserSyncResponse();
}

@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)));


transport.setClientState(clientState); response2.setEndpointDetachResponses(Arrays.asList(
transport.setEndpointRegistrationProcessor(processor); new EndpointDetachResponse(REQUEST_ID_2, SyncResponseResultType.SUCCESS)));

Map<EndpointAccessToken, EndpointKeyHash> map = new HashMap<>();
map.put(new EndpointAccessToken("token1"), new EndpointKeyHash("keyhash1"));


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


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

} }
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> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.kaaproject.kaa.client</groupId> <groupId>org.kaaproject.kaa.client</groupId>
<version>0.11.0-SNAPSHOT</version> <version>0.10.0-SNAPSHOT</version>
<artifactId>client-multi</artifactId> <artifactId>client-multi</artifactId>
</parent> </parent>
<artifactId>client-java-desktop</artifactId> <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 ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #


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


Expand Down

0 comments on commit e7a9473

Please sign in to comment.